mirror of
https://github.com/mosh-hamedani/helpdesk.git
synced 2026-05-21 11:58:19 +02:00
Polish the UI
This commit is contained in:
parent
9127777c7a
commit
f72e08ff59
177
.agents/skills/frontend-design/LICENSE.txt
Normal file
177
.agents/skills/frontend-design/LICENSE.txt
Normal file
|
|
@ -0,0 +1,177 @@
|
|||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
42
.agents/skills/frontend-design/SKILL.md
Normal file
42
.agents/skills/frontend-design/SKILL.md
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
---
|
||||
name: frontend-design
|
||||
description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.
|
||||
license: Complete terms in LICENSE.txt
|
||||
---
|
||||
|
||||
This skill guides creation of distinctive, production-grade frontend interfaces that avoid generic "AI slop" aesthetics. Implement real working code with exceptional attention to aesthetic details and creative choices.
|
||||
|
||||
The user provides frontend requirements: a component, page, application, or interface to build. They may include context about the purpose, audience, or technical constraints.
|
||||
|
||||
## Design Thinking
|
||||
|
||||
Before coding, understand the context and commit to a BOLD aesthetic direction:
|
||||
- **Purpose**: What problem does this interface solve? Who uses it?
|
||||
- **Tone**: Pick an extreme: brutally minimal, maximalist chaos, retro-futuristic, organic/natural, luxury/refined, playful/toy-like, editorial/magazine, brutalist/raw, art deco/geometric, soft/pastel, industrial/utilitarian, etc. There are so many flavors to choose from. Use these for inspiration but design one that is true to the aesthetic direction.
|
||||
- **Constraints**: Technical requirements (framework, performance, accessibility).
|
||||
- **Differentiation**: What makes this UNFORGETTABLE? What's the one thing someone will remember?
|
||||
|
||||
**CRITICAL**: Choose a clear conceptual direction and execute it with precision. Bold maximalism and refined minimalism both work - the key is intentionality, not intensity.
|
||||
|
||||
Then implement working code (HTML/CSS/JS, React, Vue, etc.) that is:
|
||||
- Production-grade and functional
|
||||
- Visually striking and memorable
|
||||
- Cohesive with a clear aesthetic point-of-view
|
||||
- Meticulously refined in every detail
|
||||
|
||||
## Frontend Aesthetics Guidelines
|
||||
|
||||
Focus on:
|
||||
- **Typography**: Choose fonts that are beautiful, unique, and interesting. Avoid generic fonts like Arial and Inter; opt instead for distinctive choices that elevate the frontend's aesthetics; unexpected, characterful font choices. Pair a distinctive display font with a refined body font.
|
||||
- **Color & Theme**: Commit to a cohesive aesthetic. Use CSS variables for consistency. Dominant colors with sharp accents outperform timid, evenly-distributed palettes.
|
||||
- **Motion**: Use animations for effects and micro-interactions. Prioritize CSS-only solutions for HTML. Use Motion library for React when available. Focus on high-impact moments: one well-orchestrated page load with staggered reveals (animation-delay) creates more delight than scattered micro-interactions. Use scroll-triggering and hover states that surprise.
|
||||
- **Spatial Composition**: Unexpected layouts. Asymmetry. Overlap. Diagonal flow. Grid-breaking elements. Generous negative space OR controlled density.
|
||||
- **Backgrounds & Visual Details**: Create atmosphere and depth rather than defaulting to solid colors. Add contextual effects and textures that match the overall aesthetic. Apply creative forms like gradient meshes, noise textures, geometric patterns, layered transparencies, dramatic shadows, decorative borders, custom cursors, and grain overlays.
|
||||
|
||||
NEVER use generic AI-generated aesthetics like overused font families (Inter, Roboto, Arial, system fonts), cliched color schemes (particularly purple gradients on white backgrounds), predictable layouts and component patterns, and cookie-cutter design that lacks context-specific character.
|
||||
|
||||
Interpret creatively and make unexpected choices that feel genuinely designed for the context. No design should be the same. Vary between light and dark themes, different fonts, different aesthetics. NEVER converge on common choices (Space Grotesk, for example) across generations.
|
||||
|
||||
**IMPORTANT**: Match implementation complexity to the aesthetic vision. Maximalist designs need elaborate code with extensive animations and effects. Minimalist or refined designs need restraint, precision, and careful attention to spacing, typography, and subtle details. Elegance comes from executing the vision well.
|
||||
|
||||
Remember: Claude is capable of extraordinary creative work. Don't hold back, show what can truly be created when thinking outside the box and committing fully to a distinctive vision.
|
||||
1
.claude/skills/frontend-design
Symbolic link
1
.claude/skills/frontend-design
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../.agents/skills/frontend-design
|
||||
|
|
@ -1,12 +1,21 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<html lang="en" class="dark">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap" rel="stylesheet" />
|
||||
<title>Helpdesk</title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
(function() {
|
||||
var t = localStorage.getItem('helpdesk-theme');
|
||||
if (t === 'light') document.documentElement.classList.remove('dark');
|
||||
})();
|
||||
</script>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -1,41 +1,91 @@
|
|||
import { Link, Outlet, useNavigate } from "react-router";
|
||||
import { Link, NavLink, Outlet, useNavigate } from "react-router";
|
||||
import { Role } from "core/constants/role.ts";
|
||||
import { signOut, useSession } from "../lib/auth-client";
|
||||
import { useTheme } from "../lib/theme";
|
||||
import {
|
||||
LayoutDashboard,
|
||||
Ticket,
|
||||
Users,
|
||||
LogOut,
|
||||
Sun,
|
||||
Moon,
|
||||
} from "lucide-react";
|
||||
|
||||
export default function Layout() {
|
||||
const { data: session } = useSession();
|
||||
const navigate = useNavigate();
|
||||
const { theme, toggleTheme } = useTheme();
|
||||
|
||||
const handleSignOut = async () => {
|
||||
await signOut();
|
||||
navigate("/login", { replace: true });
|
||||
};
|
||||
|
||||
const navLinkClass = ({ isActive }: { isActive: boolean }) =>
|
||||
`inline-flex items-center gap-2 text-[13px] font-medium px-3 py-1.5 rounded-lg transition-all duration-200 ${
|
||||
isActive
|
||||
? "text-primary-foreground bg-primary"
|
||||
: "text-muted-foreground hover:text-foreground hover:bg-accent"
|
||||
}`;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col">
|
||||
<nav className="flex items-center justify-between bg-background border-b px-6 h-14">
|
||||
<div className="flex items-center gap-6">
|
||||
<Link to="/" className="text-lg font-bold hover:text-foreground transition-colors">Helpdesk</Link>
|
||||
<Link to="/tickets" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
|
||||
Tickets
|
||||
<div className="min-h-screen flex flex-col bg-background">
|
||||
<nav className="sticky top-0 z-50 bg-background border-b px-6 h-14 flex items-center justify-between">
|
||||
<div className="flex items-center gap-1.5">
|
||||
<Link
|
||||
to="/"
|
||||
className="flex items-center gap-2 mr-5 group"
|
||||
>
|
||||
<div className="h-7 w-7 rounded-lg bg-primary flex items-center justify-center">
|
||||
<span className="text-primary-foreground font-bold text-sm">
|
||||
H
|
||||
</span>
|
||||
</div>
|
||||
<span className="text-[15px] font-semibold tracking-tight group-hover:text-foreground transition-colors">
|
||||
Helpdesk
|
||||
</span>
|
||||
</Link>
|
||||
<NavLink to="/" end className={navLinkClass}>
|
||||
<LayoutDashboard className="h-3.5 w-3.5" />
|
||||
Dashboard
|
||||
</NavLink>
|
||||
<NavLink to="/tickets" className={navLinkClass}>
|
||||
<Ticket className="h-3.5 w-3.5" />
|
||||
Tickets
|
||||
</NavLink>
|
||||
{session?.user?.role === Role.admin && (
|
||||
<Link to="/users" className="text-sm text-muted-foreground hover:text-foreground transition-colors">
|
||||
<NavLink to="/users" className={navLinkClass}>
|
||||
<Users className="h-3.5 w-3.5" />
|
||||
Users
|
||||
</Link>
|
||||
</NavLink>
|
||||
)}
|
||||
</div>
|
||||
<div className="flex items-center gap-4">
|
||||
<span className="text-sm text-muted-foreground">{session?.user?.name}</span>
|
||||
<div className="flex items-center gap-1">
|
||||
<button
|
||||
className="inline-flex items-center justify-center rounded-md text-sm font-medium px-4 py-2 border border-input hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer"
|
||||
onClick={toggleTheme}
|
||||
className="inline-flex items-center justify-center rounded-lg h-8 w-8 text-muted-foreground hover:text-foreground hover:bg-accent transition-all duration-200 cursor-pointer"
|
||||
aria-label="Toggle theme"
|
||||
>
|
||||
{theme === "dark" ? (
|
||||
<Sun className="h-4 w-4" />
|
||||
) : (
|
||||
<Moon className="h-4 w-4" />
|
||||
)}
|
||||
</button>
|
||||
<div className="h-5 w-px bg-border mx-2" />
|
||||
<span className="text-[13px] text-muted-foreground mr-1">
|
||||
{session?.user?.name}
|
||||
</span>
|
||||
<button
|
||||
className="inline-flex items-center justify-center gap-1.5 rounded-lg text-[13px] font-medium px-2.5 py-1.5 text-muted-foreground hover:text-foreground hover:bg-accent transition-all duration-200 cursor-pointer"
|
||||
onClick={handleSignOut}
|
||||
>
|
||||
<LogOut className="h-3.5 w-3.5" />
|
||||
Sign out
|
||||
</button>
|
||||
</div>
|
||||
</nav>
|
||||
<main className="flex-1 p-8 max-w-[1200px] w-full mx-auto">
|
||||
<main className="flex-1 px-8 py-8 max-w-[1200px] w-full mx-auto animate-in-page">
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export default function ProtectedRoute() {
|
|||
|
||||
if (isPending) {
|
||||
return (
|
||||
<div className="flex items-center justify-center h-screen text-lg text-gray-500">
|
||||
<div className="flex items-center justify-center h-screen text-lg text-muted-foreground">
|
||||
Loading...
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ describe("ReplyThread", () => {
|
|||
expect(screen.getByText("Jane Doe")).toBeInTheDocument();
|
||||
});
|
||||
expect(screen.getByText("I can help with that")).toBeInTheDocument();
|
||||
expect(screen.getByText(/Agent/)).toBeInTheDocument();
|
||||
expect(screen.getAllByText(/Agent/).length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
|
||||
it("should display customer replies with the ticket sender name", async () => {
|
||||
|
|
@ -124,7 +124,7 @@ describe("ReplyThread", () => {
|
|||
renderWithQuery(<ReplyThread ticket={mockTicket} />);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("Agent")).toBeInTheDocument();
|
||||
expect(screen.getAllByText("Agent").length).toBeGreaterThanOrEqual(1);
|
||||
});
|
||||
expect(screen.getByText("Automated response")).toBeInTheDocument();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { type SenderType, senderTypeLabel } from "core/constants/sender-type.ts"
|
|||
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import ErrorAlert from "@/components/ErrorAlert";
|
||||
import { Bot, User } from "lucide-react";
|
||||
|
||||
interface Reply {
|
||||
id: number;
|
||||
|
|
@ -58,15 +59,35 @@ export default function ReplyThread({ ticket }: ReplyThreadProps) {
|
|||
: senderName;
|
||||
|
||||
return (
|
||||
<Card key={reply.id}>
|
||||
<Card
|
||||
key={reply.id}
|
||||
className={isAgent ? "border-primary/25" : ""}
|
||||
>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-sm font-medium">
|
||||
{displayName}
|
||||
</CardTitle>
|
||||
<CardDescription className="text-xs">
|
||||
{senderTypeLabel[reply.senderType]} ·{" "}
|
||||
{new Date(reply.createdAt).toLocaleString()}
|
||||
</CardDescription>
|
||||
<div className="flex items-center gap-2">
|
||||
<div
|
||||
className={`h-6 w-6 rounded-md flex items-center justify-center ${
|
||||
isAgent
|
||||
? "bg-primary/15 text-primary"
|
||||
: "bg-muted text-muted-foreground"
|
||||
}`}
|
||||
>
|
||||
{isAgent ? (
|
||||
<Bot className="h-3.5 w-3.5" />
|
||||
) : (
|
||||
<User className="h-3.5 w-3.5" />
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
<CardTitle className="text-sm font-medium">
|
||||
{displayName}
|
||||
</CardTitle>
|
||||
<CardDescription className="text-xs">
|
||||
{senderTypeLabel[reply.senderType]} ·{" "}
|
||||
{new Date(reply.createdAt).toLocaleString()}
|
||||
</CardDescription>
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{reply.bodyHtml ? (
|
||||
|
|
@ -76,7 +97,9 @@ export default function ReplyThread({ ticket }: ReplyThreadProps) {
|
|||
}}
|
||||
/>
|
||||
) : (
|
||||
<p className="whitespace-pre-line">{reply.body}</p>
|
||||
<p className="whitespace-pre-line leading-relaxed">
|
||||
{reply.body}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
|
|||
20
client/src/components/StatusBadge.tsx
Normal file
20
client/src/components/StatusBadge.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { type TicketStatus, statusLabel } from "core/constants/ticket-status.ts";
|
||||
|
||||
const statusStyles: Record<TicketStatus, string> = {
|
||||
new: "bg-sky-500/15 text-sky-400",
|
||||
processing: "bg-amber-500/15 text-amber-400",
|
||||
open: "bg-pink-400/15 text-pink-400",
|
||||
resolved: "bg-muted text-muted-foreground",
|
||||
closed: "bg-muted text-muted-foreground",
|
||||
};
|
||||
|
||||
export default function StatusBadge({ status }: { status: TicketStatus }) {
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center gap-1.5 rounded-md border-0 px-2 py-0.5 text-xs font-medium ${statusStyles[status]}`}
|
||||
>
|
||||
<span className="h-1.5 w-1.5 rounded-full bg-current" />
|
||||
{statusLabel[status]}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
|
@ -58,10 +58,9 @@ describe("TicketDetail", () => {
|
|||
expect(screen.queryByText("I need help logging in")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should display the message card with sender name", () => {
|
||||
it("should display the ticket body content", () => {
|
||||
render(<TicketDetail ticket={mockTicket} />);
|
||||
|
||||
expect(screen.getByText("Message")).toBeInTheDocument();
|
||||
expect(screen.getByText("From Alice Smith")).toBeInTheDocument();
|
||||
expect(screen.getByText("I need help logging in")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,12 +1,7 @@
|
|||
import DOMPurify from "dompurify";
|
||||
import { type Ticket } from "core/constants/ticket.ts";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import StatusBadge from "@/components/StatusBadge";
|
||||
|
||||
interface TicketDetailProps {
|
||||
ticket: Ticket;
|
||||
|
|
@ -16,29 +11,30 @@ export default function TicketDetail({ ticket }: TicketDetailProps) {
|
|||
return (
|
||||
<>
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold">{ticket.subject}</h1>
|
||||
<div className="mt-2 space-y-1 text-sm">
|
||||
<div className="flex items-start gap-3 mb-3">
|
||||
<h1 className="text-2xl font-semibold tracking-tight flex-1">
|
||||
{ticket.subject}
|
||||
</h1>
|
||||
<StatusBadge status={ticket.status} />
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-x-5 gap-y-1 text-[13px] text-muted-foreground">
|
||||
<div>
|
||||
<span className="text-muted-foreground">From: </span>
|
||||
<span className="font-medium text-foreground">From:</span>{" "}
|
||||
{ticket.senderName} ({ticket.senderEmail})
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">Created: </span>
|
||||
<span className="font-medium text-foreground">Created:</span>{" "}
|
||||
{new Date(ticket.createdAt).toLocaleString()}
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-muted-foreground">Updated: </span>
|
||||
<span className="font-medium text-foreground">Updated:</span>{" "}
|
||||
{new Date(ticket.updatedAt).toLocaleString()}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Message</CardTitle>
|
||||
<CardDescription>From {ticket.senderName}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<CardContent className="pt-6">
|
||||
{ticket.bodyHtml ? (
|
||||
<div
|
||||
dangerouslySetInnerHTML={{
|
||||
|
|
@ -46,7 +42,9 @@ export default function TicketDetail({ ticket }: TicketDetailProps) {
|
|||
}}
|
||||
/>
|
||||
) : (
|
||||
<p className="whitespace-pre-wrap">{ticket.body}</p>
|
||||
<p className="whitespace-pre-wrap leading-relaxed">
|
||||
{ticket.body}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import axios from "axios";
|
|||
import { Sparkles } from "lucide-react";
|
||||
import { type Ticket } from "core/constants/ticket.ts";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import ErrorAlert from "@/components/ErrorAlert";
|
||||
|
||||
interface TicketSummaryProps {
|
||||
|
|
@ -26,8 +26,9 @@ export default function TicketSummary({ ticket }: TicketSummaryProps) {
|
|||
variant="outline"
|
||||
onClick={() => summarizeMutation.mutate()}
|
||||
disabled={summarizeMutation.isPending}
|
||||
className="gap-2"
|
||||
>
|
||||
<Sparkles className="mr-2 h-4 w-4" />
|
||||
<Sparkles className="h-4 w-4 text-primary" />
|
||||
{summarizeMutation.isPending ? "Summarizing..." : "Summarize"}
|
||||
</Button>
|
||||
|
||||
|
|
@ -39,14 +40,16 @@ export default function TicketSummary({ ticket }: TicketSummaryProps) {
|
|||
)}
|
||||
|
||||
{summarizeMutation.data && (
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="text-sm font-medium">Summary</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="whitespace-pre-wrap">
|
||||
{summarizeMutation.data}
|
||||
</p>
|
||||
<Card className="border-chart-3/25 bg-chart-3/5">
|
||||
<CardContent className="pt-6">
|
||||
<div className="flex items-start gap-2.5">
|
||||
<div className="h-6 w-6 rounded-md bg-chart-3/15 flex items-center justify-center shrink-0 mt-0.5">
|
||||
<Sparkles className="h-3.5 w-3.5 text-chart-3" />
|
||||
</div>
|
||||
<p className="whitespace-pre-wrap text-sm leading-relaxed">
|
||||
{summarizeMutation.data}
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import axios from "axios";
|
|||
import { type Ticket } from "core/constants/ticket.ts";
|
||||
import { agentTicketStatuses, statusLabel } from "core/constants/ticket-status.ts";
|
||||
import { ticketCategories, categoryLabel } from "core/constants/ticket-category.ts";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
|
|
@ -42,73 +43,81 @@ export default function UpdateTicket({ ticket }: UpdateTicketProps) {
|
|||
});
|
||||
|
||||
return (
|
||||
<div className="w-48 space-y-4 text-sm">
|
||||
<div className="space-y-1">
|
||||
<span className="text-muted-foreground">Status</span>
|
||||
<Select
|
||||
value={ticket.status}
|
||||
onValueChange={(value) => updateMutation.mutate({ status: value })}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{agentTicketStatuses.map((s) => (
|
||||
<SelectItem key={s} value={s}>
|
||||
{statusLabel[s]}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<Card className="w-56 h-fit">
|
||||
<CardContent className="pt-5 space-y-5">
|
||||
<div className="space-y-1.5">
|
||||
<span className="text-[11px] font-semibold uppercase tracking-widest text-muted-foreground">
|
||||
Status
|
||||
</span>
|
||||
<Select
|
||||
value={ticket.status}
|
||||
onValueChange={(value) => updateMutation.mutate({ status: value })}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
{agentTicketStatuses.map((s) => (
|
||||
<SelectItem key={s} value={s}>
|
||||
{statusLabel[s]}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<span className="text-muted-foreground">Category</span>
|
||||
<Select
|
||||
value={ticket.category ?? "none"}
|
||||
onValueChange={(value) =>
|
||||
updateMutation.mutate({
|
||||
category: value === "none" ? null : value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="none">None</SelectItem>
|
||||
{ticketCategories.map((c) => (
|
||||
<SelectItem key={c} value={c}>
|
||||
{categoryLabel[c]}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<span className="text-[11px] font-semibold uppercase tracking-widest text-muted-foreground">
|
||||
Category
|
||||
</span>
|
||||
<Select
|
||||
value={ticket.category ?? "none"}
|
||||
onValueChange={(value) =>
|
||||
updateMutation.mutate({
|
||||
category: value === "none" ? null : value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="none">None</SelectItem>
|
||||
{ticketCategories.map((c) => (
|
||||
<SelectItem key={c} value={c}>
|
||||
{categoryLabel[c]}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="space-y-1">
|
||||
<span className="text-muted-foreground">Assigned To</span>
|
||||
<Select
|
||||
value={ticket.assignedTo?.id ?? "unassigned"}
|
||||
onValueChange={(value) =>
|
||||
updateMutation.mutate({
|
||||
assignedToId: value === "unassigned" ? null : value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="unassigned">Unassigned</SelectItem>
|
||||
{agentsData?.agents.map((agent) => (
|
||||
<SelectItem key={agent.id} value={agent.id}>
|
||||
{agent.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-1.5">
|
||||
<span className="text-[11px] font-semibold uppercase tracking-widest text-muted-foreground">
|
||||
Assigned To
|
||||
</span>
|
||||
<Select
|
||||
value={ticket.assignedTo?.id ?? "unassigned"}
|
||||
onValueChange={(value) =>
|
||||
updateMutation.mutate({
|
||||
assignedToId: value === "unassigned" ? null : value,
|
||||
})
|
||||
}
|
||||
>
|
||||
<SelectTrigger size="sm" className="w-full">
|
||||
<SelectValue />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem value="unassigned">Unassigned</SelectItem>
|
||||
{agentsData?.agents.map((agent) => (
|
||||
<SelectItem key={agent.id} value={agent.id}>
|
||||
{agent.name}
|
||||
</SelectItem>
|
||||
))}
|
||||
</SelectContent>
|
||||
</Select>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
@custom-variant dark (&:is(.dark *));
|
||||
|
||||
@theme inline {
|
||||
--font-sans: "Inter", ui-sans-serif, system-ui, sans-serif,
|
||||
"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
--radius-sm: calc(var(--radius) - 4px);
|
||||
--radius-md: calc(var(--radius) - 2px);
|
||||
--radius-lg: var(--radius);
|
||||
|
|
@ -47,71 +49,71 @@
|
|||
|
||||
:root {
|
||||
--radius: 0.625rem;
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.145 0 0);
|
||||
--background: oklch(0.99 0 0);
|
||||
--foreground: oklch(0.13 0.012 270);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.145 0 0);
|
||||
--card-foreground: oklch(0.13 0.012 270);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.145 0 0);
|
||||
--primary: oklch(0.205 0 0);
|
||||
--primary-foreground: oklch(0.985 0 0);
|
||||
--secondary: oklch(0.97 0 0);
|
||||
--secondary-foreground: oklch(0.205 0 0);
|
||||
--muted: oklch(0.97 0 0);
|
||||
--muted-foreground: oklch(0.556 0 0);
|
||||
--accent: oklch(0.97 0 0);
|
||||
--accent-foreground: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.13 0.012 270);
|
||||
--primary: oklch(0.527 0.280 287);
|
||||
--primary-foreground: oklch(1 0 0);
|
||||
--secondary: oklch(0.965 0.006 270);
|
||||
--secondary-foreground: oklch(0.18 0.012 270);
|
||||
--muted: oklch(0.965 0.003 270);
|
||||
--muted-foreground: oklch(0.48 0.008 270);
|
||||
--accent: oklch(0.965 0.006 270);
|
||||
--accent-foreground: oklch(0.18 0.012 270);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.922 0 0);
|
||||
--input: oklch(0.922 0 0);
|
||||
--ring: oklch(0.708 0 0);
|
||||
--chart-1: oklch(0.646 0.222 41.116);
|
||||
--chart-2: oklch(0.6 0.118 184.704);
|
||||
--chart-3: oklch(0.398 0.07 227.392);
|
||||
--chart-4: oklch(0.828 0.189 84.429);
|
||||
--chart-5: oklch(0.769 0.188 70.08);
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.145 0 0);
|
||||
--sidebar-primary: oklch(0.205 0 0);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.97 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||
--sidebar-border: oklch(0.922 0 0);
|
||||
--sidebar-ring: oklch(0.708 0 0);
|
||||
--border: oklch(0.92 0.003 270);
|
||||
--input: oklch(0.92 0.003 270);
|
||||
--ring: oklch(0.527 0.280 287);
|
||||
--chart-1: oklch(0.527 0.280 287);
|
||||
--chart-2: oklch(0.623 0.214 259);
|
||||
--chart-3: oklch(0.696 0.17 162.48);
|
||||
--chart-4: oklch(0.78 0.17 75);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.985 0.003 270);
|
||||
--sidebar-foreground: oklch(0.13 0.012 270);
|
||||
--sidebar-primary: oklch(0.527 0.280 287);
|
||||
--sidebar-primary-foreground: oklch(1 0 0);
|
||||
--sidebar-accent: oklch(0.965 0.006 270);
|
||||
--sidebar-accent-foreground: oklch(0.18 0.012 270);
|
||||
--sidebar-border: oklch(0.92 0.003 270);
|
||||
--sidebar-ring: oklch(0.527 0.280 287);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.145 0 0);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.205 0 0);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.205 0 0);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.922 0 0);
|
||||
--primary-foreground: oklch(0.205 0 0);
|
||||
--secondary: oklch(0.269 0 0);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.269 0 0);
|
||||
--muted-foreground: oklch(0.708 0 0);
|
||||
--accent: oklch(0.269 0 0);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--background: oklch(0.13 0.01 270);
|
||||
--foreground: oklch(0.93 0.003 270);
|
||||
--card: oklch(0.17 0.01 270);
|
||||
--card-foreground: oklch(0.93 0.003 270);
|
||||
--popover: oklch(0.17 0.01 270);
|
||||
--popover-foreground: oklch(0.93 0.003 270);
|
||||
--primary: oklch(0.60 0.27 287);
|
||||
--primary-foreground: oklch(1 0 0);
|
||||
--secondary: oklch(0.21 0.01 270);
|
||||
--secondary-foreground: oklch(0.93 0.003 270);
|
||||
--muted: oklch(0.21 0.01 270);
|
||||
--muted-foreground: oklch(0.55 0.008 270);
|
||||
--accent: oklch(0.21 0.01 270);
|
||||
--accent-foreground: oklch(0.93 0.003 270);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.556 0 0);
|
||||
--chart-1: oklch(0.488 0.243 264.376);
|
||||
--chart-2: oklch(0.696 0.17 162.48);
|
||||
--chart-3: oklch(0.769 0.188 70.08);
|
||||
--chart-4: oklch(0.627 0.265 303.9);
|
||||
--border: oklch(0.25 0.01 270);
|
||||
--input: oklch(0.21 0.01 270);
|
||||
--ring: oklch(0.60 0.27 287);
|
||||
--chart-1: oklch(0.60 0.27 287);
|
||||
--chart-2: oklch(0.623 0.214 259);
|
||||
--chart-3: oklch(0.696 0.17 162.48);
|
||||
--chart-4: oklch(0.78 0.17 75);
|
||||
--chart-5: oklch(0.645 0.246 16.439);
|
||||
--sidebar: oklch(0.205 0 0);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||
--sidebar-accent: oklch(0.269 0 0);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.556 0 0);
|
||||
--sidebar: oklch(0.15 0.01 270);
|
||||
--sidebar-foreground: oklch(0.93 0.003 270);
|
||||
--sidebar-primary: oklch(0.60 0.27 287);
|
||||
--sidebar-primary-foreground: oklch(0.93 0.003 270);
|
||||
--sidebar-accent: oklch(0.21 0.01 270);
|
||||
--sidebar-accent-foreground: oklch(0.93 0.003 270);
|
||||
--sidebar-border: oklch(0.25 0.01 270);
|
||||
--sidebar-ring: oklch(0.60 0.27 287);
|
||||
}
|
||||
|
||||
@utility link {
|
||||
|
|
@ -123,10 +125,10 @@
|
|||
@apply border-border outline-ring/50;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
@apply bg-background text-foreground antialiased;
|
||||
}
|
||||
h2 {
|
||||
@apply text-lg font-semibold;
|
||||
@apply text-lg font-semibold tracking-tight;
|
||||
}
|
||||
input:-webkit-autofill,
|
||||
input:-webkit-autofill:hover,
|
||||
|
|
@ -135,3 +137,18 @@
|
|||
-webkit-text-fill-color: var(--foreground);
|
||||
}
|
||||
}
|
||||
|
||||
@utility animate-in-page {
|
||||
animation: fadeInUp 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
|
||||
}
|
||||
|
||||
@keyframes fadeInUp {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(8px);
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
44
client/src/lib/theme.tsx
Normal file
44
client/src/lib/theme.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { createContext, useContext, useEffect, useState } from "react";
|
||||
|
||||
type Theme = "light" | "dark";
|
||||
|
||||
const STORAGE_KEY = "helpdesk-theme";
|
||||
|
||||
const ThemeContext = createContext<{
|
||||
theme: Theme;
|
||||
toggleTheme: () => void;
|
||||
}>({
|
||||
theme: "dark",
|
||||
toggleTheme: () => {},
|
||||
});
|
||||
|
||||
export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
||||
const [theme, setTheme] = useState<Theme>(() => {
|
||||
const stored = localStorage.getItem(STORAGE_KEY) as Theme | null;
|
||||
return stored ?? "dark";
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
const root = document.documentElement;
|
||||
if (theme === "dark") {
|
||||
root.classList.add("dark");
|
||||
} else {
|
||||
root.classList.remove("dark");
|
||||
}
|
||||
localStorage.setItem(STORAGE_KEY, theme);
|
||||
}, [theme]);
|
||||
|
||||
const toggleTheme = () => {
|
||||
setTheme((prev) => (prev === "dark" ? "light" : "dark"));
|
||||
};
|
||||
|
||||
return (
|
||||
<ThemeContext.Provider value={{ theme, toggleTheme }}>
|
||||
{children}
|
||||
</ThemeContext.Provider>
|
||||
);
|
||||
}
|
||||
|
||||
export function useTheme() {
|
||||
return useContext(ThemeContext);
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ import { StrictMode } from "react";
|
|||
import { createRoot } from "react-dom/client";
|
||||
import { BrowserRouter } from "react-router";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { ThemeProvider } from "./lib/theme";
|
||||
import "./index.css";
|
||||
import App from "./App.tsx";
|
||||
|
||||
|
|
@ -19,11 +20,13 @@ createRoot(document.getElementById("root")!).render(
|
|||
</div>
|
||||
}
|
||||
>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</QueryClientProvider>
|
||||
<ThemeProvider>
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<BrowserRouter>
|
||||
<App />
|
||||
</BrowserRouter>
|
||||
</QueryClientProvider>
|
||||
</ThemeProvider>
|
||||
</Sentry.ErrorBoundary>
|
||||
</StrictMode>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,6 +16,13 @@ import {
|
|||
} from "@/components/ui/chart";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import ErrorAlert from "@/components/ErrorAlert";
|
||||
import {
|
||||
TicketIcon,
|
||||
CircleDot,
|
||||
Sparkles,
|
||||
TrendingUp,
|
||||
Clock,
|
||||
} from "lucide-react";
|
||||
|
||||
interface Stats {
|
||||
totalTickets: number;
|
||||
|
|
@ -44,7 +51,7 @@ function formatDuration(seconds: number): string {
|
|||
const chartConfig = {
|
||||
tickets: {
|
||||
label: "Tickets",
|
||||
color: "hsl(var(--chart-1))",
|
||||
color: "var(--primary)",
|
||||
},
|
||||
} satisfies ChartConfig;
|
||||
|
||||
|
|
@ -76,7 +83,9 @@ export default function HomePage() {
|
|||
if (statsError) {
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold mb-6">Dashboard</h1>
|
||||
<h1 className="text-2xl font-semibold tracking-tight mb-6">
|
||||
Dashboard
|
||||
</h1>
|
||||
<ErrorAlert
|
||||
error={statsError}
|
||||
fallback="Failed to load dashboard stats"
|
||||
|
|
@ -86,35 +95,47 @@ export default function HomePage() {
|
|||
}
|
||||
|
||||
const cards = [
|
||||
{ title: "Total Tickets", value: stats?.totalTickets },
|
||||
{ title: "Open Tickets", value: stats?.openTickets },
|
||||
{ title: "Resolved by AI", value: stats?.resolvedByAI },
|
||||
{ title: "Total Tickets", value: stats?.totalTickets, icon: TicketIcon },
|
||||
{ title: "Open Tickets", value: stats?.openTickets, icon: CircleDot },
|
||||
{ title: "Resolved by AI", value: stats?.resolvedByAI, icon: Sparkles },
|
||||
{
|
||||
title: "AI Resolution Rate",
|
||||
value: stats ? `${stats.aiResolutionRate}%` : undefined,
|
||||
icon: TrendingUp,
|
||||
},
|
||||
{
|
||||
title: "Avg Resolution Time",
|
||||
value: stats ? formatDuration(stats.avgResolutionTime) : undefined,
|
||||
icon: Clock,
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<div>
|
||||
<h1 className="text-2xl font-bold mb-6">Dashboard</h1>
|
||||
<h1 className="text-2xl font-semibold tracking-tight mb-6">Dashboard</h1>
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-5 gap-4">
|
||||
{cards.map((card) => (
|
||||
<Card key={card.title}>
|
||||
<Card
|
||||
key={card.title}
|
||||
className=""
|
||||
>
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-sm font-medium text-muted-foreground">
|
||||
{card.title}
|
||||
</CardTitle>
|
||||
<div className="flex items-center justify-between">
|
||||
<CardTitle className="text-[13px] font-medium text-muted-foreground">
|
||||
{card.title}
|
||||
</CardTitle>
|
||||
<div className="h-8 w-8 rounded-lg bg-muted flex items-center justify-center">
|
||||
<card.icon className="h-4 w-4 text-muted-foreground" />
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{statsLoading ? (
|
||||
<Skeleton className="h-8 w-20" />
|
||||
<Skeleton className="h-9 w-20" />
|
||||
) : (
|
||||
<p className="text-2xl font-bold">{card.value}</p>
|
||||
<p className="text-3xl font-semibold tracking-tight">
|
||||
{card.value}
|
||||
</p>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
|
|||
|
|
@ -65,52 +65,71 @@ export default function LoginPage() {
|
|||
};
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-screen bg-muted/50">
|
||||
<Card className="w-full max-w-[400px]">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-2xl">Helpdesk</CardTitle>
|
||||
<CardDescription>Sign in to your account</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit(onSubmit)} noValidate>
|
||||
{serverError && (
|
||||
<ErrorAlert message={serverError} className="mb-4" />
|
||||
)}
|
||||
<div className="grid gap-4">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
placeholder="admin@example.com"
|
||||
{...register("email")}
|
||||
/>
|
||||
{errors.email && (
|
||||
<ErrorMessage message={errors.email.message} />
|
||||
)}
|
||||
<div className="flex items-center justify-center min-h-screen bg-background">
|
||||
<div className="w-full max-w-[400px] px-4 animate-in-page">
|
||||
<div className="flex flex-col items-center mb-10">
|
||||
<div className="h-12 w-12 rounded-2xl bg-primary flex items-center justify-center mb-5">
|
||||
<span className="text-primary-foreground font-bold text-xl">H</span>
|
||||
</div>
|
||||
<h1 className="text-2xl font-semibold tracking-tight">
|
||||
Welcome back
|
||||
</h1>
|
||||
<p className="text-muted-foreground text-sm mt-1.5">
|
||||
Sign in to your helpdesk account
|
||||
</p>
|
||||
</div>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Sign in</CardTitle>
|
||||
<CardDescription>
|
||||
Enter your credentials to continue
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form onSubmit={handleSubmit(onSubmit)} noValidate>
|
||||
{serverError && (
|
||||
<ErrorAlert message={serverError} className="mb-4" />
|
||||
)}
|
||||
<div className="grid gap-4">
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="email">Email</Label>
|
||||
<Input
|
||||
id="email"
|
||||
type="email"
|
||||
placeholder="admin@example.com"
|
||||
{...register("email")}
|
||||
/>
|
||||
{errors.email && (
|
||||
<ErrorMessage message={errors.email.message} />
|
||||
)}
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
placeholder="Enter your password"
|
||||
{...register("password")}
|
||||
/>
|
||||
{errors.password && (
|
||||
<ErrorMessage message={errors.password.message} />
|
||||
)}
|
||||
</div>
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full"
|
||||
disabled={isSubmitting}
|
||||
>
|
||||
{isSubmitting && (
|
||||
<Loader2 className="animate-spin mr-2 h-4 w-4" />
|
||||
)}
|
||||
{isSubmitting ? "Signing in..." : "Sign in"}
|
||||
</Button>
|
||||
</div>
|
||||
<div className="grid gap-2">
|
||||
<Label htmlFor="password">Password</Label>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
placeholder="Enter your password"
|
||||
{...register("password")}
|
||||
/>
|
||||
{errors.password && (
|
||||
<ErrorMessage message={errors.password.message} />
|
||||
)}
|
||||
</div>
|
||||
<Button type="submit" className="w-full" disabled={isSubmitting}>
|
||||
{isSubmitting && (
|
||||
<Loader2 className="animate-spin mr-2 h-4 w-4" />
|
||||
)}
|
||||
{isSubmitting ? "Signing in..." : "Sign in"}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export default function TicketDetailPage() {
|
|||
<ReplyThread ticket={ticket} />
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
<div className="space-y-3 pb-16">
|
||||
<h2>Add a Reply</h2>
|
||||
<ReplyForm ticket={ticket} />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -100,11 +100,11 @@ describe("TicketsPage", () => {
|
|||
renderWithQuery(<TicketsPage />);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("open")).toBeInTheDocument();
|
||||
expect(screen.getByText("Open")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(screen.getByText("resolved")).toBeInTheDocument();
|
||||
expect(screen.getByText("closed")).toBeInTheDocument();
|
||||
expect(screen.getByText("Resolved")).toBeInTheDocument();
|
||||
expect(screen.getByText("Closed")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("should display category with underscores replaced by spaces", async () => {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ export default function TicketsPage() {
|
|||
return (
|
||||
<div>
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h1 className="text-2xl font-bold">Tickets</h1>
|
||||
<h1 className="text-2xl font-semibold tracking-tight">Tickets</h1>
|
||||
</div>
|
||||
<TicketsFilters filters={filters} onChange={setFilters} />
|
||||
<TicketsTable filters={filters} />
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import {
|
|||
flexRender,
|
||||
} from "@tanstack/react-table";
|
||||
import { type Ticket } from "core/constants/ticket.ts";
|
||||
import { statusVariant } from "core/constants/ticket-status.ts";
|
||||
import ErrorAlert from "@/components/ErrorAlert";
|
||||
import StatusBadge from "@/components/StatusBadge";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
|
|
@ -70,11 +70,7 @@ const columns: ColumnDef<Ticket>[] = [
|
|||
{
|
||||
accessorKey: "status",
|
||||
header: "Status",
|
||||
cell: ({ row }) => (
|
||||
<Badge variant={statusVariant[row.original.status]}>
|
||||
{row.original.status}
|
||||
</Badge>
|
||||
),
|
||||
cell: ({ row }) => <StatusBadge status={row.original.status} />,
|
||||
},
|
||||
{
|
||||
accessorKey: "category",
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ export default function UsersPage() {
|
|||
return (
|
||||
<div>
|
||||
<div className="flex items-center justify-between mb-6">
|
||||
<h1 className="text-2xl font-bold">Users</h1>
|
||||
<h1 className="text-2xl font-semibold tracking-tight">Users</h1>
|
||||
<Button onClick={() => setDialog({ mode: "create" })}>
|
||||
<Plus className="mr-2 h-4 w-4" />
|
||||
New User
|
||||
|
|
|
|||
10
skills-lock.json
Normal file
10
skills-lock.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"version": 1,
|
||||
"skills": {
|
||||
"frontend-design": {
|
||||
"source": "anthropics/skills",
|
||||
"sourceType": "github",
|
||||
"computedHash": "063a0e6448123cd359ad0044cc46b0e490cc7964d45ef4bb9fd842bd2ffbca67"
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue