This commit is contained in:
elnatansamuel25 2026-07-10 12:10:45 +03:00
parent 4acde7ffc9
commit 9d6c2850f0
21 changed files with 722 additions and 641 deletions

2
.gitignore vendored
View File

@ -25,3 +25,5 @@ dist-ssr
*.njsproj
*.sln
*.sw?
AGENTS.md
design-system.md

29
package-lock.json generated
View File

@ -94,7 +94,6 @@
"integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5",
@ -363,7 +362,6 @@
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
"license": "MIT",
"peer": true,
"dependencies": {
"@dnd-kit/accessibility": "^3.1.1",
"@dnd-kit/utilities": "^3.2.2",
@ -2820,7 +2818,6 @@
"integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"undici-types": "~7.16.0"
}
@ -2829,9 +2826,8 @@
"version": "19.2.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz",
"integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
"devOptional": true,
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
@ -2840,9 +2836,8 @@
"version": "19.2.3",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
"devOptional": true,
"dev": true,
"license": "MIT",
"peer": true,
"peerDependencies": {
"@types/react": "^19.2.0"
}
@ -2898,7 +2893,6 @@
"integrity": "sha512-6/cmF2piao+f6wSxUsJLZjck7OQsYyRtcOZS02k7XINSNlz93v6emM8WutDQSXnroG2xwYlEVHJI+cPA7CPM3Q==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@typescript-eslint/scope-manager": "8.50.0",
"@typescript-eslint/types": "8.50.0",
@ -3150,7 +3144,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true,
"license": "MIT",
"peer": true,
"bin": {
"acorn": "bin/acorn"
},
@ -3389,7 +3382,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759",
@ -3650,7 +3642,7 @@
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"devOptional": true,
"dev": true,
"license": "MIT"
},
"node_modules/custom-error-instance": {
@ -3987,7 +3979,6 @@
"integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1",
@ -5194,7 +5185,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true,
"license": "MIT",
"peer": true,
"engines": {
"node": ">=12"
},
@ -5248,7 +5238,6 @@
}
],
"license": "MIT",
"peer": true,
"dependencies": {
"nanoid": "^3.3.11",
"picocolors": "^1.1.1",
@ -5454,7 +5443,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
"license": "MIT",
"peer": true,
"engines": {
"node": ">=0.10.0"
}
@ -5464,7 +5452,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
"license": "MIT",
"peer": true,
"dependencies": {
"scheduler": "^0.27.0"
},
@ -5476,15 +5463,13 @@
"version": "19.2.5",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.5.tgz",
"integrity": "sha512-Dn0t8IQhCmeIT3wu+Apm1/YVsJXsGWi6k4sPdnBIdqMVtHtv0IGi6dcpNpNkNac0zB2uUAqNX3MHzN8c+z2rwQ==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/react-redux": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
"integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
"license": "MIT",
"peer": true,
"dependencies": {
"@types/use-sync-external-store": "^0.0.6",
"use-sync-external-store": "^1.4.0"
@ -5690,8 +5675,7 @@
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
"license": "MIT",
"peer": true
"license": "MIT"
},
"node_modules/redux-thunk": {
"version": "3.1.0",
@ -6174,7 +6158,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
@ -6352,7 +6335,6 @@
"integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==",
"dev": true,
"license": "MIT",
"peer": true,
"dependencies": {
"esbuild": "^0.27.0",
"fdir": "^6.5.0",
@ -6490,7 +6472,6 @@
"integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==",
"dev": true,
"license": "MIT",
"peer": true,
"funding": {
"url": "https://github.com/sponsors/colinhacks"
}

6
src/assets/logo-icon.svg Normal file
View File

@ -0,0 +1,6 @@
<svg width="40" height="40" viewBox="0 0 180 180" fill="none" xmlns="http://www.w3.org/2000/svg">
<g transform="translate(14, 4)">
<path d="M121.07 26.53L98.76 39.42L76.03 52.54L53.26 39.39L53.24 39.38L30.96 26.52L31.41 25.76L53.24 13.15L53.26 13.13L76.02 0L98.76 13.12L120.6 25.74L121.07 26.53Z" fill="white"/>
<path d="M53.26 172.41H98.76V110.9L121.51 97.78L137.93 88.29L152.02 80.15L129.27 40.75L98.76 58.36L92.43 62.02L76 71.49L59.6 62.03L53.26 58.37L53.24 58.36L22.75 40.75L0 80.16L14.09 88.3L30.5 97.78L53.24 110.9L53.26 110.91V137.18V172.41Z" fill="white"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 577 B

View File

@ -17,19 +17,22 @@ export function StatCard({
}) {
return (
<Card className="shadow-none">
<CardContent className="p-4">
<CardContent className="p-5">
<div className="flex items-start justify-between gap-3">
<div>
<div className="text-2xl font-semibold tracking-tight">{value}</div>
<div className="mt-1 text-xs font-medium text-grayScale-500">{label}</div>
</div>
<div className="grid h-10 w-10 place-items-center rounded-xl bg-brand-100 text-brand-600">
<div className="grid h-11 w-11 place-items-center rounded-xl bg-brand-100/60 text-brand-600">
<Icon className="h-5 w-5" />
</div>
</div>
<div className={cn("mt-3 text-xs font-medium", deltaPositive ? "text-mint-500" : "text-destructive")}>
{deltaLabel} <span className="text-grayScale-400">vs Last Month</span>
<div className="border-t border-grayScale-200 mt-4 pt-3">
<div className="text-xs font-medium">
<span className={cn(deltaPositive ? "text-mint-500" : "text-destructive")}>{deltaLabel}</span>
<span className="text-grayScale-400"> vs Last Month</span>
</div>
</div>
</CardContent>
</Card>

View File

@ -20,7 +20,7 @@ import {
import { type ComponentType, useEffect, useState } from "react";
import { NavLink } from "react-router-dom";
import { cn } from "../../lib/utils";
import { BrandLogo } from "../brand/BrandLogo";
import { SidebarLogo } from "./SidebarLogo";
import { getUnreadCount } from "../../api/notifications.api";
import { useTeamPermissions } from "../../hooks/useTeamPermissions";
import { hasFaqPermission } from "../../lib/faqPermissions";
@ -118,7 +118,13 @@ const navEntries: NavEntry[] = [
icon: CreditCard,
permission: "subscriptions.export",
},
{ kind: "link", label: "Activity log", to: "/user-log", icon: ClipboardList, permission: "activity_logs.list" },
{
kind: "link",
label: "Activity log",
to: "/user-log",
icon: ClipboardList,
permission: "activity_logs.list",
},
{ kind: "link", label: "Issue reports", to: "/issues", icon: CircleAlert },
{
kind: "link",
@ -153,7 +159,11 @@ export function Sidebar({
onToggleCollapse,
onClose,
}: SidebarProps) {
const { permissions, hasPermission, loading: permissionsLoading } = useTeamPermissions();
const {
permissions,
hasPermission,
loading: permissionsLoading,
} = useTeamPermissions();
const [unreadCount, setUnreadCount] = useState(0);
useEffect(() => {
@ -196,7 +206,8 @@ export function Sidebar({
<aside
className={cn(
"group fixed left-0 top-0 z-50 flex h-screen flex-col border-r bg-grayScale-50 py-5 transition-all duration-300",
"group fixed left-0 top-0 z-50 flex h-screen flex-col border-r border-grayScale-200 bg-white py-5 shadow-[inset_-1px_0_0_rgba(0,0,0,0.04)] transition-all duration-300",
"dark:bg-grayScale-50 dark:border-grayScale-200/20",
"w-[264px] px-4 lg:translate-x-0",
isCollapsed && "lg:w-[88px] lg:px-2",
isOpen ? "translate-x-0" : "-translate-x-full",
@ -205,49 +216,48 @@ export function Sidebar({
<div
className={cn(
"flex items-center justify-between px-2",
isCollapsed && "justify-center",
isCollapsed && "flex-col items-center gap-2",
)}
>
{isCollapsed ? (
<span className="h-10 w-10 overflow-hidden">
<BrandLogo className="h-10 w-auto max-w-none" />
</span>
) : (
<BrandLogo />
<SidebarLogo collapsed={isCollapsed} />
{isCollapsed && (
<button
type="button"
className="grid h-10 w-10 place-items-center rounded-md border border-grayScale-200 text-grayScale-400 transition-all hover:bg-grayScale-100 hover:text-brand-600 dark:border-grayScale-200/20 dark:hover:bg-white/5 dark:hover:text-brand-400"
onClick={onToggleCollapse}
aria-label="Expand sidebar"
>
<ChevronRight className="h-4 w-4" />
</button>
)}
{!isCollapsed && (
<button
type="button"
className="hidden h-10 w-10 rounded-md place-items-center border border-grayScale-200 text-grayScale-400 transition-all hover:bg-grayScale-100 hover:text-brand-600 lg:grid dark:border-grayScale-200/20 dark:hover:bg-white/5 dark:hover:text-brand-400"
onClick={onToggleCollapse}
aria-label="Collapse sidebar"
>
<ChevronLeft className="h-4 w-4" />
</button>
)}
<button
type="button"
className={cn(
"hidden h-8 w-8 place-items-center rounded-lg text-grayScale-500 transition-opacity hover:bg-grayScale-100 hover:text-brand-600 lg:grid lg:opacity-0 lg:pointer-events-none lg:group-hover:opacity-100 lg:group-hover:pointer-events-auto focus-visible:opacity-100 focus-visible:pointer-events-auto",
isCollapsed && "translate-x-2",
)}
onClick={onToggleCollapse}
aria-label={isCollapsed ? "Expand sidebar" : "Collapse sidebar"}
>
{isCollapsed ? (
<ChevronRight className="h-5 w-5" />
) : (
<ChevronLeft className="h-5 w-5" />
)}
</button>
<button
type="button"
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-500 hover:bg-grayScale-100 hover:text-brand-600 lg:hidden"
className="grid h-7 w-7 place-items-center rounded-lg text-grayScale-400 hover:bg-grayScale-100 hover:text-brand-600 lg:hidden dark:hover:bg-white/5 dark:hover:text-brand-400"
onClick={onClose}
aria-label="Close sidebar"
>
<X className="h-5 w-5" />
<X className="h-4 w-4" />
</button>
</div>
<nav className="mt-6 flex-1 space-y-0.5 overflow-y-auto">
<nav className="mt-6 flex-1 space-y-0.5 overflow-y-auto scrollbar-none">
{navEntries.map((entry, index) => {
if (entry.kind === "section") {
if (isCollapsed) {
return index > 0 ? (
<div
key={`section-gap-${entry.label}`}
className="mx-auto my-2 h-px w-6 bg-grayScale-200"
className="mx-auto my-2 h-px w-8 bg-grayScale-200 dark:bg-grayScale-200/20"
aria-hidden
/>
) : null;
@ -256,7 +266,7 @@ export function Sidebar({
<p
key={`section-${entry.label}`}
className={cn(
"mb-1 px-3 pt-3 text-[10px] font-bold uppercase tracking-wider text-grayScale-400",
"mb-1 px-3 pt-4 text-[11px] font-bold uppercase tracking-[0.08em] text-grayScale-400 dark:text-grayScale-400/70",
index === 0 && "pt-0",
)}
>
@ -346,11 +356,11 @@ export function Sidebar({
onClick={onClose}
className={({ isActive }) =>
cn(
"group flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium text-grayScale-600 transition",
isCollapsed && "justify-center px-2",
"hover:bg-grayScale-100 hover:text-brand-600",
"group flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-grayScale-600 transition",
isCollapsed && "justify-center gap-0 p-2",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isActive &&
"bg-brand-100/40 text-brand-600 shadow-[0_1px_0_rgba(0,0,0,0.02)] ring-1 ring-brand-100",
"bg-brand-500/50 text-brand-600 hover:bg-brand-500/50 hover:text-brand-600 dark:bg-brand-500/30 dark:text-brand-400 dark:hover:bg-brand-500/30 dark:hover:text-brand-400",
)
}
title={isCollapsed ? entry.label : undefined}
@ -359,8 +369,8 @@ export function Sidebar({
<>
<span
className={cn(
"grid h-8 w-8 place-items-center rounded-lg bg-grayScale-100 text-grayScale-500 transition group-hover:bg-brand-100 group-hover:text-brand-600",
isActive && "bg-brand-500/90 text-white",
"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-grayScale-50 text-grayScale-500 transition dark:bg-grayScale-200/10 dark:text-grayScale-400",
isActive && "bg-brand-500/20 text-brand-600 dark:bg-brand-500/20 dark:text-brand-400",
)}
>
<Icon className="h-4 w-4" />
@ -368,9 +378,6 @@ export function Sidebar({
{!isCollapsed && (
<span className="truncate">{entry.label}</span>
)}
{!isCollapsed && isActive ? (
<span className="ml-auto h-6 w-1 rounded-full bg-brand-500/80" />
) : null}
</>
)}
</NavLink>
@ -378,7 +385,12 @@ export function Sidebar({
})}
</nav>
<div className="px-2 pt-6">
<div
className={cn(
"border-t border-grayScale-200 px-2 pt-4 mt-4 dark:border-grayScale-200/20",
isCollapsed && "border-t-0 px-0 mt-0 pt-2",
)}
>
<button
type="button"
onClick={() => {
@ -386,12 +398,14 @@ export function Sidebar({
window.location.href = "/login";
}}
className={cn(
"flex w-full items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium text-grayScale-500 hover:bg-grayScale-100 hover:text-brand-600",
isCollapsed && "justify-center px-2",
"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-grayScale-500 transition hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isCollapsed && "justify-center gap-0 p-2",
)}
title={isCollapsed ? "Logout" : undefined}
>
<LogOut className="h-4 w-4" />
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-grayScale-50 text-grayScale-500 transition dark:bg-grayScale-200/10 dark:text-grayScale-400">
<LogOut className="h-4 w-4" />
</span>
{!isCollapsed && "Logout"}
</button>
</div>

View File

@ -0,0 +1,25 @@
import { BrandLogo } from "../brand/BrandLogo"
import logoSymbolSrc from "../../assets/logo-icon.svg"
import { useTheme } from "../../contexts/ThemeContext"
type SidebarLogoProps = {
collapsed: boolean
}
export function SidebarLogo({ collapsed }: SidebarLogoProps) {
const { resolvedTheme } = useTheme()
if (collapsed) {
return (
<span className="flex h-10 w-10 items-center justify-center rounded-full bg-brand-500">
<img
src={logoSymbolSrc}
alt="Yimaru"
className="h-6 w-6"
/>
</span>
)
}
return <BrandLogo variant={resolvedTheme === "dark" ? "light" : "dark"} />
}

View File

@ -39,6 +39,7 @@ export function SidebarNavGroup({
useEffect(() => {
if (isSectionActive) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setExpanded(true);
}
}, [isSectionActive]);
@ -50,10 +51,10 @@ export function SidebarNavGroup({
onClick={onNavigate}
className={({ isActive }) =>
cn(
"group flex items-center justify-center rounded-lg px-2 py-2.5 text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600",
"group flex items-center justify-center rounded-lg p-2 text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isActive &&
"bg-brand-100/40 text-brand-600 shadow-[0_1px_0_rgba(0,0,0,0.02)] ring-1 ring-brand-100",
"bg-brand-500/50 text-brand-600 hover:bg-brand-500/50 hover:text-brand-600 dark:bg-brand-500/30 dark:text-brand-400 dark:hover:bg-brand-500/30 dark:hover:text-brand-400",
)
}
title={label}
@ -61,8 +62,8 @@ export function SidebarNavGroup({
{({ isActive }) => (
<span
className={cn(
"relative grid h-8 w-8 place-items-center rounded-lg bg-grayScale-100 text-grayScale-500 transition group-hover:bg-brand-100 group-hover:text-brand-600",
isActive && "bg-brand-500/90 text-white",
"relative flex h-9 w-9 items-center justify-center rounded-lg bg-grayScale-50 text-grayScale-500 transition dark:bg-grayScale-200/10 dark:text-grayScale-400",
isActive && "bg-brand-500/20 text-brand-600 dark:bg-brand-500/20 dark:text-brand-400",
)}
>
<Icon className="h-4 w-4" />
@ -81,15 +82,15 @@ export function SidebarNavGroup({
aria-controls={panelId}
onClick={() => setExpanded((open) => !open)}
className={cn(
"group flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600",
isSectionActive && "text-brand-600",
"group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isSectionActive && "text-brand-600 dark:text-brand-400",
)}
>
<span
className={cn(
"grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-grayScale-100 text-grayScale-500 transition group-hover:bg-brand-100 group-hover:text-brand-600",
isSectionActive && "bg-brand-500/90 text-white",
"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-grayScale-50 text-grayScale-500 transition dark:bg-grayScale-200/10 dark:text-grayScale-400",
isSectionActive && "bg-brand-500/20 text-brand-600 dark:bg-brand-500/20 dark:text-brand-400",
)}
>
<Icon className="h-4 w-4" />
@ -98,7 +99,7 @@ export function SidebarNavGroup({
{trailing}
<ChevronDown
className={cn(
"h-4 w-4 shrink-0 text-grayScale-400 transition-transform duration-300 ease-in-out",
"h-4 w-4 shrink-0 text-grayScale-400 transition-transform duration-250 ease-[cubic-bezier(0.4,0,0.2,1)]",
expanded && "rotate-180",
)}
/>
@ -107,12 +108,12 @@ export function SidebarNavGroup({
<div
id={panelId}
className={cn(
"grid transition-[grid-template-rows] duration-300 ease-in-out",
"grid transition-[grid-template-rows] duration-250 ease-[cubic-bezier(0.4,0,0.2,1)]",
expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]",
)}
>
<div className="overflow-hidden">
<div className="ml-4 space-y-0.5 border-l border-grayScale-200 pl-2 pt-0.5 pb-0.5">
<div className="ml-3 space-y-0.5 border-l-2 border-grayScale-100 pl-3 pt-0.5 pb-0.5 dark:border-grayScale-200/20">
{children.map((child) => (
<NavLink
key={child.to}
@ -121,10 +122,10 @@ export function SidebarNavGroup({
onClick={onNavigate}
className={({ isActive }) =>
cn(
"block rounded-lg px-3 py-2 text-sm font-medium transition",
"block rounded-lg px-3 py-1.5 text-sm font-medium transition",
isActive
? "bg-brand-100/40 text-brand-600"
: "text-grayScale-500 hover:bg-grayScale-100 hover:text-brand-600",
? "bg-brand-500/50 text-brand-600 font-medium hover:bg-brand-500/50 hover:text-brand-600 dark:bg-brand-500/30 dark:text-brand-400 dark:hover:bg-brand-500/30 dark:hover:text-brand-400"
: "text-grayScale-500 hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
)
}
>

View File

@ -21,7 +21,7 @@ export function Stepper({ steps, currentStep, className }: StepperProps) {
{/* Connector Line - floats between circles with gap on both sides */}
{index < steps.length - 1 && (
<div
className="absolute top-4 h-[1.5px] bg-grayScale-200 z-0"
className="absolute top-4 h-[1.5px] bg-grayScale-200 dark:bg-grayScale-300 z-0"
style={{ left: "calc(50% + 50px)", right: "calc(-50% + 50px)" }}
/>
)}
@ -32,7 +32,7 @@ export function Stepper({ steps, currentStep, className }: StepperProps) {
"relative z-10 grid h-8 w-8 place-items-center rounded-full border-2 text-sm font-bold transition-all duration-300 mb-3",
isCurrent
? "border-brand-500 bg-brand-500 text-white shadow-md scale-110"
: "border-grayScale-100 bg-white text-grayScale-400 font-medium",
: "border-grayScale-100 dark:border-grayScale-300 bg-white dark:bg-grayScale-100 text-grayScale-400 dark:text-grayScale-500 font-medium",
)}
>
{stepNumber}
@ -42,7 +42,7 @@ export function Stepper({ steps, currentStep, className }: StepperProps) {
<span
className={cn(
"relative z-10 text-[12px] font-bold transition-colors duration-300",
isCurrent ? "text-brand-500" : "text-grayScale-400 font-medium",
isCurrent ? "text-brand-500" : "text-grayScale-400 dark:text-grayScale-500 font-medium",
)}
>
{step}

View File

@ -173,4 +173,12 @@
.admin-responsive-grid-3 {
@apply grid grid-cols-1 gap-4 sm:grid-cols-3;
}
.scrollbar-none {
-ms-overflow-style: none;
scrollbar-width: none;
}
.scrollbar-none::-webkit-scrollbar {
display: none;
}
}

View File

@ -335,7 +335,7 @@ export function CreateQuestionTypeFlow() {
if (isEdit && !definitionReady) {
return (
<div className="min-h-screen pb-20 flex items-center justify-center px-6">
<Card className="p-10 max-w-md w-full text-center border-grayScale-200">
<Card className="p-10 max-w-md w-full text-center border-grayScale-200 dark:bg-grayScale-50">
<p className="text-grayScale-600 font-medium">Loading definition…</p>
</Card>
</div>
@ -344,7 +344,7 @@ export function CreateQuestionTypeFlow() {
return (
<div className="min-h-screen pb-20 overflow-x-hidden">
<div className=" border-b border-grayScale-100 sticky top-0 z-50 bg-white/95 backdrop-blur">
<div className=" border-b border-grayScale-100 sticky top-0 z-50 bg-white/95 dark:bg-grayScale-50 backdrop-blur">
<div className="max-w-[1440px] mx-auto py-6 px-4 sm:px-6">
<div className="flex items-center justify-between mb-8">
<PageBackLink
@ -356,10 +356,10 @@ export function CreateQuestionTypeFlow() {
<div className="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6">
<div className="space-y-1">
<h1 className="text-[28px] font-bold text-grayScale-900 tracking-tight">
<h1 className="text-[28px] font-bold text-grayScale-900 dark:text-grayScale-600 tracking-tight">
{isEdit ? "Edit question type definition" : "Create question type definition"}
</h1>
<p className="text-grayScale-500 text-[14px] font-medium max-w-2xl">
<p className="text-grayScale-500 dark:text-grayScale-400 text-[14px] font-medium max-w-2xl">
{isEdit
? `Update reusable question type definition #${editDefinitionId}.`
: "Build a reusable question type template for dynamic practice and assessment questions."}
@ -368,7 +368,7 @@ export function CreateQuestionTypeFlow() {
<div className="flex items-center gap-4 shrink-0">
<Button
variant="outline"
className="h-10 px-8 rounded-[6px] border-grayScale-200 text-grayScale-900 font-medium hover:bg-grayScale-50"
className="h-10 px-8 rounded-[6px] border-grayScale-200 text-grayScale-900 dark:text-grayScale-600 font-medium hover:bg-grayScale-50 dark:hover:bg-grayScale-100"
onClick={() => navigate("/new-content/question-types")}
>
Cancel

View File

@ -1,4 +1,4 @@
import { notifyApiError } from "../../lib/apiErrors"
import { notifyApiError } from "../../lib/apiErrors";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Plus, ArrowRight, Pencil, Trash2, X } from "lucide-react";
import { Link } from "react-router-dom";
@ -31,7 +31,10 @@ import {
import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip";
import { ContentAccessTierChip } from "./components/ContentAccessTierChip";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types";
import type {
ContentAccessTier,
PracticePublishStatus,
} from "../../types/course.types";
import {
filterBySearchAndPublishStatus,
hasActiveContentFilters,
@ -43,7 +46,8 @@ import type { LearningProgramListItem } from "../../types/course.types";
/** Presigned MinIO/S3 URLs and our storage hosts — safe to send to POST /files/refresh-url. */
function looksLikeRefreshableFileUrl(url: string): boolean {
const trimmed = url.trim();
if (!trimmed.startsWith("http://") && !trimmed.startsWith("https://")) return false;
if (!trimmed.startsWith("http://") && !trimmed.startsWith("https://"))
return false;
try {
const u = new URL(trimmed);
const q = u.search.toLowerCase();
@ -78,7 +82,8 @@ export function LearnEnglishPage() {
const [createSortOrder, setCreateSortOrder] = useState("");
const [createThumbnail, setCreateThumbnail] = useState("");
const [createSaving, setCreateSaving] = useState(false);
const [createUploadingThumbnail, setCreateUploadingThumbnail] = useState(false);
const [createUploadingThumbnail, setCreateUploadingThumbnail] =
useState(false);
const createThumbnailFileInputRef = useRef<HTMLInputElement>(null);
const [deletingProgram, setDeletingProgram] =
@ -120,7 +125,8 @@ export function LearnEnglishPage() {
setEditSortOrder("");
setEditThumbnail("");
setUploadingEditThumbnail(false);
if (editThumbnailFileInputRef.current) editThumbnailFileInputRef.current.value = "";
if (editThumbnailFileInputRef.current)
editThumbnailFileInputRef.current.value = "";
};
const handleEditThumbnailFile = async (
@ -135,7 +141,9 @@ export function LearnEnglishPage() {
}
const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) {
toast.error("Image is too large", { description: "Maximum size is 5 MB." });
toast.error("Image is too large", {
description: "Maximum size is 5 MB.",
});
return;
}
setUploadingEditThumbnail(true);
@ -183,7 +191,9 @@ export function LearnEnglishPage() {
}
const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) {
toast.error("Image is too large", { description: "Maximum size is 5 MB." });
toast.error("Image is too large", {
description: "Maximum size is 5 MB.",
});
return;
}
setCreateUploadingThumbnail(true);
@ -291,7 +301,9 @@ export function LearnEnglishPage() {
),
);
toast.success(
nextStatus === "PUBLISHED" ? "Program published" : "Program saved as draft",
nextStatus === "PUBLISHED"
? "Program published"
: "Program saved as draft",
);
} catch (e: unknown) {
notifyApiError(e, "Failed to update program status");
@ -313,7 +325,9 @@ export function LearnEnglishPage() {
),
);
toast.success(
nextTier === "PREMIUM" ? "Program set to Premium" : "Program set to Free",
nextTier === "PREMIUM"
? "Program set to Premium"
: "Program set to Free",
);
} catch (e: unknown) {
notifyApiError(e, "Failed to update program access tier");
@ -394,7 +408,10 @@ export function LearnEnglishPage() {
return (
<div className="space-y-8">
<PageBackLink fallbackTo="/new-content" label="Back to Content Management" />
<PageBackLink
fallbackTo="/new-content"
label="Back to Content Management"
/>
{/* Header section */}
<div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div>
@ -402,7 +419,7 @@ export function LearnEnglishPage() {
Learn English
</h1>
<p className="mt-1 text-sm text-grayScale-500">
Manage learning content by program — cards load from the server
Manage learning content by program
</p>
</div>
@ -420,8 +437,8 @@ export function LearnEnglishPage() {
Add New Program
</DialogTitle>
<DialogDescription className="text-sm text-grayScale-400">
Create a new learning program. Add a thumbnail as an image URL or by uploading a
file.
Create a new learning program. Add a thumbnail as an image URL
or by uploading a file.
</DialogDescription>
</DialogHeader>
{/* Gradient Divider */}
@ -479,7 +496,10 @@ export function LearnEnglishPage() {
</div>
<div className="space-y-2">
<label htmlFor="create-program-sort-order" className="text-[15px] text-grayScale-700">
<label
htmlFor="create-program-sort-order"
className="text-[15px] text-grayScale-700"
>
Sort Order
</label>
<Input
@ -519,15 +539,13 @@ export function LearnEnglishPage() {
>
<div className="flex flex-col items-center justify-center">
<div className="mb-4">
<img
src={uploadIcon}
alt=""
className="h-10 w-10"
/>
<img src={uploadIcon} alt="" className="h-10 w-10" />
</div>
<p className="text-sm">
<span className="font-bold text-[#9E2891]">
{createUploadingThumbnail ? "Uploading…" : "Click to upload"}
{createUploadingThumbnail
? "Uploading…"
: "Click to upload"}
</span>{" "}
<span className="text-grayScale-500">
or paste a URL below
@ -644,92 +662,93 @@ export function LearnEnglishPage() {
) : null}
</div>
) : (
<div className="flex flex-wrap gap-10">
{filteredPrograms.map((program) => (
<Card
key={program.id}
className="group relative w-[290px] overflow-hidden border-none shadow-soft transition-all duration-300 hover:-translate-y-1 hover:shadow-lg"
>
<div
className="absolute right-2 top-2 z-10 flex translate-y-1 gap-1 opacity-0 pointer-events-none transition-all duration-300 ease-out group-hover:translate-y-0 group-hover:opacity-100 group-hover:pointer-events-auto"
>
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${program.name}`}
onClick={() => openEdit(program)}
<div className="flex flex-wrap gap-10">
{filteredPrograms.map((program) => (
<Card
key={program.id}
className="group relative w-[320px] overflow-hidden border-none shadow-soft transition-all duration-300 hover:-translate-y-1 hover:shadow-lg"
>
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${program.name}`}
onClick={() => setDeletingProgram(program)}
>
<Trash2 className="h-3.5 w-3.5" />
</Button>
</div>
<div
className="h-32 w-full bg-cover bg-center"
style={
program.thumbnail?.trim()
? {
backgroundImage: `url(${program.thumbnail.trim()})`,
}
: {
background:
"linear-gradient(135deg, #9E289180 0%, #9E2891 100%)",
}
}
/>
<CardContent className="bg-white p-6 flex flex-col h-[280px]">
<div className="flex-1 min-h-0">
<div className="mb-3 flex flex-wrap gap-2">
<ContentPublishStatusChip
publishStatus={program.publish_status}
updating={publishStatusUpdatingId === program.id}
contentLabel="program"
onToggle={(nextStatus) =>
void handleProgramPublishStatus(program.id, nextStatus)
}
/>
<ContentAccessTierChip
accessTier={program.access_tier}
updating={accessTierUpdatingId === program.id}
contentLabel="program"
onToggle={(nextTier) =>
void handleProgramAccessTier(program.id, nextTier)
}
/>
<div className="absolute right-2 top-2 z-10 flex translate-y-1 gap-1 opacity-0 pointer-events-none transition-all duration-300 ease-out group-hover:translate-y-0 group-hover:opacity-100 group-hover:pointer-events-auto">
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${program.name}`}
onClick={() => openEdit(program)}
>
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${program.name}`}
onClick={() => setDeletingProgram(program)}
>
<Trash2 className="h-3.5 w-3.5" />
</Button>
</div>
<h3 className="text-xl font-bold text-grayScale-700 line-clamp-2">
{program.name}
</h3>
<p className="mt-2 text-sm leading-relaxed text-grayScale-500 line-clamp-4">
{program.description?.trim()
? program.description
: "—"}
</p>
</div>
<Link
to={`/new-content/learn-english/${program.id}/courses`}
className="mt-4 block"
onClick={(e) => e.stopPropagation()}
>
<Button className="h-11 w-full rounded-[6px] bg-brand-500 font-semibold hover:bg-brand-600">
View Courses
<ArrowRight className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1" />
</Button>
</Link>
</CardContent>
</Card>
))}
</div>
<div
className="h-32 w-full bg-cover bg-center"
style={
program.thumbnail?.trim()
? {
backgroundImage: `url(${program.thumbnail.trim()})`,
}
: {
background:
"linear-gradient(135deg, #9E289180 0%, #9E2891 100%)",
}
}
/>
<CardContent className="bg-white p-6 flex flex-col h-[280px]">
<div className="flex-1 min-h-0">
<div className="mb-3 flex flex-wrap gap-2">
<ContentPublishStatusChip
publishStatus={program.publish_status}
updating={publishStatusUpdatingId === program.id}
contentLabel="program"
onToggle={(nextStatus) =>
void handleProgramPublishStatus(
program.id,
nextStatus,
)
}
/>
<ContentAccessTierChip
accessTier={program.access_tier}
updating={accessTierUpdatingId === program.id}
contentLabel="program"
onToggle={(nextTier) =>
void handleProgramAccessTier(program.id, nextTier)
}
/>
</div>
<h3 className="text-xl font-bold text-grayScale-700 line-clamp-2">
{program.name}
</h3>
<p className="mt-2 text-sm leading-relaxed text-grayScale-500 line-clamp-4">
{program.description?.trim()
? program.description
: "—"}
</p>
</div>
<Link
to={`/new-content/learn-english/${program.id}/courses`}
className="mt-4 block"
onClick={(e) => e.stopPropagation()}
>
<Button className="h-11 w-full rounded-[6px] bg-brand-500 font-semibold hover:bg-brand-600">
View Courses
<ArrowRight className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1" />
</Button>
</Link>
</CardContent>
</Card>
))}
</div>
)}
</div>
)}
@ -745,103 +764,108 @@ export function LearnEnglishPage() {
<DialogHeader className="shrink-0 space-y-1.5 border-b border-grayScale-100 px-6 pb-4 pt-6 pr-12">
<DialogTitle>Edit program</DialogTitle>
<DialogDescription>
Update name, description, sort order, and thumbnail. Upload an image
from your computer (via file storage) or paste a URL. Changes are
saved to the server.
Update name, description, sort order, and thumbnail. Upload an
image from your computer (via file storage) or paste a URL.
Changes are saved to the server.
</DialogDescription>
</DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-4">
<div className="grid gap-4">
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Name
</label>
<Input
value={editName}
onChange={(e) => setEditName(e.target.value)}
className="rounded-xl"
placeholder="Program name"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Description
</label>
<Textarea
value={editDescription}
onChange={(e) => setEditDescription(e.target.value)}
rows={4}
className="rounded-xl resize-y min-h-[100px]"
placeholder="Short summary of the program"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<div className="space-y-2">
<label htmlFor="edit-program-sort-order" className="text-sm font-medium text-grayScale-700">
Sort Order
</label>
<Input
id="edit-program-sort-order"
type="number"
min={0}
step={1}
inputMode="numeric"
value={editSortOrder}
onChange={(e) => setEditSortOrder(e.target.value)}
className="rounded-xl"
placeholder="e.g. 5"
disabled={savingEdit || uploadingEditThumbnail}
/>
<p className="text-xs text-grayScale-500">
Lower numbers appear first when programs are listed.
</p>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Thumbnail
</label>
<input
ref={editThumbnailFileInputRef}
type="file"
accept="image/*"
className="sr-only"
onChange={(e) => void handleEditThumbnailFile(e)}
disabled={savingEdit || uploadingEditThumbnail}
/>
<div className="flex flex-col gap-3 sm:flex-row sm:items-start">
<Button
type="button"
variant="outline"
className="h-11 shrink-0 rounded-xl border-grayScale-200 font-semibold"
<div className="grid gap-4">
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Name
</label>
<Input
value={editName}
onChange={(e) => setEditName(e.target.value)}
className="rounded-xl"
placeholder="Program name"
disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()}
>
{uploadingEditThumbnail ? "Uploading…" : "Upload from computer"}
</Button>
{editThumbnail.trim() ? (
<div className="flex-1 overflow-hidden rounded-xl border border-grayScale-200 bg-grayScale-50">
<img
src={editThumbnail.trim()}
alt=""
className="h-24 w-full object-cover"
/>
</div>
) : null}
/>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Description
</label>
<Textarea
value={editDescription}
onChange={(e) => setEditDescription(e.target.value)}
rows={4}
className="rounded-xl resize-y min-h-[100px]"
placeholder="Short summary of the program"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<div className="space-y-2">
<label
htmlFor="edit-program-sort-order"
className="text-sm font-medium text-grayScale-700"
>
Sort Order
</label>
<Input
id="edit-program-sort-order"
type="number"
min={0}
step={1}
inputMode="numeric"
value={editSortOrder}
onChange={(e) => setEditSortOrder(e.target.value)}
className="rounded-xl"
placeholder="e.g. 5"
disabled={savingEdit || uploadingEditThumbnail}
/>
<p className="text-xs text-grayScale-500">
Lower numbers appear first when programs are listed.
</p>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Thumbnail
</label>
<input
ref={editThumbnailFileInputRef}
type="file"
accept="image/*"
className="sr-only"
onChange={(e) => void handleEditThumbnailFile(e)}
disabled={savingEdit || uploadingEditThumbnail}
/>
<div className="flex flex-col gap-3 sm:flex-row sm:items-start">
<Button
type="button"
variant="outline"
className="h-11 shrink-0 rounded-xl border-grayScale-200 font-semibold"
disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()}
>
{uploadingEditThumbnail
? "Uploading…"
: "Upload from computer"}
</Button>
{editThumbnail.trim() ? (
<div className="flex-1 overflow-hidden rounded-xl border border-grayScale-200 bg-grayScale-50">
<img
src={editThumbnail.trim()}
alt=""
className="h-24 w-full object-cover"
/>
</div>
) : null}
</div>
<Input
value={editThumbnail}
onChange={(e) => setEditThumbnail(e.target.value)}
className="rounded-xl"
placeholder="Or paste image URL (https://…)"
disabled={savingEdit || uploadingEditThumbnail}
/>
<p className="text-xs text-grayScale-500">
Uploaded images are stored and used as the program thumbnail.
</p>
</div>
<Input
value={editThumbnail}
onChange={(e) => setEditThumbnail(e.target.value)}
className="rounded-xl"
placeholder="Or paste image URL (https://…)"
disabled={savingEdit || uploadingEditThumbnail}
/>
<p className="text-xs text-grayScale-500">
Uploaded images are stored and used as the program thumbnail.
</p>
</div>
</div>
</div>
<DialogFooter className="shrink-0 gap-2 border-t border-grayScale-100 bg-white px-6 py-4 sm:gap-0">
<Button
type="button"
@ -867,7 +891,9 @@ export function LearnEnglishPage() {
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm">
<div className="mx-4 w-full max-w-sm animate-in fade-in zoom-in-95 rounded-2xl bg-white shadow-2xl">
<div className="flex items-center justify-between border-b border-grayScale-100 px-4 py-4 sm:px-6">
<h2 className="text-lg font-bold text-grayScale-700">Delete program</h2>
<h2 className="text-lg font-bold text-grayScale-700">
Delete program
</h2>
<button
type="button"
onClick={() => !deleting && setDeletingProgram(null)}
@ -884,8 +910,11 @@ export function LearnEnglishPage() {
</div>
<p className="text-center text-sm leading-relaxed text-grayScale-600">
Are you sure you want to delete{" "}
<span className="font-semibold text-grayScale-700">{deletingProgram.name}</span>? This action cannot be
undone. Courses under this program may be affected depending on your backend.
<span className="font-semibold text-grayScale-700">
{deletingProgram.name}
</span>
? This action cannot be undone. Courses under this program may
be affected depending on your backend.
</p>
</div>

View File

@ -1,4 +1,4 @@
import { notifyApiError } from "../../lib/apiErrors"
import { notifyApiError } from "../../lib/apiErrors";
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Plus, Pencil, Trash2, X } from "lucide-react";
import { Link, useNavigate, useParams } from "react-router-dom";
@ -58,14 +58,12 @@ export function ProgramCoursesPage() {
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
const [deletingCourse, setDeletingCourse] = useState<ProgramCourseListItem | null>(
null,
);
const [deletingCourse, setDeletingCourse] =
useState<ProgramCourseListItem | null>(null);
const [deleting, setDeleting] = useState(false);
const [editingCourse, setEditingCourse] = useState<ProgramCourseListItem | null>(
null,
);
const [editingCourse, setEditingCourse] =
useState<ProgramCourseListItem | null>(null);
const [editName, setEditName] = useState("");
const [editDescription, setEditDescription] = useState("");
const [editSortOrder, setEditSortOrder] = useState("");
@ -80,7 +78,8 @@ export function ProgramCoursesPage() {
const [createSortOrder, setCreateSortOrder] = useState("");
const [createThumbnail, setCreateThumbnail] = useState("");
const [createSaving, setCreateSaving] = useState(false);
const [createUploadingThumbnail, setCreateUploadingThumbnail] = useState(false);
const [createUploadingThumbnail, setCreateUploadingThumbnail] =
useState(false);
const createThumbnailFileInputRef = useRef<HTMLInputElement>(null);
const [publishStatusUpdatingId, setPublishStatusUpdatingId] = useState<
number | null
@ -120,7 +119,9 @@ export function ProgramCoursesPage() {
),
);
toast.success(
nextStatus === "PUBLISHED" ? "Course published" : "Course saved as draft",
nextStatus === "PUBLISHED"
? "Course published"
: "Course saved as draft",
);
} catch (e: unknown) {
notifyApiError(e, "Failed to update course status");
@ -243,7 +244,9 @@ export function ProgramCoursesPage() {
}
const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) {
toast.error("Image is too large", { description: "Maximum size is 5 MB." });
toast.error("Image is too large", {
description: "Maximum size is 5 MB.",
});
return;
}
setUploadingEditThumbnail(true);
@ -328,7 +331,9 @@ export function ProgramCoursesPage() {
}
const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) {
toast.error("Image is too large", { description: "Maximum size is 5 MB." });
toast.error("Image is too large", {
description: "Maximum size is 5 MB.",
});
return;
}
setCreateUploadingThumbnail(true);
@ -397,7 +402,11 @@ export function ProgramCoursesPage() {
return (
<div className="space-y-8 pt-10">
{/* Navigation */}
<PageBackLink fallbackTo="/new-content/learn-english" label="Back to Programs" className="text-sm text-grayScale-500" />
<PageBackLink
fallbackTo="/new-content/learn-english"
label="Back to Programs"
className="text-sm text-grayScale-500"
/>
{/* Header section */}
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
@ -411,11 +420,7 @@ export function ProgramCoursesPage() {
</ContentPageDescription>
) : loading ? (
<div className="flex items-center gap-2 pt-1">
<img
src={spinnerSrc}
alt=""
className="h-6 w-6 animate-spin"
/>
<img src={spinnerSrc} alt="" className="h-6 w-6 animate-spin" />
</div>
) : null}
</div>
@ -443,8 +448,8 @@ export function ProgramCoursesPage() {
Add New Course
</DialogTitle>
<DialogDescription className="text-sm text-grayScale-400">
Add a new course to this program. Use an image URL or upload a file for the
thumbnail.
Add a new course to this program. Use an image URL or
upload a file for the thumbnail.
</DialogDescription>
</DialogHeader>
@ -535,7 +540,9 @@ export function ProgramCoursesPage() {
type="file"
accept="image/*"
className="sr-only"
onChange={(e) => void handleCreateCourseThumbnailFile(e)}
onChange={(e) =>
void handleCreateCourseThumbnailFile(e)
}
disabled={createSaving || createUploadingThumbnail}
/>
<button
@ -594,7 +601,9 @@ export function ProgramCoursesPage() {
variant="outline"
className="h-12 min-w-[120px] rounded-xl border-grayScale-200 font-semibold"
disabled={createSaving || createUploadingThumbnail}
onClick={() => handleCreateCourseDialogOpenChange(false)}
onClick={() =>
handleCreateCourseDialogOpenChange(false)
}
>
Cancel
</Button>
@ -673,133 +682,136 @@ export function ProgramCoursesPage() {
</p>
</div>
) : (
<div className="flex flex-wrap gap-10">
{filteredCourses.map((course) => {
const modules =
course.module_count ?? course.modules_count ?? 0;
const lessons = course.lesson_count ?? course.videos_count ?? 0;
const practices =
course.practice_count ?? course.practices_count ?? 0;
const thumbnailSrc =
course.thumbnail?.trim() || course.thumbnail_url?.trim() || "";
return (
<Card
key={course.id}
className="group relative w-[290px] overflow-hidden border border-grayScale-100 shadow-soft transition-all duration-300 hover:shadow-lg"
>
<div
className="absolute right-2 top-2 z-10 flex translate-y-1 gap-1 opacity-0 pointer-events-none transition-all duration-300 ease-out group-hover:translate-y-0 group-hover:opacity-100 group-hover:pointer-events-auto"
>
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${course.name}`}
onClick={() => openEditCourse(course)}
<div className="flex flex-wrap gap-10">
{filteredCourses.map((course) => {
const modules =
course.module_count ?? course.modules_count ?? 0;
const lessons = course.lesson_count ?? course.videos_count ?? 0;
const practices =
course.practice_count ?? course.practices_count ?? 0;
const thumbnailSrc =
course.thumbnail?.trim() ||
course.thumbnail_url?.trim() ||
"";
return (
<Card
key={course.id}
className="group relative w-[350px] overflow-hidden border border-grayScale-100 shadow-soft transition-all duration-300 hover:shadow-lg"
>
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${course.name}`}
onClick={() => setDeletingCourse(course)}
>
<Trash2 className="h-3.5 w-3.5" />
</Button>
</div>
<div
className="h-32 w-full bg-cover bg-center"
style={
thumbnailSrc
? {
backgroundImage: `url(${thumbnailSrc})`,
}
: {
background:
"linear-gradient(135deg, #9E289180 0%, #9E2891 100%)",
}
}
/>
<CardContent className="p-6">
<div className="mb-3 flex flex-wrap gap-2">
<ContentPublishStatusChip
publishStatus={course.publish_status}
updating={publishStatusUpdatingId === course.id}
contentLabel="course"
onToggle={(nextStatus) =>
void handleCoursePublishStatus(course.id, nextStatus)
<div className="absolute right-2 top-2 z-10 flex translate-y-1 gap-1 opacity-0 pointer-events-none transition-all duration-300 ease-out group-hover:translate-y-0 group-hover:opacity-100 group-hover:pointer-events-auto">
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${course.name}`}
onClick={() => openEditCourse(course)}
>
<Pencil className="h-3.5 w-3.5" />
</Button>
<Button
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${course.name}`}
onClick={() => setDeletingCourse(course)}
>
<Trash2 className="h-3.5 w-3.5" />
</Button>
</div>
<div
className="h-32 w-full bg-cover bg-center"
style={
thumbnailSrc
? {
backgroundImage: `url(${thumbnailSrc})`,
}
: {
background:
"linear-gradient(135deg, #9E289180 0%, #9E2891 100%)",
}
}
/>
<ContentAccessTierChip
accessTier={course.access_tier}
updating={accessTierUpdatingId === course.id}
contentLabel="course"
onToggle={(nextTier) =>
void handleCourseAccessTier(course.id, nextTier)
}
/>
</div>
<h3 className="text-xl font-bold text-grayScale-700">
{course.name}
</h3>
<p className="mt-2 text-[13px] leading-relaxed text-grayScale-500 line-clamp-2">
{course.description?.trim() ? course.description : "—"}
</p>
<CardContent className="p-6">
<div className="mb-3 flex flex-wrap gap-2">
<ContentPublishStatusChip
publishStatus={course.publish_status}
updating={publishStatusUpdatingId === course.id}
contentLabel="course"
onToggle={(nextStatus) =>
void handleCoursePublishStatus(
course.id,
nextStatus,
)
}
/>
<ContentAccessTierChip
accessTier={course.access_tier}
updating={accessTierUpdatingId === course.id}
contentLabel="course"
onToggle={(nextTier) =>
void handleCourseAccessTier(course.id, nextTier)
}
/>
</div>
<h3 className="text-xl font-bold text-grayScale-700">
{course.name}
</h3>
<p className="mt-2 text-[13px] leading-relaxed text-grayScale-500 line-clamp-2">
{course.description?.trim() ? course.description : "—"}
</p>
<div className="my-6 grid grid-cols-3 gap-4 border-y border-grayScale-50 py-4">
<div className="text-center">
<p className="text-base font-bold text-grayScale-700">
{modules}
</p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Modules
</p>
</div>
<div className="text-center">
<p className="text-base font-bold text-grayScale-700">
{lessons}
</p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Lessons
</p>
</div>
<div className="text-center">
<p className="text-base font-bold text-grayScale-700">
{practices}
</p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Practices
</p>
</div>
</div>
<div className="my-6 grid grid-cols-3 gap-4 border-y border-grayScale-50 py-4">
<div className="text-center">
<p className="text-base font-bold text-grayScale-700">
{modules}
</p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Modules
</p>
</div>
<div className="text-center">
<p className="text-base font-bold text-grayScale-700">
{lessons}
</p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Lessons
</p>
</div>
<div className="text-center">
<p className="text-base font-bold text-grayScale-700">
{practices}
</p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Practices
</p>
</div>
</div>
<div className="flex gap-3">
<Button
variant="outline"
className="h-10 flex-1 rounded-[6px] border-brand-500 text-[13px] font-semibold text-brand-500 "
onClick={() =>
navigate(
`/new-content/learn-english/${programIdParam}/courses/${course.id}`,
)
}
>
View Detail
</Button>
<PublishPracticeButton
parentKind="COURSE"
parentId={course.id}
className="h-10 flex-1 rounded-[6px] bg-brand-500 text-[13px] font-semibold hover:bg-brand-600 disabled:opacity-60"
/>
</div>
</CardContent>
</Card>
);
})}
</div>
<div className="flex gap-3">
<Button
variant="outline"
className="h-10 flex-1 rounded-[6px] border-brand-500 text-[13px] font-semibold text-brand-500 "
onClick={() =>
navigate(
`/new-content/learn-english/${programIdParam}/courses/${course.id}`,
)
}
>
View Detail
</Button>
<PublishPracticeButton
parentKind="COURSE"
parentId={course.id}
className="h-10 flex-1 rounded-[6px] bg-brand-500 text-[13px] font-semibold hover:bg-brand-600 disabled:opacity-60"
/>
</div>
</CardContent>
</Card>
);
})}
</div>
)}
</div>
)}
@ -819,97 +831,99 @@ export function ProgramCoursesPage() {
</DialogDescription>
</DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-4">
<div className="grid gap-4">
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Name
</label>
<Input
value={editName}
onChange={(e) => setEditName(e.target.value)}
className="rounded-xl"
placeholder="Course name"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Description
</label>
<Textarea
value={editDescription}
onChange={(e) => setEditDescription(e.target.value)}
rows={4}
className="min-h-[100px] resize-y rounded-xl"
placeholder="Short summary of the course"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<div className="space-y-2">
<label
htmlFor="edit-course-sort-order"
className="text-sm font-medium text-grayScale-700"
>
Sort Order
</label>
<Input
id="edit-course-sort-order"
type="number"
min={0}
step={1}
inputMode="numeric"
value={editSortOrder}
onChange={(e) => setEditSortOrder(e.target.value)}
className="rounded-xl"
placeholder="e.g. 5"
disabled={savingEdit || uploadingEditThumbnail}
/>
<p className="text-xs text-grayScale-500">
Lower numbers appear first when courses are listed.
</p>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Thumbnail
</label>
<input
ref={editThumbnailFileInputRef}
type="file"
accept="image/*"
className="sr-only"
onChange={(e) => void handleEditCourseThumbnailFile(e)}
disabled={savingEdit || uploadingEditThumbnail}
/>
<div className="flex flex-col gap-3 sm:flex-row sm:items-start">
<Button
type="button"
variant="outline"
className="h-11 shrink-0 rounded-xl border-grayScale-200 font-semibold"
<div className="grid gap-4">
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Name
</label>
<Input
value={editName}
onChange={(e) => setEditName(e.target.value)}
className="rounded-xl"
placeholder="Course name"
disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()}
>
{uploadingEditThumbnail ? "Uploading…" : "Upload from computer"}
</Button>
{editThumbnail.trim() ? (
<div className="flex-1 overflow-hidden rounded-xl border border-grayScale-200 bg-grayScale-50">
<img
src={editThumbnail.trim()}
alt=""
className="h-24 w-full object-cover"
/>
</div>
) : null}
/>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Description
</label>
<Textarea
value={editDescription}
onChange={(e) => setEditDescription(e.target.value)}
rows={4}
className="min-h-[100px] resize-y rounded-xl"
placeholder="Short summary of the course"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<div className="space-y-2">
<label
htmlFor="edit-course-sort-order"
className="text-sm font-medium text-grayScale-700"
>
Sort Order
</label>
<Input
id="edit-course-sort-order"
type="number"
min={0}
step={1}
inputMode="numeric"
value={editSortOrder}
onChange={(e) => setEditSortOrder(e.target.value)}
className="rounded-xl"
placeholder="e.g. 5"
disabled={savingEdit || uploadingEditThumbnail}
/>
<p className="text-xs text-grayScale-500">
Lower numbers appear first when courses are listed.
</p>
</div>
<div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700">
Thumbnail
</label>
<input
ref={editThumbnailFileInputRef}
type="file"
accept="image/*"
className="sr-only"
onChange={(e) => void handleEditCourseThumbnailFile(e)}
disabled={savingEdit || uploadingEditThumbnail}
/>
<div className="flex flex-col gap-3 sm:flex-row sm:items-start">
<Button
type="button"
variant="outline"
className="h-11 shrink-0 rounded-xl border-grayScale-200 font-semibold"
disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()}
>
{uploadingEditThumbnail
? "Uploading…"
: "Upload from computer"}
</Button>
{editThumbnail.trim() ? (
<div className="flex-1 overflow-hidden rounded-xl border border-grayScale-200 bg-grayScale-50">
<img
src={editThumbnail.trim()}
alt=""
className="h-24 w-full object-cover"
/>
</div>
) : null}
</div>
<Input
value={editThumbnail}
onChange={(e) => setEditThumbnail(e.target.value)}
className="rounded-xl"
placeholder="Or paste image URL (https://…)"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
<Input
value={editThumbnail}
onChange={(e) => setEditThumbnail(e.target.value)}
className="rounded-xl"
placeholder="Or paste image URL (https://…)"
disabled={savingEdit || uploadingEditThumbnail}
/>
</div>
</div>
</div>
<DialogFooter className="shrink-0 gap-2 border-t border-grayScale-100 bg-white px-6 py-4 sm:gap-0">
<Button
type="button"
@ -935,7 +949,9 @@ export function ProgramCoursesPage() {
<div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm">
<div className="mx-4 w-full max-w-sm animate-in fade-in zoom-in-95 rounded-2xl bg-white shadow-2xl">
<div className="flex items-center justify-between border-b border-grayScale-100 px-4 py-4 sm:px-6">
<h2 className="text-lg font-bold text-grayScale-700">Delete course</h2>
<h2 className="text-lg font-bold text-grayScale-700">
Delete course
</h2>
<button
type="button"
onClick={() => !deleting && setDeletingCourse(null)}

View File

@ -113,7 +113,7 @@ function SortableItem({
ref={setNodeRef}
style={style}
className={cn(
"flex items-center justify-between px-4 py-3 border border-grayScale-200 rounded-[6px] mb-2 bg-white transition-all duration-200 group/item",
"flex items-center justify-between px-4 py-3 border border-grayScale-200 rounded-[6px] mb-2 bg-white dark:bg-grayScale-50 transition-all duration-200 group/item",
isDragging && "opacity-50 border-dashed z-50 shadow-sm",
!isDragging && "hover:border-brand-200 hover:shadow-sm",
)}
@ -232,7 +232,7 @@ function DraggableList({
</SortableContext>
<DragOverlay>
{activeItem ? (
<div className="flex items-center justify-between px-4 py-3 bg-white border border-brand-300 shadow-lg rounded-[6px] opacity-90 cursor-grabbing">
<div className="flex items-center justify-between px-4 py-3 bg-white dark:bg-grayScale-50 border border-brand-300 shadow-lg rounded-[6px] opacity-90 cursor-grabbing">
<div className="flex items-center gap-4">
<div className="p-1 ">
<GripVertical className="h-4 w-4" />
@ -277,7 +277,7 @@ function HierarchySection({
children,
}: SectionProps) {
return (
<div className="border border-grayScale-100 rounded-xl mb-3 overflow-hidden transition-all duration-300 bg-white">
<div className="border border-grayScale-100 rounded-xl mb-3 overflow-hidden transition-all duration-300 bg-white dark:bg-grayScale-50">
<button
onClick={onToggle}
className={cn(

View File

@ -15,17 +15,17 @@ export function ComponentKindCard({ label, Icon, selected, onClick }: ComponentK
type="button"
onClick={onClick}
className={cn(
"flex flex-col items-start justify-between p-4 min-h-[132px] rounded-[16px] border text-left transition-all group relative",
"w-full flex flex-col items-start justify-between p-4 min-h-[132px] rounded-[16px] border text-left transition-all group relative",
selected
? "border-[#9E2891] bg-white shadow-[0_4px_12px_rgba(158,40,145,0.08)] ring-1 ring-[#9E2891]"
: "border-grayScale-200 bg-white hover:border-grayScale-300 hover:bg-grayScale-50/80",
? "border-[#9E2891] bg-white dark:bg-grayScale-100 shadow-[0_4px_12px_rgba(158,40,145,0.08)] ring-1 ring-[#9E2891]"
: "border-grayScale-200 bg-white dark:bg-grayScale-50 hover:border-grayScale-300 hover:bg-grayScale-50/80 dark:hover:bg-grayScale-100/80",
)}
>
<div className="w-full flex items-start justify-between gap-2">
<div
className={cn(
"h-12 w-12 rounded-xl flex items-center justify-center shrink-0 transition-colors",
selected ? "bg-[#9E2891] text-white" : "bg-[#F1F5F9] text-grayScale-600 group-hover:bg-grayScale-100",
selected ? "bg-[#9E2891] text-white" : "bg-[#F1F5F9] dark:bg-grayScale-200 text-grayScale-600 group-hover:bg-grayScale-100 dark:group-hover:bg-grayScale-200/80",
)}
>
<Icon className="h-6 w-6" />
@ -33,7 +33,7 @@ export function ComponentKindCard({ label, Icon, selected, onClick }: ComponentK
<div
className={cn(
"h-6 w-6 rounded-full border-2 flex items-center justify-center shrink-0 transition-all",
selected ? "border-[#9E2891] bg-white" : "border-grayScale-300 bg-white",
selected ? "border-[#9E2891] bg-white dark:bg-grayScale-50" : "border-grayScale-300 bg-white dark:bg-grayScale-50",
)}
>
{selected ? <Check className="h-3.5 w-3.5 text-[#9E2891] stroke-[3]" /> : null}

View File

@ -27,10 +27,10 @@ export function QuestionTypeBasicInfoStep({
}: QuestionTypeBasicInfoStepProps) {
return (
<div className="space-y-8 pb-32">
<Card className="max-w-4xl mx-auto overflow-hidden border-grayScale-100 shadow-sm rounded-2xl bg-white">
<Card className="max-w-4xl mx-auto overflow-hidden border-grayScale-100 shadow-sm rounded-2xl bg-white dark:bg-grayScale-50">
<div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 1: Definition basics</h2>
<p className="text-grayScale-500 font-medium mt-1">
<h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 1: Definition basics</h2>
<p className="text-grayScale-500 dark:text-grayScale-400 font-medium mt-1">
Set the reusable key, display name, and status. On the next step you will choose how questions are
presented and how learners answer.
</p>
@ -39,11 +39,11 @@ export function QuestionTypeBasicInfoStep({
<div className="p-10 space-y-8">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2">
<label className="text-[14px] font-medium text-grayScale-700 flex items-center gap-1">
<label className="text-[14px] font-medium text-grayScale-700 dark:text-grayScale-500 flex items-center gap-1">
Key <span className="text-red-500">*</span>
</label>
<Input
className="h-12 rounded-[12px] border-grayScale-300 bg-[#F8FAFC] disabled:opacity-70"
className="h-12 rounded-[12px] border-grayScale-300 bg-[#F8FAFC] dark:bg-grayScale-100 disabled:opacity-70"
placeholder="e.g. dynamic_visual_mcq_001"
value={draft.key}
onChange={(e) => setDraft((d) => ({ ...d, key: e.target.value }))}
@ -59,11 +59,11 @@ export function QuestionTypeBasicInfoStep({
</div>
<div className="space-y-2">
<label className="text-[14px] font-medium text-grayScale-700 flex items-center gap-1">
<label className="text-[14px] font-medium text-grayScale-700 dark:text-grayScale-500 flex items-center gap-1">
Display name <span className="text-red-500">*</span>
</label>
<Input
className="h-12 rounded-[12px] border-grayScale-300 bg-[#F8FAFC]"
className="h-12 rounded-[12px] border-grayScale-300 bg-[#F8FAFC] dark:bg-grayScale-100"
placeholder="e.g. Speak About the Photo"
value={draft.display_name}
onChange={(e) => setDraft((d) => ({ ...d, display_name: e.target.value }))}
@ -73,9 +73,9 @@ export function QuestionTypeBasicInfoStep({
</div>
<div className="space-y-2">
<label className="text-[14px] font-medium text-grayScale-700">Description</label>
<label className="text-[14px] font-medium text-grayScale-700 dark:text-grayScale-500">Description</label>
<Textarea
className="min-h-[100px] rounded-[12px] border-grayScale-300 bg-[#F8FAFC]"
className="min-h-[100px] rounded-[12px] border-grayScale-300 bg-[#F8FAFC] dark:bg-grayScale-100"
placeholder="Optional description for admins"
value={draft.description ?? ""}
onChange={(e) => setDraft((d) => ({ ...d, description: e.target.value }))}
@ -83,7 +83,7 @@ export function QuestionTypeBasicInfoStep({
</div>
<div className="space-y-2 max-w-md">
<label className="text-[14px] font-medium text-grayScale-700">Groups</label>
<label className="text-[14px] font-medium text-grayScale-700 dark:text-grayScale-500">Groups</label>
<QuestionTypeGroupsMultiSelect
value={draft.group_ids ?? null}
onChange={(groupIds) => setDraft((d) => ({ ...d, group_ids: groupIds }))}
@ -94,11 +94,11 @@ export function QuestionTypeBasicInfoStep({
</div>
<div className="space-y-2 max-w-xs">
<label className="text-[14px] font-medium text-grayScale-700 flex items-center gap-1">
<label className="text-[14px] font-medium text-grayScale-700 dark:text-grayScale-500 flex items-center gap-1">
Status <span className="text-red-500">*</span>
</label>
<Select
className="h-12 rounded-[12px] border-grayScale-300 bg-[#F8FAFC]"
className="h-12 rounded-[12px] border-grayScale-300 bg-[#F8FAFC] dark:bg-grayScale-100"
value={draft.status}
onChange={(e) =>
setDraft((d) => ({

View File

@ -242,10 +242,10 @@ export function QuestionTypeConfigStep({
return (
<div className="space-y-8 pb-32">
<Card className="max-w-6xl mx-auto overflow-hidden border border-grayScale-200 shadow-sm rounded-2xl bg-white">
<Card className="max-w-6xl mx-auto overflow-hidden border border-grayScale-200 shadow-sm rounded-2xl bg-white dark:bg-grayScale-50">
<div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 2: Input &amp; answer types</h2>
<p className="text-grayScale-500 font-medium mt-1">
<h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 2: Input &amp; answer types</h2>
<p className="text-grayScale-500 dark:text-grayScale-400 font-medium mt-1">
Choose what learners see in the question and how they respond. Add or remove slots for each type
as needed.
</p>
@ -268,7 +268,7 @@ export function QuestionTypeConfigStep({
how many fields of each type you need.
</p>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
<div className="grid grid-cols-3 gap-4">
{stimulusCatalogKinds.map((kind) => {
const { label, Icon } = getStimulusKindPresentation(kind)
const selected = draft.stimulus_component_kinds.includes(kind)
@ -282,35 +282,33 @@ export function QuestionTypeConfigStep({
onClick={() => handleStimulusKindClick(kind)}
/>
{selected && !isNoInputComponentKind(kind) ? (
<div className="flex items-center justify-between gap-2 px-0.5 min-h-[32px]">
<span className="text-[12px] text-grayScale-500 font-medium">
{slotCount} slot{slotCount === 1 ? "" : "s"}
<div className="flex items-center justify-center gap-1.5 px-1 pt-1">
<Button
type="button"
variant="outline"
size="sm"
className="h-7 px-2 text-[10px] font-semibold border-grayScale-200 dark:border-grayScale-300 text-grayScale-600 dark:text-grayScale-500 hover:bg-grayScale-100 dark:hover:bg-grayScale-200/50"
onClick={() => removeStimulusSlot(kind)}
disabled={slotCount === 0}
aria-label={`Remove ${label} slot`}
>
<Minus className="h-3 w-3 mr-1" />
Remove
</Button>
<span className="text-[11px] font-bold text-grayScale-700 dark:text-grayScale-500 tabular-nums min-w-[20px] text-center">
{slotCount}
</span>
<div className="flex items-center gap-1">
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 shrink-0 text-[12px] font-bold text-grayScale-600 hover:bg-grayScale-100"
onClick={() => removeStimulusSlot(kind)}
disabled={slotCount === 0}
aria-label={`Remove ${label} slot`}
>
<Minus className="h-3.5 w-3.5 mr-1" />
Remove
</Button>
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 shrink-0 text-[12px] font-bold text-[#9E2891] hover:text-[#8A237E] hover:bg-violet-50"
onClick={() => addStimulusSlot(kind)}
aria-label={`Add ${label} slot`}
>
<Plus className="h-3.5 w-3.5 mr-1" />
Add
</Button>
</div>
<Button
type="button"
variant="outline"
size="sm"
className="h-7 px-2 text-[10px] font-semibold border-grayScale-200 dark:border-grayScale-300 text-grayScale-600 dark:text-grayScale-500 hover:bg-grayScale-100 dark:hover:bg-grayScale-200/50"
onClick={() => addStimulusSlot(kind)}
aria-label={`Add ${label} slot`}
>
<Plus className="h-3 w-3 mr-1" />
Add
</Button>
</div>
) : null}
</div>
@ -332,7 +330,7 @@ export function QuestionTypeConfigStep({
each type needs.
</p>
</div>
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4">
<div className="grid grid-cols-3 gap-4">
{responseCatalogKinds.map((kind) => {
const { label, Icon } = getResponseKindPresentation(kind)
const selected = draft.response_component_kinds.includes(kind)
@ -346,35 +344,33 @@ export function QuestionTypeConfigStep({
onClick={() => handleResponseKindClick(kind)}
/>
{selected && !isNoInputComponentKind(kind) ? (
<div className="flex items-center justify-between gap-2 px-0.5 min-h-[32px]">
<span className="text-[12px] text-grayScale-500 font-medium">
{slotCount} slot{slotCount === 1 ? "" : "s"}
<div className="flex items-center justify-center gap-1.5 px-1 pt-1">
<Button
type="button"
variant="outline"
size="sm"
className="h-7 px-2 text-[10px] font-semibold border-grayScale-200 dark:border-grayScale-300 text-grayScale-600 dark:text-grayScale-500 hover:bg-grayScale-100 dark:hover:bg-grayScale-200/50"
onClick={() => removeResponseSlot(kind)}
disabled={slotCount === 0}
aria-label={`Remove ${label} slot`}
>
<Minus className="h-3 w-3 mr-1" />
Remove
</Button>
<span className="text-[11px] font-bold text-grayScale-700 dark:text-grayScale-500 tabular-nums min-w-[20px] text-center">
{slotCount}
</span>
<div className="flex items-center gap-1">
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 shrink-0 text-[12px] font-bold text-grayScale-600 hover:bg-grayScale-100"
onClick={() => removeResponseSlot(kind)}
disabled={slotCount === 0}
aria-label={`Remove ${label} slot`}
>
<Minus className="h-3.5 w-3.5 mr-1" />
Remove
</Button>
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 shrink-0 text-[12px] font-bold text-[#9E2891] hover:text-[#8A237E] hover:bg-violet-50"
onClick={() => addResponseSlot(kind)}
aria-label={`Add ${label} slot`}
>
<Plus className="h-3.5 w-3.5 mr-1" />
Add
</Button>
</div>
<Button
type="button"
variant="outline"
size="sm"
className="h-7 px-2 text-[10px] font-semibold border-grayScale-200 dark:border-grayScale-300 text-grayScale-600 dark:text-grayScale-500 hover:bg-grayScale-100 dark:hover:bg-grayScale-200/50"
onClick={() => addResponseSlot(kind)}
aria-label={`Add ${label} slot`}
>
<Plus className="h-3 w-3 mr-1" />
Add
</Button>
</div>
) : null}
</div>
@ -396,11 +392,11 @@ export function QuestionTypeConfigStep({
errors={errors}
/>
<div className="rounded-xl border border-grayScale-200 bg-grayScale-50/50 overflow-hidden">
<div className="rounded-xl border border-grayScale-200 bg-grayScale-100 dark:bg-grayScale-100 overflow-hidden">
<button
type="button"
onClick={() => setAdvancedOpen((o) => !o)}
className="w-full flex items-center justify-between px-4 py-3 text-left text-[14px] font-bold text-grayScale-700 hover:bg-grayScale-100/80 transition-colors"
className="w-full flex items-center justify-between px-4 py-3 text-left text-[14px] font-bold text-grayScale-700 dark:text-grayScale-500 hover:bg-grayScale-100/80 dark:hover:bg-grayScale-200/50 transition-colors"
>
Advanced: edit schema rows (optional)
{advancedOpen ? (
@ -410,7 +406,7 @@ export function QuestionTypeConfigStep({
)}
</button>
{advancedOpen ? (
<div className="px-4 pb-6 pt-2 space-y-10 border-t border-grayScale-200 bg-white">
<div className="px-4 pb-6 pt-2 space-y-10 border-t border-grayScale-200 bg-white dark:bg-grayScale-50">
<SchemaBuilderSection
title="Stimulus schema"
side="stimulus"

View File

@ -103,10 +103,10 @@ export function QuestionTypeReviewPublishStep({
return (
<div className="space-y-8 pb-32">
<Card className="max-w-4xl mx-auto overflow-hidden border-grayScale-100 shadow-sm rounded-2xl bg-white">
<Card className="max-w-4xl mx-auto overflow-hidden border-grayScale-100 shadow-sm rounded-2xl bg-white dark:bg-grayScale-50">
<div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 4: Review &amp; publish</h2>
<p className="text-grayScale-500 font-medium mt-1">
<h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 4: Review &amp; publish</h2>
<p className="text-grayScale-500 dark:text-grayScale-400 font-medium mt-1">
{isEdit
? "Confirm your changes and save. The definition key cannot be changed."
: "Confirm your definition, then save it for use when authoring practice questions."}
@ -123,35 +123,35 @@ export function QuestionTypeReviewPublishStep({
<dl className="grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm">
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Key</dt>
<dd className="font-medium text-grayScale-900 mt-1 font-mono text-[13px]">{payload.key}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1 font-mono text-[13px]">{payload.key}</dd>
</div>
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Display name</dt>
<dd className="font-medium text-grayScale-900 mt-1">{payload.display_name}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.display_name}</dd>
</div>
<div className="sm:col-span-2">
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Description</dt>
<dd className="font-medium text-grayScale-800 mt-1">{payload.description || "—"}</dd>
<dd className="font-medium text-grayScale-800 dark:text-grayScale-500 mt-1">{payload.description || "—"}</dd>
</div>
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Groups</dt>
<dd className="font-medium text-grayScale-900 mt-1">{groupName || "—"}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{groupName || "—"}</dd>
</div>
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Status</dt>
<dd className="font-medium text-grayScale-900 mt-1">{draft.status}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{draft.status}</dd>
</div>
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Runtime type</dt>
<dd className="font-medium text-grayScale-900 mt-1">{runtime ?? "—"}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{runtime ?? "—"}</dd>
</div>
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Stimulus kinds</dt>
<dd className="font-medium text-grayScale-900 mt-1">{payload.stimulus_component_kinds.join(", ") || "—"}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.stimulus_component_kinds.join(", ") || "—"}</dd>
</div>
<div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Response kinds</dt>
<dd className="font-medium text-grayScale-900 mt-1">{payload.response_component_kinds.join(", ") || "—"}</dd>
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.response_component_kinds.join(", ") || "—"}</dd>
</div>
</dl>
@ -193,7 +193,7 @@ export function QuestionTypeReviewPublishStep({
</div>
</div>
<div className="px-4 py-4 border border-grayScale-200 flex items-center justify-start bg-[#F8FAFC]">
<div className="px-4 py-4 border border-grayScale-200 flex items-center justify-start bg-[#F8FAFC] dark:bg-grayScale-100">
<Button
type="button"
variant="outline"
@ -218,14 +218,14 @@ function SchemaSlotSummary({
rows: { id: string; kind: string; label?: string; required: boolean }[]
}) {
return (
<div className="rounded-xl border border-grayScale-100 bg-grayScale-50/50 p-4">
<div className="rounded-xl border border-grayScale-100 bg-grayScale-100 dark:bg-grayScale-100 p-4">
<h4 className="text-[12px] font-bold uppercase tracking-wide text-grayScale-500">{title}</h4>
{rows.length === 0 ? (
<p className="mt-2 text-sm text-grayScale-500">No slots</p>
) : (
<ul className="mt-2 space-y-1.5 text-sm">
{rows.map((r) => (
<li key={`${r.kind}-${r.id}`} className="flex flex-wrap gap-x-2 text-grayScale-800">
<li key={`${r.kind}-${r.id}`} className="flex flex-wrap gap-x-2 text-grayScale-800 dark:text-grayScale-500">
<span className="font-medium">{slotLabel(r)}</span>
<span className="text-grayScale-400">·</span>
<span className="font-mono text-[11px] text-grayScale-500">{r.id}</span>

View File

@ -17,7 +17,7 @@ export function QuestionTypeStepFooter({
nextDisabled = false,
}: QuestionTypeStepFooterProps) {
return (
<div className="px-4 py-4 border border-grayScale-200 flex flex-wrap items-center justify-between gap-3 bg-[#F8FAFC]">
<div className="px-4 py-4 border border-grayScale-200 flex flex-wrap items-center justify-between gap-3 bg-[#F8FAFC] dark:bg-grayScale-100">
<div className="flex items-center gap-2">
{onBack ? (
<Button

View File

@ -69,10 +69,10 @@ export function QuestionTypeValidatePreviewStep({
return (
<div className="space-y-8 pb-32">
<Card className="max-w-4xl mx-auto overflow-hidden border-grayScale-100 shadow-sm rounded-2xl bg-white">
<Card className="max-w-4xl mx-auto overflow-hidden border-grayScale-100 shadow-sm rounded-2xl bg-white dark:bg-grayScale-50">
<div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 3: Validate</h2>
<p className="text-grayScale-500 font-medium mt-1">
<h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 3: Validate</h2>
<p className="text-grayScale-500 dark:text-grayScale-400 font-medium mt-1">
We check that your stimulus and response selections are valid before you continue. You must pass
validation before review.
</p>

View File

@ -91,8 +91,8 @@ export function SchemaBuilderSection({
<div className="space-y-4">
<div className="flex items-center justify-between gap-4">
<div>
<h3 className="text-[16px] font-bold text-grayScale-900">{title}</h3>
<p className="text-[13px] text-grayScale-500 mt-0.5">
<h3 className="text-[16px] font-bold text-grayScale-900 dark:text-grayScale-600">{title}</h3>
<p className="text-[13px] text-grayScale-500 dark:text-grayScale-400 mt-0.5">
Fine-tune slot ids, labels, required flags, and optional config. Labels are the field titles
authors see when creating questions.
</p>
@ -125,10 +125,10 @@ export function SchemaBuilderSection({
return (
<div
key={`${side}-${index}`}
className="rounded-xl border border-grayScale-200 bg-[#F8FAFC] p-4 space-y-3"
className="rounded-xl border border-grayScale-200 bg-[#F8FAFC] dark:bg-grayScale-100 p-4 space-y-3"
>
<div className="flex items-start justify-between gap-2">
<span className="text-[12px] font-bold uppercase tracking-wide text-grayScale-400">
<span className="text-[12px] font-bold uppercase tracking-wide text-grayScale-400 dark:text-grayScale-500">
Row {index + 1}
</span>
<Button
@ -153,7 +153,7 @@ export function SchemaBuilderSection({
value={row.id}
onChange={(e) => updateRow(index, { id: e.target.value })}
placeholder="e.g. prompt"
className="h-10 bg-white"
className="h-10 bg-white dark:bg-grayScale-50"
/>
</div>
<div className="space-y-1.5">
@ -161,7 +161,7 @@ export function SchemaBuilderSection({
Kind <span className="text-red-500">*</span>
</label>
<Select
className="h-10 bg-white"
className="h-10 bg-white dark:bg-grayScale-50"
value={row.kind}
onChange={(e) => updateRow(index, { kind: e.target.value })}
>
@ -190,7 +190,7 @@ export function SchemaBuilderSection({
value={row.label ?? ""}
onChange={(e) => updateRow(index, { label: e.target.value })}
placeholder={defaultLabelForKind(row.kind)}
className="h-10 bg-white"
className="h-10 bg-white dark:bg-grayScale-50"
/>
</div>
<label className="flex items-center gap-2 pt-6 md:pt-8">
@ -207,7 +207,7 @@ export function SchemaBuilderSection({
<div className="space-y-1.5">
<label className="text-[12px] font-semibold text-grayScale-600">Config (JSON object)</label>
<Textarea
className="min-h-[72px] font-mono text-[13px] bg-white"
className="min-h-[72px] font-mono text-[13px] bg-white dark:bg-grayScale-50"
placeholder='{"max_length": 1000}'
defaultValue={row.config ? JSON.stringify(row.config, null, 2) : ""}
key={`${side}-cfg-${index}-${rows.length}`}

View File

@ -46,7 +46,7 @@ function SlotLabelGroup({
return (
<div className="space-y-3">
<h4 className="text-[12px] font-bold uppercase tracking-wide text-grayScale-500">{title}</h4>
<h4 className="text-[12px] font-bold uppercase tracking-wide text-grayScale-500 dark:text-grayScale-400">{title}</h4>
<div className="space-y-2">
{rows.map((row, index) => {
const presentation =
@ -57,11 +57,11 @@ function SlotLabelGroup({
return (
<div
key={`${side}-${row.id}-${index}`}
className="rounded-xl border border-grayScale-200 bg-white p-3 space-y-2"
className="rounded-xl border border-grayScale-200 bg-white dark:bg-grayScale-100 p-3 space-y-2"
>
<div className="flex items-start justify-between gap-2">
<div className="flex flex-wrap items-center gap-x-2 gap-y-0.5 text-[12px] text-grayScale-500">
<span className="font-semibold text-grayScale-700">{presentation.label}</span>
<span className="font-semibold text-grayScale-700 dark:text-grayScale-500">{presentation.label}</span>
<span className="text-grayScale-300">·</span>
<span className="font-mono text-[11px]">{row.id}</span>
</div>
@ -91,7 +91,7 @@ function SlotLabelGroup({
value={row.label ?? ""}
onChange={(e) => onChange(updateRowLabel(rows, index, e.target.value))}
placeholder={defaultLabelForKind(row.kind)}
className="h-10 bg-white"
className="h-10 bg-white dark:bg-grayScale-50"
/>
<p className="text-[11px] text-grayScale-400">
Shown to authors when they create questions from this type.
@ -118,10 +118,10 @@ export function SchemaSlotLabelsPanel({
if (!stimulusRows.length && !responseRows.length) return null
return (
<div className="rounded-xl border border-grayScale-200 bg-[#F8FAFC] p-5 space-y-6">
<div className="rounded-xl border border-grayScale-200 bg-[#F8FAFC] dark:bg-grayScale-100 p-5 space-y-6">
<div>
<h3 className="text-[16px] font-bold text-grayScale-900">Field labels</h3>
<p className="text-[13px] text-grayScale-500 mt-0.5">
<h3 className="text-[16px] font-bold text-grayScale-900 dark:text-grayScale-600">Field labels</h3>
<p className="text-[13px] text-grayScale-500 dark:text-grayScale-400 mt-0.5">
Name each schema slot for question authors, or remove slots you no longer need. Labels are stored on
the definition and are not sent inside question payloads.
</p>