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 *.njsproj
*.sln *.sln
*.sw? *.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==", "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@babel/code-frame": "^7.27.1", "@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5", "@babel/generator": "^7.28.5",
@ -363,7 +362,6 @@
"resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz", "resolved": "https://registry.npmjs.org/@dnd-kit/core/-/core-6.3.1.tgz",
"integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==", "integrity": "sha512-xkGBRQQab4RLwgXxoqETICr6S5JlogafbhNsidmrkVv2YRs5MLwpjoF2qpiGjQt8S9AoxtIV603s0GIUpY5eYQ==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@dnd-kit/accessibility": "^3.1.1", "@dnd-kit/accessibility": "^3.1.1",
"@dnd-kit/utilities": "^3.2.2", "@dnd-kit/utilities": "^3.2.2",
@ -2820,7 +2818,6 @@
"integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==", "integrity": "sha512-vnDVpYPMzs4wunl27jHrfmwojOGKya0xyM3sH+UE5iv5uPS6vX7UIoh6m+vQc5LGBq52HBKPIn/zcSZVzeDEZg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"undici-types": "~7.16.0" "undici-types": "~7.16.0"
} }
@ -2829,9 +2826,8 @@
"version": "19.2.7", "version": "19.2.7",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz",
"integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"csstype": "^3.2.2" "csstype": "^3.2.2"
} }
@ -2840,9 +2836,8 @@
"version": "19.2.3", "version": "19.2.3",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==", "integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==",
"devOptional": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"peerDependencies": { "peerDependencies": {
"@types/react": "^19.2.0" "@types/react": "^19.2.0"
} }
@ -2898,7 +2893,6 @@
"integrity": "sha512-6/cmF2piao+f6wSxUsJLZjck7OQsYyRtcOZS02k7XINSNlz93v6emM8WutDQSXnroG2xwYlEVHJI+cPA7CPM3Q==", "integrity": "sha512-6/cmF2piao+f6wSxUsJLZjck7OQsYyRtcOZS02k7XINSNlz93v6emM8WutDQSXnroG2xwYlEVHJI+cPA7CPM3Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@typescript-eslint/scope-manager": "8.50.0", "@typescript-eslint/scope-manager": "8.50.0",
"@typescript-eslint/types": "8.50.0", "@typescript-eslint/types": "8.50.0",
@ -3150,7 +3144,6 @@
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
}, },
@ -3389,7 +3382,6 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.9.0", "baseline-browser-mapping": "^2.9.0",
"caniuse-lite": "^1.0.30001759", "caniuse-lite": "^1.0.30001759",
@ -3650,7 +3642,7 @@
"version": "3.2.3", "version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"devOptional": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/custom-error-instance": { "node_modules/custom-error-instance": {
@ -3987,7 +3979,6 @@
"integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==", "integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/eslint-utils": "^4.8.0",
"@eslint-community/regexpp": "^4.12.1", "@eslint-community/regexpp": "^4.12.1",
@ -5194,7 +5185,6 @@
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": ">=12" "node": ">=12"
}, },
@ -5248,7 +5238,6 @@
} }
], ],
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"nanoid": "^3.3.11", "nanoid": "^3.3.11",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
@ -5454,7 +5443,6 @@
"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz", "resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz",
"integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==", "integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==",
"license": "MIT", "license": "MIT",
"peer": true,
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
} }
@ -5464,7 +5452,6 @@
"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz", "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz",
"integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==", "integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"scheduler": "^0.27.0" "scheduler": "^0.27.0"
}, },
@ -5476,15 +5463,13 @@
"version": "19.2.5", "version": "19.2.5",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.5.tgz", "resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.5.tgz",
"integrity": "sha512-Dn0t8IQhCmeIT3wu+Apm1/YVsJXsGWi6k4sPdnBIdqMVtHtv0IGi6dcpNpNkNac0zB2uUAqNX3MHzN8c+z2rwQ==", "integrity": "sha512-Dn0t8IQhCmeIT3wu+Apm1/YVsJXsGWi6k4sPdnBIdqMVtHtv0IGi6dcpNpNkNac0zB2uUAqNX3MHzN8c+z2rwQ==",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/react-redux": { "node_modules/react-redux": {
"version": "9.2.0", "version": "9.2.0",
"resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz", "resolved": "https://registry.npmjs.org/react-redux/-/react-redux-9.2.0.tgz",
"integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==", "integrity": "sha512-ROY9fvHhwOD9ySfrF0wmvu//bKCQ6AeZZq1nJNtbDC+kk5DuSuNX/n6YWYF/SYy7bSba4D4FSz8DJeKY/S/r+g==",
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"@types/use-sync-external-store": "^0.0.6", "@types/use-sync-external-store": "^0.0.6",
"use-sync-external-store": "^1.4.0" "use-sync-external-store": "^1.4.0"
@ -5690,8 +5675,7 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz", "resolved": "https://registry.npmjs.org/redux/-/redux-5.0.1.tgz",
"integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==", "integrity": "sha512-M9/ELqF6fy8FwmkpnF0S3YKOqMyoWJ4+CS5Efg2ct3oY9daQvd/Pc71FpGZsVsbl3Cpb+IIcjBDUnnyBdQbq4w==",
"license": "MIT", "license": "MIT"
"peer": true
}, },
"node_modules/redux-thunk": { "node_modules/redux-thunk": {
"version": "3.1.0", "version": "3.1.0",
@ -6174,7 +6158,6 @@
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"peer": true,
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
"tsserver": "bin/tsserver" "tsserver": "bin/tsserver"
@ -6352,7 +6335,6 @@
"integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"dependencies": { "dependencies": {
"esbuild": "^0.27.0", "esbuild": "^0.27.0",
"fdir": "^6.5.0", "fdir": "^6.5.0",
@ -6490,7 +6472,6 @@
"integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==", "integrity": "sha512-0wZ1IRqGGhMP76gLqz8EyfBXKk0J2qo2+H3fi4mcUP/KtTocoX08nmIAHl1Z2kJIZbZee8KOpBCSNPRgauucjw==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peer": true,
"funding": { "funding": {
"url": "https://github.com/sponsors/colinhacks" "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 ( return (
<Card className="shadow-none"> <Card className="shadow-none">
<CardContent className="p-4"> <CardContent className="p-5">
<div className="flex items-start justify-between gap-3"> <div className="flex items-start justify-between gap-3">
<div> <div>
<div className="text-2xl font-semibold tracking-tight">{value}</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 className="mt-1 text-xs font-medium text-grayScale-500">{label}</div>
</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" /> <Icon className="h-5 w-5" />
</div> </div>
</div> </div>
<div className={cn("mt-3 text-xs font-medium", deltaPositive ? "text-mint-500" : "text-destructive")}> <div className="border-t border-grayScale-200 mt-4 pt-3">
{deltaLabel} <span className="text-grayScale-400">vs Last Month</span> <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> </div>
</CardContent> </CardContent>
</Card> </Card>

View File

@ -20,7 +20,7 @@ import {
import { type ComponentType, useEffect, useState } from "react"; import { type ComponentType, useEffect, useState } from "react";
import { NavLink } from "react-router-dom"; import { NavLink } from "react-router-dom";
import { cn } from "../../lib/utils"; import { cn } from "../../lib/utils";
import { BrandLogo } from "../brand/BrandLogo"; import { SidebarLogo } from "./SidebarLogo";
import { getUnreadCount } from "../../api/notifications.api"; import { getUnreadCount } from "../../api/notifications.api";
import { useTeamPermissions } from "../../hooks/useTeamPermissions"; import { useTeamPermissions } from "../../hooks/useTeamPermissions";
import { hasFaqPermission } from "../../lib/faqPermissions"; import { hasFaqPermission } from "../../lib/faqPermissions";
@ -118,7 +118,13 @@ const navEntries: NavEntry[] = [
icon: CreditCard, icon: CreditCard,
permission: "subscriptions.export", 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", label: "Issue reports", to: "/issues", icon: CircleAlert },
{ {
kind: "link", kind: "link",
@ -153,7 +159,11 @@ export function Sidebar({
onToggleCollapse, onToggleCollapse,
onClose, onClose,
}: SidebarProps) { }: SidebarProps) {
const { permissions, hasPermission, loading: permissionsLoading } = useTeamPermissions(); const {
permissions,
hasPermission,
loading: permissionsLoading,
} = useTeamPermissions();
const [unreadCount, setUnreadCount] = useState(0); const [unreadCount, setUnreadCount] = useState(0);
useEffect(() => { useEffect(() => {
@ -196,7 +206,8 @@ export function Sidebar({
<aside <aside
className={cn( 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", "w-[264px] px-4 lg:translate-x-0",
isCollapsed && "lg:w-[88px] lg:px-2", isCollapsed && "lg:w-[88px] lg:px-2",
isOpen ? "translate-x-0" : "-translate-x-full", isOpen ? "translate-x-0" : "-translate-x-full",
@ -205,49 +216,48 @@ export function Sidebar({
<div <div
className={cn( className={cn(
"flex items-center justify-between px-2", "flex items-center justify-between px-2",
isCollapsed && "justify-center", isCollapsed && "flex-col items-center gap-2",
)} )}
> >
{isCollapsed ? ( <SidebarLogo collapsed={isCollapsed} />
<span className="h-10 w-10 overflow-hidden"> {isCollapsed && (
<BrandLogo className="h-10 w-auto max-w-none" /> <button
</span> 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"
<BrandLogo /> 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 <button
type="button" type="button"
className={cn( 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"
"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"
onClick={onClose} onClick={onClose}
aria-label="Close sidebar" aria-label="Close sidebar"
> >
<X className="h-5 w-5" /> <X className="h-4 w-4" />
</button> </button>
</div> </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) => { {navEntries.map((entry, index) => {
if (entry.kind === "section") { if (entry.kind === "section") {
if (isCollapsed) { if (isCollapsed) {
return index > 0 ? ( return index > 0 ? (
<div <div
key={`section-gap-${entry.label}`} 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 aria-hidden
/> />
) : null; ) : null;
@ -256,7 +266,7 @@ export function Sidebar({
<p <p
key={`section-${entry.label}`} key={`section-${entry.label}`}
className={cn( 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", index === 0 && "pt-0",
)} )}
> >
@ -346,11 +356,11 @@ export function Sidebar({
onClick={onClose} onClick={onClose}
className={({ isActive }) => className={({ isActive }) =>
cn( cn(
"group flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium text-grayScale-600 transition", "group flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-grayScale-600 transition",
isCollapsed && "justify-center px-2", isCollapsed && "justify-center gap-0 p-2",
"hover:bg-grayScale-100 hover:text-brand-600", "hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isActive && 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} title={isCollapsed ? entry.label : undefined}
@ -359,8 +369,8 @@ export function Sidebar({
<> <>
<span <span
className={cn( 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", "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/90 text-white", isActive && "bg-brand-500/20 text-brand-600 dark:bg-brand-500/20 dark:text-brand-400",
)} )}
> >
<Icon className="h-4 w-4" /> <Icon className="h-4 w-4" />
@ -368,9 +378,6 @@ export function Sidebar({
{!isCollapsed && ( {!isCollapsed && (
<span className="truncate">{entry.label}</span> <span className="truncate">{entry.label}</span>
)} )}
{!isCollapsed && isActive ? (
<span className="ml-auto h-6 w-1 rounded-full bg-brand-500/80" />
) : null}
</> </>
)} )}
</NavLink> </NavLink>
@ -378,7 +385,12 @@ export function Sidebar({
})} })}
</nav> </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 <button
type="button" type="button"
onClick={() => { onClick={() => {
@ -386,12 +398,14 @@ export function Sidebar({
window.location.href = "/login"; window.location.href = "/login";
}} }}
className={cn( 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", "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 px-2", isCollapsed && "justify-center gap-0 p-2",
)} )}
title={isCollapsed ? "Logout" : undefined} 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"} {!isCollapsed && "Logout"}
</button> </button>
</div> </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(() => { useEffect(() => {
if (isSectionActive) { if (isSectionActive) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setExpanded(true); setExpanded(true);
} }
}, [isSectionActive]); }, [isSectionActive]);
@ -50,10 +51,10 @@ export function SidebarNavGroup({
onClick={onNavigate} onClick={onNavigate}
className={({ isActive }) => className={({ isActive }) =>
cn( cn(
"group flex items-center justify-center rounded-lg px-2 py-2.5 text-sm font-medium text-grayScale-600 transition", "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", "hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isActive && 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} title={label}
@ -61,8 +62,8 @@ export function SidebarNavGroup({
{({ isActive }) => ( {({ isActive }) => (
<span <span
className={cn( 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", "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/90 text-white", isActive && "bg-brand-500/20 text-brand-600 dark:bg-brand-500/20 dark:text-brand-400",
)} )}
> >
<Icon className="h-4 w-4" /> <Icon className="h-4 w-4" />
@ -81,15 +82,15 @@ export function SidebarNavGroup({
aria-controls={panelId} aria-controls={panelId}
onClick={() => setExpanded((open) => !open)} onClick={() => setExpanded((open) => !open)}
className={cn( 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", "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", "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", isSectionActive && "text-brand-600 dark:text-brand-400",
)} )}
> >
<span <span
className={cn( 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", "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/90 text-white", isSectionActive && "bg-brand-500/20 text-brand-600 dark:bg-brand-500/20 dark:text-brand-400",
)} )}
> >
<Icon className="h-4 w-4" /> <Icon className="h-4 w-4" />
@ -98,7 +99,7 @@ export function SidebarNavGroup({
{trailing} {trailing}
<ChevronDown <ChevronDown
className={cn( 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", expanded && "rotate-180",
)} )}
/> />
@ -107,12 +108,12 @@ export function SidebarNavGroup({
<div <div
id={panelId} id={panelId}
className={cn( 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]", expanded ? "grid-rows-[1fr]" : "grid-rows-[0fr]",
)} )}
> >
<div className="overflow-hidden"> <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) => ( {children.map((child) => (
<NavLink <NavLink
key={child.to} key={child.to}
@ -121,10 +122,10 @@ export function SidebarNavGroup({
onClick={onNavigate} onClick={onNavigate}
className={({ isActive }) => className={({ isActive }) =>
cn( 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 isActive
? "bg-brand-100/40 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", : "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 */} {/* Connector Line - floats between circles with gap on both sides */}
{index < steps.length - 1 && ( {index < steps.length - 1 && (
<div <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)" }} 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", "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 isCurrent
? "border-brand-500 bg-brand-500 text-white shadow-md scale-110" ? "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} {stepNumber}
@ -42,7 +42,7 @@ export function Stepper({ steps, currentStep, className }: StepperProps) {
<span <span
className={cn( className={cn(
"relative z-10 text-[12px] font-bold transition-colors duration-300", "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} {step}

View File

@ -173,4 +173,12 @@
.admin-responsive-grid-3 { .admin-responsive-grid-3 {
@apply grid grid-cols-1 gap-4 sm:grid-cols-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) { if (isEdit && !definitionReady) {
return ( return (
<div className="min-h-screen pb-20 flex items-center justify-center px-6"> <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> <p className="text-grayScale-600 font-medium">Loading definition…</p>
</Card> </Card>
</div> </div>
@ -344,7 +344,7 @@ export function CreateQuestionTypeFlow() {
return ( return (
<div className="min-h-screen pb-20 overflow-x-hidden"> <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="max-w-[1440px] mx-auto py-6 px-4 sm:px-6">
<div className="flex items-center justify-between mb-8"> <div className="flex items-center justify-between mb-8">
<PageBackLink <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="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6">
<div className="space-y-1"> <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"} {isEdit ? "Edit question type definition" : "Create question type definition"}
</h1> </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 {isEdit
? `Update reusable question type definition #${editDefinitionId}.` ? `Update reusable question type definition #${editDefinitionId}.`
: "Build a reusable question type template for dynamic practice and assessment questions."} : "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"> <div className="flex items-center gap-4 shrink-0">
<Button <Button
variant="outline" 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")} onClick={() => navigate("/new-content/question-types")}
> >
Cancel 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 { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Plus, ArrowRight, Pencil, Trash2, X } from "lucide-react"; import { Plus, ArrowRight, Pencil, Trash2, X } from "lucide-react";
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
@ -31,7 +31,10 @@ import {
import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip"; import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip";
import { ContentAccessTierChip } from "./components/ContentAccessTierChip"; import { ContentAccessTierChip } from "./components/ContentAccessTierChip";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar"; import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types"; import type {
ContentAccessTier,
PracticePublishStatus,
} from "../../types/course.types";
import { import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
hasActiveContentFilters, 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. */ /** Presigned MinIO/S3 URLs and our storage hosts — safe to send to POST /files/refresh-url. */
function looksLikeRefreshableFileUrl(url: string): boolean { function looksLikeRefreshableFileUrl(url: string): boolean {
const trimmed = url.trim(); const trimmed = url.trim();
if (!trimmed.startsWith("http://") && !trimmed.startsWith("https://")) return false; if (!trimmed.startsWith("http://") && !trimmed.startsWith("https://"))
return false;
try { try {
const u = new URL(trimmed); const u = new URL(trimmed);
const q = u.search.toLowerCase(); const q = u.search.toLowerCase();
@ -78,7 +82,8 @@ export function LearnEnglishPage() {
const [createSortOrder, setCreateSortOrder] = useState(""); const [createSortOrder, setCreateSortOrder] = useState("");
const [createThumbnail, setCreateThumbnail] = useState(""); const [createThumbnail, setCreateThumbnail] = useState("");
const [createSaving, setCreateSaving] = useState(false); const [createSaving, setCreateSaving] = useState(false);
const [createUploadingThumbnail, setCreateUploadingThumbnail] = useState(false); const [createUploadingThumbnail, setCreateUploadingThumbnail] =
useState(false);
const createThumbnailFileInputRef = useRef<HTMLInputElement>(null); const createThumbnailFileInputRef = useRef<HTMLInputElement>(null);
const [deletingProgram, setDeletingProgram] = const [deletingProgram, setDeletingProgram] =
@ -120,7 +125,8 @@ export function LearnEnglishPage() {
setEditSortOrder(""); setEditSortOrder("");
setEditThumbnail(""); setEditThumbnail("");
setUploadingEditThumbnail(false); setUploadingEditThumbnail(false);
if (editThumbnailFileInputRef.current) editThumbnailFileInputRef.current.value = ""; if (editThumbnailFileInputRef.current)
editThumbnailFileInputRef.current.value = "";
}; };
const handleEditThumbnailFile = async ( const handleEditThumbnailFile = async (
@ -135,7 +141,9 @@ export function LearnEnglishPage() {
} }
const maxBytes = 5 * 1024 * 1024; const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) { 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; return;
} }
setUploadingEditThumbnail(true); setUploadingEditThumbnail(true);
@ -183,7 +191,9 @@ export function LearnEnglishPage() {
} }
const maxBytes = 5 * 1024 * 1024; const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) { 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; return;
} }
setCreateUploadingThumbnail(true); setCreateUploadingThumbnail(true);
@ -291,7 +301,9 @@ export function LearnEnglishPage() {
), ),
); );
toast.success( toast.success(
nextStatus === "PUBLISHED" ? "Program published" : "Program saved as draft", nextStatus === "PUBLISHED"
? "Program published"
: "Program saved as draft",
); );
} catch (e: unknown) { } catch (e: unknown) {
notifyApiError(e, "Failed to update program status"); notifyApiError(e, "Failed to update program status");
@ -313,7 +325,9 @@ export function LearnEnglishPage() {
), ),
); );
toast.success( 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) { } catch (e: unknown) {
notifyApiError(e, "Failed to update program access tier"); notifyApiError(e, "Failed to update program access tier");
@ -394,7 +408,10 @@ export function LearnEnglishPage() {
return ( return (
<div className="space-y-8"> <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 */} {/* Header section */}
<div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between"> <div className="flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between">
<div> <div>
@ -402,7 +419,7 @@ export function LearnEnglishPage() {
Learn English Learn English
</h1> </h1>
<p className="mt-1 text-sm text-grayScale-500"> <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> </p>
</div> </div>
@ -420,8 +437,8 @@ export function LearnEnglishPage() {
Add New Program Add New Program
</DialogTitle> </DialogTitle>
<DialogDescription className="text-sm text-grayScale-400"> <DialogDescription className="text-sm text-grayScale-400">
Create a new learning program. Add a thumbnail as an image URL or by uploading a Create a new learning program. Add a thumbnail as an image URL
file. or by uploading a file.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
{/* Gradient Divider */} {/* Gradient Divider */}
@ -479,7 +496,10 @@ export function LearnEnglishPage() {
</div> </div>
<div className="space-y-2"> <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 Sort Order
</label> </label>
<Input <Input
@ -519,15 +539,13 @@ export function LearnEnglishPage() {
> >
<div className="flex flex-col items-center justify-center"> <div className="flex flex-col items-center justify-center">
<div className="mb-4"> <div className="mb-4">
<img <img src={uploadIcon} alt="" className="h-10 w-10" />
src={uploadIcon}
alt=""
className="h-10 w-10"
/>
</div> </div>
<p className="text-sm"> <p className="text-sm">
<span className="font-bold text-[#9E2891]"> <span className="font-bold text-[#9E2891]">
{createUploadingThumbnail ? "Uploading…" : "Click to upload"} {createUploadingThumbnail
? "Uploading…"
: "Click to upload"}
</span>{" "} </span>{" "}
<span className="text-grayScale-500"> <span className="text-grayScale-500">
or paste a URL below or paste a URL below
@ -644,92 +662,93 @@ export function LearnEnglishPage() {
) : null} ) : null}
</div> </div>
) : ( ) : (
<div className="flex flex-wrap gap-10"> <div className="flex flex-wrap gap-10">
{filteredPrograms.map((program) => ( {filteredPrograms.map((program) => (
<Card <Card
key={program.id} 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" className="group relative w-[320px] 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)}
> >
<Pencil className="h-3.5 w-3.5" /> <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> <Button
<Button type="button"
type="button" variant="secondary"
variant="secondary" size="icon"
size="icon" className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" aria-label={`Edit ${program.name}`}
aria-label={`Delete ${program.name}`} onClick={() => openEdit(program)}
onClick={() => setDeletingProgram(program)} >
> <Pencil className="h-3.5 w-3.5" />
<Trash2 className="h-3.5 w-3.5" /> </Button>
</Button> <Button
</div> type="button"
<div variant="secondary"
className="h-32 w-full bg-cover bg-center" size="icon"
style={ className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
program.thumbnail?.trim() aria-label={`Delete ${program.name}`}
? { onClick={() => setDeletingProgram(program)}
backgroundImage: `url(${program.thumbnail.trim()})`, >
} <Trash2 className="h-3.5 w-3.5" />
: { </Button>
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> </div>
<h3 className="text-xl font-bold text-grayScale-700 line-clamp-2"> <div
{program.name} className="h-32 w-full bg-cover bg-center"
</h3> style={
<p className="mt-2 text-sm leading-relaxed text-grayScale-500 line-clamp-4"> program.thumbnail?.trim()
{program.description?.trim() ? {
? program.description backgroundImage: `url(${program.thumbnail.trim()})`,
: "—"} }
</p> : {
</div> background:
<Link "linear-gradient(135deg, #9E289180 0%, #9E2891 100%)",
to={`/new-content/learn-english/${program.id}/courses`} }
className="mt-4 block" }
onClick={(e) => e.stopPropagation()} />
> <CardContent className="bg-white p-6 flex flex-col h-[280px]">
<Button className="h-11 w-full rounded-[6px] bg-brand-500 font-semibold hover:bg-brand-600"> <div className="flex-1 min-h-0">
View Courses <div className="mb-3 flex flex-wrap gap-2">
<ArrowRight className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-1" /> <ContentPublishStatusChip
</Button> publishStatus={program.publish_status}
</Link> updating={publishStatusUpdatingId === program.id}
</CardContent> contentLabel="program"
</Card> onToggle={(nextStatus) =>
))} void handleProgramPublishStatus(
</div> 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> </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"> <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> <DialogTitle>Edit program</DialogTitle>
<DialogDescription> <DialogDescription>
Update name, description, sort order, and thumbnail. Upload an image Update name, description, sort order, and thumbnail. Upload an
from your computer (via file storage) or paste a URL. Changes are image from your computer (via file storage) or paste a URL.
saved to the server. Changes are saved to the server.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-4"> <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-4">
<div className="grid gap-4"> <div className="grid gap-4">
<div className="space-y-2"> <div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700"> <label className="text-sm font-medium text-grayScale-700">
Name Name
</label> </label>
<Input <Input
value={editName} value={editName}
onChange={(e) => setEditName(e.target.value)} onChange={(e) => setEditName(e.target.value)}
className="rounded-xl" className="rounded-xl"
placeholder="Program name" 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"
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()} />
> </div>
{uploadingEditThumbnail ? "Uploading…" : "Upload from computer"} <div className="space-y-2">
</Button> <label className="text-sm font-medium text-grayScale-700">
{editThumbnail.trim() ? ( Description
<div className="flex-1 overflow-hidden rounded-xl border border-grayScale-200 bg-grayScale-50"> </label>
<img <Textarea
src={editThumbnail.trim()} value={editDescription}
alt="" onChange={(e) => setEditDescription(e.target.value)}
className="h-24 w-full object-cover" rows={4}
/> className="rounded-xl resize-y min-h-[100px]"
</div> placeholder="Short summary of the program"
) : null} 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> </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> </div>
</div>
<DialogFooter className="shrink-0 gap-2 border-t border-grayScale-100 bg-white px-6 py-4 sm:gap-0"> <DialogFooter className="shrink-0 gap-2 border-t border-grayScale-100 bg-white px-6 py-4 sm:gap-0">
<Button <Button
type="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="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="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"> <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 <button
type="button" type="button"
onClick={() => !deleting && setDeletingProgram(null)} onClick={() => !deleting && setDeletingProgram(null)}
@ -884,8 +910,11 @@ export function LearnEnglishPage() {
</div> </div>
<p className="text-center text-sm leading-relaxed text-grayScale-600"> <p className="text-center text-sm leading-relaxed text-grayScale-600">
Are you sure you want to delete{" "} Are you sure you want to delete{" "}
<span className="font-semibold text-grayScale-700">{deletingProgram.name}</span>? This action cannot be <span className="font-semibold text-grayScale-700">
undone. Courses under this program may be affected depending on your backend. {deletingProgram.name}
</span>
? This action cannot be undone. Courses under this program may
be affected depending on your backend.
</p> </p>
</div> </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 { useCallback, useEffect, useMemo, useRef, useState } from "react";
import { Plus, Pencil, Trash2, X } from "lucide-react"; import { Plus, Pencil, Trash2, X } from "lucide-react";
import { Link, useNavigate, useParams } from "react-router-dom"; import { Link, useNavigate, useParams } from "react-router-dom";
@ -58,14 +58,12 @@ export function ProgramCoursesPage() {
const [loading, setLoading] = useState(true); const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null); const [error, setError] = useState<string | null>(null);
const [deletingCourse, setDeletingCourse] = useState<ProgramCourseListItem | null>( const [deletingCourse, setDeletingCourse] =
null, useState<ProgramCourseListItem | null>(null);
);
const [deleting, setDeleting] = useState(false); const [deleting, setDeleting] = useState(false);
const [editingCourse, setEditingCourse] = useState<ProgramCourseListItem | null>( const [editingCourse, setEditingCourse] =
null, useState<ProgramCourseListItem | null>(null);
);
const [editName, setEditName] = useState(""); const [editName, setEditName] = useState("");
const [editDescription, setEditDescription] = useState(""); const [editDescription, setEditDescription] = useState("");
const [editSortOrder, setEditSortOrder] = useState(""); const [editSortOrder, setEditSortOrder] = useState("");
@ -80,7 +78,8 @@ export function ProgramCoursesPage() {
const [createSortOrder, setCreateSortOrder] = useState(""); const [createSortOrder, setCreateSortOrder] = useState("");
const [createThumbnail, setCreateThumbnail] = useState(""); const [createThumbnail, setCreateThumbnail] = useState("");
const [createSaving, setCreateSaving] = useState(false); const [createSaving, setCreateSaving] = useState(false);
const [createUploadingThumbnail, setCreateUploadingThumbnail] = useState(false); const [createUploadingThumbnail, setCreateUploadingThumbnail] =
useState(false);
const createThumbnailFileInputRef = useRef<HTMLInputElement>(null); const createThumbnailFileInputRef = useRef<HTMLInputElement>(null);
const [publishStatusUpdatingId, setPublishStatusUpdatingId] = useState< const [publishStatusUpdatingId, setPublishStatusUpdatingId] = useState<
number | null number | null
@ -120,7 +119,9 @@ export function ProgramCoursesPage() {
), ),
); );
toast.success( toast.success(
nextStatus === "PUBLISHED" ? "Course published" : "Course saved as draft", nextStatus === "PUBLISHED"
? "Course published"
: "Course saved as draft",
); );
} catch (e: unknown) { } catch (e: unknown) {
notifyApiError(e, "Failed to update course status"); notifyApiError(e, "Failed to update course status");
@ -243,7 +244,9 @@ export function ProgramCoursesPage() {
} }
const maxBytes = 5 * 1024 * 1024; const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) { 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; return;
} }
setUploadingEditThumbnail(true); setUploadingEditThumbnail(true);
@ -328,7 +331,9 @@ export function ProgramCoursesPage() {
} }
const maxBytes = 5 * 1024 * 1024; const maxBytes = 5 * 1024 * 1024;
if (file.size > maxBytes) { 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; return;
} }
setCreateUploadingThumbnail(true); setCreateUploadingThumbnail(true);
@ -397,7 +402,11 @@ export function ProgramCoursesPage() {
return ( return (
<div className="space-y-8 pt-10"> <div className="space-y-8 pt-10">
{/* Navigation */} {/* 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 */} {/* Header section */}
<div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between"> <div className="flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between">
@ -411,11 +420,7 @@ export function ProgramCoursesPage() {
</ContentPageDescription> </ContentPageDescription>
) : loading ? ( ) : loading ? (
<div className="flex items-center gap-2 pt-1"> <div className="flex items-center gap-2 pt-1">
<img <img src={spinnerSrc} alt="" className="h-6 w-6 animate-spin" />
src={spinnerSrc}
alt=""
className="h-6 w-6 animate-spin"
/>
</div> </div>
) : null} ) : null}
</div> </div>
@ -443,8 +448,8 @@ export function ProgramCoursesPage() {
Add New Course Add New Course
</DialogTitle> </DialogTitle>
<DialogDescription className="text-sm text-grayScale-400"> <DialogDescription className="text-sm text-grayScale-400">
Add a new course to this program. Use an image URL or upload a file for the Add a new course to this program. Use an image URL or
thumbnail. upload a file for the thumbnail.
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
@ -535,7 +540,9 @@ export function ProgramCoursesPage() {
type="file" type="file"
accept="image/*" accept="image/*"
className="sr-only" className="sr-only"
onChange={(e) => void handleCreateCourseThumbnailFile(e)} onChange={(e) =>
void handleCreateCourseThumbnailFile(e)
}
disabled={createSaving || createUploadingThumbnail} disabled={createSaving || createUploadingThumbnail}
/> />
<button <button
@ -594,7 +601,9 @@ export function ProgramCoursesPage() {
variant="outline" variant="outline"
className="h-12 min-w-[120px] rounded-xl border-grayScale-200 font-semibold" className="h-12 min-w-[120px] rounded-xl border-grayScale-200 font-semibold"
disabled={createSaving || createUploadingThumbnail} disabled={createSaving || createUploadingThumbnail}
onClick={() => handleCreateCourseDialogOpenChange(false)} onClick={() =>
handleCreateCourseDialogOpenChange(false)
}
> >
Cancel Cancel
</Button> </Button>
@ -673,133 +682,136 @@ export function ProgramCoursesPage() {
</p> </p>
</div> </div>
) : ( ) : (
<div className="flex flex-wrap gap-10"> <div className="flex flex-wrap gap-10">
{filteredCourses.map((course) => { {filteredCourses.map((course) => {
const modules = const modules =
course.module_count ?? course.modules_count ?? 0; course.module_count ?? course.modules_count ?? 0;
const lessons = course.lesson_count ?? course.videos_count ?? 0; const lessons = course.lesson_count ?? course.videos_count ?? 0;
const practices = const practices =
course.practice_count ?? course.practices_count ?? 0; course.practice_count ?? course.practices_count ?? 0;
const thumbnailSrc = const thumbnailSrc =
course.thumbnail?.trim() || course.thumbnail_url?.trim() || ""; course.thumbnail?.trim() ||
return ( course.thumbnail_url?.trim() ||
<Card "";
key={course.id} return (
className="group relative w-[290px] overflow-hidden border border-grayScale-100 shadow-soft transition-all duration-300 hover:shadow-lg" <Card
> key={course.id}
<div className="group relative w-[350px] overflow-hidden border border-grayScale-100 shadow-soft transition-all duration-300 hover:shadow-lg"
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" /> <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> <Button
<Button type="button"
type="button" variant="secondary"
variant="secondary" size="icon"
size="icon" className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" aria-label={`Edit ${course.name}`}
aria-label={`Delete ${course.name}`} onClick={() => openEditCourse(course)}
onClick={() => setDeletingCourse(course)} >
> <Pencil className="h-3.5 w-3.5" />
<Trash2 className="h-3.5 w-3.5" /> </Button>
</Button> <Button
</div> type="button"
<div variant="secondary"
className="h-32 w-full bg-cover bg-center" size="icon"
style={ className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
thumbnailSrc aria-label={`Delete ${course.name}`}
? { onClick={() => setDeletingCourse(course)}
backgroundImage: `url(${thumbnailSrc})`, >
} <Trash2 className="h-3.5 w-3.5" />
: { </Button>
background: </div>
"linear-gradient(135deg, #9E289180 0%, #9E2891 100%)", <div
} className="h-32 w-full bg-cover bg-center"
} style={
/> thumbnailSrc
<CardContent className="p-6"> ? {
<div className="mb-3 flex flex-wrap gap-2"> backgroundImage: `url(${thumbnailSrc})`,
<ContentPublishStatusChip }
publishStatus={course.publish_status} : {
updating={publishStatusUpdatingId === course.id} background:
contentLabel="course" "linear-gradient(135deg, #9E289180 0%, #9E2891 100%)",
onToggle={(nextStatus) => }
void handleCoursePublishStatus(course.id, nextStatus)
} }
/> />
<ContentAccessTierChip <CardContent className="p-6">
accessTier={course.access_tier} <div className="mb-3 flex flex-wrap gap-2">
updating={accessTierUpdatingId === course.id} <ContentPublishStatusChip
contentLabel="course" publishStatus={course.publish_status}
onToggle={(nextTier) => updating={publishStatusUpdatingId === course.id}
void handleCourseAccessTier(course.id, nextTier) contentLabel="course"
} onToggle={(nextStatus) =>
/> void handleCoursePublishStatus(
</div> course.id,
<h3 className="text-xl font-bold text-grayScale-700"> nextStatus,
{course.name} )
</h3> }
<p className="mt-2 text-[13px] leading-relaxed text-grayScale-500 line-clamp-2"> />
{course.description?.trim() ? course.description : "—"} <ContentAccessTierChip
</p> 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="my-6 grid grid-cols-3 gap-4 border-y border-grayScale-50 py-4">
<div className="text-center"> <div className="text-center">
<p className="text-base font-bold text-grayScale-700"> <p className="text-base font-bold text-grayScale-700">
{modules} {modules}
</p> </p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400"> <p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Modules Modules
</p> </p>
</div> </div>
<div className="text-center"> <div className="text-center">
<p className="text-base font-bold text-grayScale-700"> <p className="text-base font-bold text-grayScale-700">
{lessons} {lessons}
</p> </p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400"> <p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Lessons Lessons
</p> </p>
</div> </div>
<div className="text-center"> <div className="text-center">
<p className="text-base font-bold text-grayScale-700"> <p className="text-base font-bold text-grayScale-700">
{practices} {practices}
</p> </p>
<p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400"> <p className="text-[10px] font-medium uppercase tracking-wider text-grayScale-400">
Practices Practices
</p> </p>
</div> </div>
</div> </div>
<div className="flex gap-3"> <div className="flex gap-3">
<Button <Button
variant="outline" variant="outline"
className="h-10 flex-1 rounded-[6px] border-brand-500 text-[13px] font-semibold text-brand-500 " className="h-10 flex-1 rounded-[6px] border-brand-500 text-[13px] font-semibold text-brand-500 "
onClick={() => onClick={() =>
navigate( navigate(
`/new-content/learn-english/${programIdParam}/courses/${course.id}`, `/new-content/learn-english/${programIdParam}/courses/${course.id}`,
) )
} }
> >
View Detail View Detail
</Button> </Button>
<PublishPracticeButton <PublishPracticeButton
parentKind="COURSE" parentKind="COURSE"
parentId={course.id} parentId={course.id}
className="h-10 flex-1 rounded-[6px] bg-brand-500 text-[13px] font-semibold hover:bg-brand-600 disabled:opacity-60" className="h-10 flex-1 rounded-[6px] bg-brand-500 text-[13px] font-semibold hover:bg-brand-600 disabled:opacity-60"
/> />
</div> </div>
</CardContent> </CardContent>
</Card> </Card>
); );
})} })}
</div> </div>
)} )}
</div> </div>
)} )}
@ -819,97 +831,99 @@ export function ProgramCoursesPage() {
</DialogDescription> </DialogDescription>
</DialogHeader> </DialogHeader>
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-4"> <div className="min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-4">
<div className="grid gap-4"> <div className="grid gap-4">
<div className="space-y-2"> <div className="space-y-2">
<label className="text-sm font-medium text-grayScale-700"> <label className="text-sm font-medium text-grayScale-700">
Name Name
</label> </label>
<Input <Input
value={editName} value={editName}
onChange={(e) => setEditName(e.target.value)} onChange={(e) => setEditName(e.target.value)}
className="rounded-xl" className="rounded-xl"
placeholder="Course name" 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"
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()} />
> </div>
{uploadingEditThumbnail ? "Uploading…" : "Upload from computer"} <div className="space-y-2">
</Button> <label className="text-sm font-medium text-grayScale-700">
{editThumbnail.trim() ? ( Description
<div className="flex-1 overflow-hidden rounded-xl border border-grayScale-200 bg-grayScale-50"> </label>
<img <Textarea
src={editThumbnail.trim()} value={editDescription}
alt="" onChange={(e) => setEditDescription(e.target.value)}
className="h-24 w-full object-cover" rows={4}
/> className="min-h-[100px] resize-y rounded-xl"
</div> placeholder="Short summary of the course"
) : null} 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> </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> </div>
</div>
<DialogFooter className="shrink-0 gap-2 border-t border-grayScale-100 bg-white px-6 py-4 sm:gap-0"> <DialogFooter className="shrink-0 gap-2 border-t border-grayScale-100 bg-white px-6 py-4 sm:gap-0">
<Button <Button
type="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="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="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"> <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 <button
type="button" type="button"
onClick={() => !deleting && setDeletingCourse(null)} onClick={() => !deleting && setDeletingCourse(null)}

View File

@ -113,7 +113,7 @@ function SortableItem({
ref={setNodeRef} ref={setNodeRef}
style={style} style={style}
className={cn( 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 && "opacity-50 border-dashed z-50 shadow-sm",
!isDragging && "hover:border-brand-200 hover:shadow-sm", !isDragging && "hover:border-brand-200 hover:shadow-sm",
)} )}
@ -232,7 +232,7 @@ function DraggableList({
</SortableContext> </SortableContext>
<DragOverlay> <DragOverlay>
{activeItem ? ( {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="flex items-center gap-4">
<div className="p-1 "> <div className="p-1 ">
<GripVertical className="h-4 w-4" /> <GripVertical className="h-4 w-4" />
@ -277,7 +277,7 @@ function HierarchySection({
children, children,
}: SectionProps) { }: SectionProps) {
return ( 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 <button
onClick={onToggle} onClick={onToggle}
className={cn( className={cn(

View File

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

View File

@ -27,10 +27,10 @@ export function QuestionTypeBasicInfoStep({
}: QuestionTypeBasicInfoStepProps) { }: QuestionTypeBasicInfoStepProps) {
return ( return (
<div className="space-y-8 pb-32"> <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"> <div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 1: Definition basics</h2> <h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 1: Definition basics</h2>
<p className="text-grayScale-500 font-medium mt-1"> <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 Set the reusable key, display name, and status. On the next step you will choose how questions are
presented and how learners answer. presented and how learners answer.
</p> </p>
@ -39,11 +39,11 @@ export function QuestionTypeBasicInfoStep({
<div className="p-10 space-y-8"> <div className="p-10 space-y-8">
<div className="grid grid-cols-1 md:grid-cols-2 gap-6"> <div className="grid grid-cols-1 md:grid-cols-2 gap-6">
<div className="space-y-2"> <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> Key <span className="text-red-500">*</span>
</label> </label>
<Input <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" placeholder="e.g. dynamic_visual_mcq_001"
value={draft.key} value={draft.key}
onChange={(e) => setDraft((d) => ({ ...d, key: e.target.value }))} onChange={(e) => setDraft((d) => ({ ...d, key: e.target.value }))}
@ -59,11 +59,11 @@ export function QuestionTypeBasicInfoStep({
</div> </div>
<div className="space-y-2"> <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> Display name <span className="text-red-500">*</span>
</label> </label>
<Input <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" placeholder="e.g. Speak About the Photo"
value={draft.display_name} value={draft.display_name}
onChange={(e) => setDraft((d) => ({ ...d, display_name: e.target.value }))} onChange={(e) => setDraft((d) => ({ ...d, display_name: e.target.value }))}
@ -73,9 +73,9 @@ export function QuestionTypeBasicInfoStep({
</div> </div>
<div className="space-y-2"> <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 <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" placeholder="Optional description for admins"
value={draft.description ?? ""} value={draft.description ?? ""}
onChange={(e) => setDraft((d) => ({ ...d, description: e.target.value }))} onChange={(e) => setDraft((d) => ({ ...d, description: e.target.value }))}
@ -83,7 +83,7 @@ export function QuestionTypeBasicInfoStep({
</div> </div>
<div className="space-y-2 max-w-md"> <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 <QuestionTypeGroupsMultiSelect
value={draft.group_ids ?? null} value={draft.group_ids ?? null}
onChange={(groupIds) => setDraft((d) => ({ ...d, group_ids: groupIds }))} onChange={(groupIds) => setDraft((d) => ({ ...d, group_ids: groupIds }))}
@ -94,11 +94,11 @@ export function QuestionTypeBasicInfoStep({
</div> </div>
<div className="space-y-2 max-w-xs"> <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> Status <span className="text-red-500">*</span>
</label> </label>
<Select <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} value={draft.status}
onChange={(e) => onChange={(e) =>
setDraft((d) => ({ setDraft((d) => ({

View File

@ -242,10 +242,10 @@ export function QuestionTypeConfigStep({
return ( return (
<div className="space-y-8 pb-32"> <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"> <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> <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 font-medium mt-1"> <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 Choose what learners see in the question and how they respond. Add or remove slots for each type
as needed. as needed.
</p> </p>
@ -268,7 +268,7 @@ export function QuestionTypeConfigStep({
how many fields of each type you need. how many fields of each type you need.
</p> </p>
</div> </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) => { {stimulusCatalogKinds.map((kind) => {
const { label, Icon } = getStimulusKindPresentation(kind) const { label, Icon } = getStimulusKindPresentation(kind)
const selected = draft.stimulus_component_kinds.includes(kind) const selected = draft.stimulus_component_kinds.includes(kind)
@ -282,35 +282,33 @@ export function QuestionTypeConfigStep({
onClick={() => handleStimulusKindClick(kind)} onClick={() => handleStimulusKindClick(kind)}
/> />
{selected && !isNoInputComponentKind(kind) ? ( {selected && !isNoInputComponentKind(kind) ? (
<div className="flex items-center justify-between gap-2 px-0.5 min-h-[32px]"> <div className="flex items-center justify-center gap-1.5 px-1 pt-1">
<span className="text-[12px] text-grayScale-500 font-medium"> <Button
{slotCount} slot{slotCount === 1 ? "" : "s"} 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> </span>
<div className="flex items-center gap-1"> <Button
<Button type="button"
type="button" variant="outline"
variant="ghost" size="sm"
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"
className="h-8 shrink-0 text-[12px] font-bold text-grayScale-600 hover:bg-grayScale-100" onClick={() => addStimulusSlot(kind)}
onClick={() => removeStimulusSlot(kind)} aria-label={`Add ${label} slot`}
disabled={slotCount === 0} >
aria-label={`Remove ${label} slot`} <Plus className="h-3 w-3 mr-1" />
> Add
<Minus className="h-3.5 w-3.5 mr-1" /> </Button>
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>
</div> </div>
) : null} ) : null}
</div> </div>
@ -332,7 +330,7 @@ export function QuestionTypeConfigStep({
each type needs. each type needs.
</p> </p>
</div> </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) => { {responseCatalogKinds.map((kind) => {
const { label, Icon } = getResponseKindPresentation(kind) const { label, Icon } = getResponseKindPresentation(kind)
const selected = draft.response_component_kinds.includes(kind) const selected = draft.response_component_kinds.includes(kind)
@ -346,35 +344,33 @@ export function QuestionTypeConfigStep({
onClick={() => handleResponseKindClick(kind)} onClick={() => handleResponseKindClick(kind)}
/> />
{selected && !isNoInputComponentKind(kind) ? ( {selected && !isNoInputComponentKind(kind) ? (
<div className="flex items-center justify-between gap-2 px-0.5 min-h-[32px]"> <div className="flex items-center justify-center gap-1.5 px-1 pt-1">
<span className="text-[12px] text-grayScale-500 font-medium"> <Button
{slotCount} slot{slotCount === 1 ? "" : "s"} 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> </span>
<div className="flex items-center gap-1"> <Button
<Button type="button"
type="button" variant="outline"
variant="ghost" size="sm"
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"
className="h-8 shrink-0 text-[12px] font-bold text-grayScale-600 hover:bg-grayScale-100" onClick={() => addResponseSlot(kind)}
onClick={() => removeResponseSlot(kind)} aria-label={`Add ${label} slot`}
disabled={slotCount === 0} >
aria-label={`Remove ${label} slot`} <Plus className="h-3 w-3 mr-1" />
> Add
<Minus className="h-3.5 w-3.5 mr-1" /> </Button>
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>
</div> </div>
) : null} ) : null}
</div> </div>
@ -396,11 +392,11 @@ export function QuestionTypeConfigStep({
errors={errors} 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 <button
type="button" type="button"
onClick={() => setAdvancedOpen((o) => !o)} 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) Advanced: edit schema rows (optional)
{advancedOpen ? ( {advancedOpen ? (
@ -410,7 +406,7 @@ export function QuestionTypeConfigStep({
)} )}
</button> </button>
{advancedOpen ? ( {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 <SchemaBuilderSection
title="Stimulus schema" title="Stimulus schema"
side="stimulus" side="stimulus"

View File

@ -103,10 +103,10 @@ export function QuestionTypeReviewPublishStep({
return ( return (
<div className="space-y-8 pb-32"> <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"> <div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 4: Review &amp; publish</h2> <h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 4: Review &amp; publish</h2>
<p className="text-grayScale-500 font-medium mt-1"> <p className="text-grayScale-500 dark:text-grayScale-400 font-medium mt-1">
{isEdit {isEdit
? "Confirm your changes and save. The definition key cannot be changed." ? "Confirm your changes and save. The definition key cannot be changed."
: "Confirm your definition, then save it for use when authoring practice questions."} : "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"> <dl className="grid grid-cols-1 sm:grid-cols-2 gap-4 text-sm">
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Key</dt> <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>
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Display name</dt> <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>
<div className="sm:col-span-2"> <div className="sm:col-span-2">
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Description</dt> <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>
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Groups</dt> <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>
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Status</dt> <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>
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Runtime type</dt> <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>
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Stimulus kinds</dt> <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>
<div> <div>
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Response kinds</dt> <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> </div>
</dl> </dl>
@ -193,7 +193,7 @@ export function QuestionTypeReviewPublishStep({
</div> </div>
</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 <Button
type="button" type="button"
variant="outline" variant="outline"
@ -218,14 +218,14 @@ function SchemaSlotSummary({
rows: { id: string; kind: string; label?: string; required: boolean }[] rows: { id: string; kind: string; label?: string; required: boolean }[]
}) { }) {
return ( 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> <h4 className="text-[12px] font-bold uppercase tracking-wide text-grayScale-500">{title}</h4>
{rows.length === 0 ? ( {rows.length === 0 ? (
<p className="mt-2 text-sm text-grayScale-500">No slots</p> <p className="mt-2 text-sm text-grayScale-500">No slots</p>
) : ( ) : (
<ul className="mt-2 space-y-1.5 text-sm"> <ul className="mt-2 space-y-1.5 text-sm">
{rows.map((r) => ( {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="font-medium">{slotLabel(r)}</span>
<span className="text-grayScale-400">·</span> <span className="text-grayScale-400">·</span>
<span className="font-mono text-[11px] text-grayScale-500">{r.id}</span> <span className="font-mono text-[11px] text-grayScale-500">{r.id}</span>

View File

@ -17,7 +17,7 @@ export function QuestionTypeStepFooter({
nextDisabled = false, nextDisabled = false,
}: QuestionTypeStepFooterProps) { }: QuestionTypeStepFooterProps) {
return ( 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"> <div className="flex items-center gap-2">
{onBack ? ( {onBack ? (
<Button <Button

View File

@ -69,10 +69,10 @@ export function QuestionTypeValidatePreviewStep({
return ( return (
<div className="space-y-8 pb-32"> <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"> <div className="p-10 border-b border-grayScale-200">
<h2 className="text-[20px] font-medium text-grayScale-900">STEP 3: Validate</h2> <h2 className="text-[20px] font-medium text-grayScale-900 dark:text-grayScale-600">STEP 3: Validate</h2>
<p className="text-grayScale-500 font-medium mt-1"> <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 We check that your stimulus and response selections are valid before you continue. You must pass
validation before review. validation before review.
</p> </p>

View File

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

View File

@ -46,7 +46,7 @@ function SlotLabelGroup({
return ( return (
<div className="space-y-3"> <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"> <div className="space-y-2">
{rows.map((row, index) => { {rows.map((row, index) => {
const presentation = const presentation =
@ -57,11 +57,11 @@ function SlotLabelGroup({
return ( return (
<div <div
key={`${side}-${row.id}-${index}`} 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 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"> <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="text-grayScale-300">·</span>
<span className="font-mono text-[11px]">{row.id}</span> <span className="font-mono text-[11px]">{row.id}</span>
</div> </div>
@ -91,7 +91,7 @@ function SlotLabelGroup({
value={row.label ?? ""} value={row.label ?? ""}
onChange={(e) => onChange(updateRowLabel(rows, index, e.target.value))} onChange={(e) => onChange(updateRowLabel(rows, index, e.target.value))}
placeholder={defaultLabelForKind(row.kind)} 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"> <p className="text-[11px] text-grayScale-400">
Shown to authors when they create questions from this type. Shown to authors when they create questions from this type.
@ -118,10 +118,10 @@ export function SchemaSlotLabelsPanel({
if (!stimulusRows.length && !responseRows.length) return null if (!stimulusRows.length && !responseRows.length) return null
return ( 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> <div>
<h3 className="text-[16px] font-bold text-grayScale-900">Field labels</h3> <h3 className="text-[16px] font-bold text-grayScale-900 dark:text-grayScale-600">Field labels</h3>
<p className="text-[13px] text-grayScale-500 mt-0.5"> <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 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. the definition and are not sent inside question payloads.
</p> </p>