Enable admin team invites, hide practice points/difficulty UI, and improve mobile layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Yared Yemane 2026-08-08 11:50:48 +03:00
parent 72384a5980
commit 283ef1ee40
31 changed files with 214 additions and 238 deletions

View File

@ -14,7 +14,7 @@ export function FullPanelOnly({ children, fallback = null }: GateProps) {
return <>{children}</>
}
/** Renders children only for Super Admin (e.g. team email invites). */
/** Renders children only for Admin / Super Admin (e.g. team email invites). */
export function SuperAdminOnly({ children, fallback = null }: GateProps) {
const { canInviteTeam } = useAdminAccess()
if (!canInviteTeam) return <>{fallback}</>

View File

@ -13,8 +13,16 @@ export function AdminTableContainer({
minWidth,
}: AdminTableContainerProps) {
return (
<div className={cn("min-w-0 overflow-x-auto rounded-lg border border-grayScale-100", className)}>
<div style={minWidth ? { minWidth } : undefined} className={minWidth ? undefined : "min-w-0"}>
<div
className={cn(
"min-w-0 overflow-x-auto overscroll-x-contain rounded-lg border border-grayScale-100 [-webkit-overflow-scrolling:touch]",
className,
)}
>
<div
style={minWidth ? { minWidth } : undefined}
className={minWidth ? "inline-block min-w-full align-middle" : "min-w-0"}
>
{children}
</div>
</div>

View File

@ -47,7 +47,9 @@ export function AdminFiltersPanel({
)}
>
<div className="flex flex-wrap items-center gap-3 p-4">
{search ? <div className="min-w-[200px] flex-1">{search}</div> : null}
{search ? (
<div className="min-w-0 w-full flex-1 sm:min-w-[200px]">{search}</div>
) : null}
{inlineActions ? (
<div className="h-9 shrink-0">{actions}</div>
) : (

View File

@ -32,7 +32,7 @@ const DialogContent = React.forwardRef<
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-card p-6 text-card-foreground shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",
"fixed left-[50%] top-[50%] z-50 grid w-[calc(100%-1.5rem)] max-w-lg max-h-[min(90dvh,calc(100dvh-2rem))] translate-x-[-50%] translate-y-[-50%] gap-4 overflow-y-auto overscroll-contain border border-border bg-card p-4 text-card-foreground shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg sm:w-full sm:p-6",
className,
)}
{...props}

View File

@ -7,49 +7,71 @@ export interface StepperProps {
}
export function Stepper({ steps, currentStep, className }: StepperProps) {
const safeCurrent = Math.min(Math.max(currentStep, 1), Math.max(steps.length, 1));
const currentLabel = steps[safeCurrent - 1] ?? "";
return (
<div className={cn("flex w-full items-start justify-between", className)}>
{steps.map((step, index) => {
const stepNumber = index + 1;
const isCurrent = stepNumber === currentStep;
<div className={cn("w-full min-w-0", className)}>
{/* Compact mobile summary */}
<div className="mb-3 flex items-center justify-between gap-3 sm:hidden">
<p className="min-w-0 truncate text-sm font-semibold text-brand-600">
{currentLabel}
</p>
<p className="shrink-0 text-xs font-medium text-grayScale-400">
Step {safeCurrent} of {steps.length}
</p>
</div>
return (
<div
key={step}
className="flex-1 relative flex flex-col items-center group"
>
{/* Connector Line - floats between circles with gap on both sides */}
{index < steps.length - 1 && (
<div
className="absolute top-4 h-[1.5px] bg-grayScale-200 dark:bg-grayScale-300 z-0"
style={{ left: "calc(50% + 50px)", right: "calc(-50% + 50px)" }}
/>
)}
<div className="flex w-full min-w-0 items-start justify-between gap-1 sm:gap-0">
{steps.map((step, index) => {
const stepNumber = index + 1;
const isCurrent = stepNumber === safeCurrent;
const isComplete = stepNumber < safeCurrent;
{/* Circle */}
return (
<div
className={cn(
"relative z-10 grid h-8 w-8 place-items-center rounded-full border-2 text-sm font-bold transition-all duration-300 mb-3",
isCurrent
? "border-brand-500 bg-brand-500 text-white shadow-md scale-110"
: "border-grayScale-100 dark:border-grayScale-300 bg-white dark:bg-grayScale-100 text-grayScale-400 dark:text-grayScale-500 font-medium",
)}
key={`${step}-${stepNumber}`}
className="relative flex min-w-0 flex-1 flex-col items-center"
>
{stepNumber}
</div>
{index < steps.length - 1 ? (
<div
className={cn(
"absolute top-3.5 z-0 h-[1.5px] sm:top-4",
isComplete ? "bg-brand-400" : "bg-grayScale-200 dark:bg-grayScale-300",
)}
style={{ left: "calc(50% + 1rem)", right: "calc(-50% + 1rem)" }}
aria-hidden
/>
) : null}
{/* Label */}
<span
className={cn(
"relative z-10 text-[12px] font-bold transition-colors duration-300",
isCurrent ? "text-brand-500" : "text-grayScale-400 dark:text-grayScale-500 font-medium",
)}
>
{step}
</span>
</div>
);
})}
<div
className={cn(
"relative z-10 mb-2 grid h-7 w-7 place-items-center rounded-full border-2 text-xs font-bold transition-all duration-300 sm:mb-3 sm:h-8 sm:w-8 sm:text-sm",
isCurrent
? "scale-105 border-brand-500 bg-brand-500 text-white shadow-md sm:scale-110"
: isComplete
? "border-brand-400 bg-brand-50 text-brand-600"
: "border-grayScale-100 bg-white font-medium text-grayScale-400 dark:border-grayScale-300 dark:bg-grayScale-100 dark:text-grayScale-500",
)}
aria-current={isCurrent ? "step" : undefined}
>
{stepNumber}
</div>
<span
className={cn(
"relative z-10 hidden max-w-full px-0.5 text-center text-[11px] font-bold leading-tight transition-colors duration-300 sm:line-clamp-2 sm:block sm:text-[12px]",
isCurrent
? "text-brand-500"
: "font-medium text-grayScale-400 dark:text-grayScale-500",
)}
>
{step}
</span>
</div>
);
})}
</div>
</div>
);
}

View File

@ -12,7 +12,7 @@ export const Table = React.forwardRef<HTMLTableElement, TableProps>(
<table ref={ref} className={cn("w-full caption-bottom text-sm", className)} {...props} />
)
if (noWrapper) return table
return <div className="relative w-full min-w-0 overflow-auto">{table}</div>
return <div className="relative w-full min-w-0 overflow-auto overscroll-x-contain [-webkit-overflow-scrolling:touch]">{table}</div>
},
)
Table.displayName = "Table"
@ -53,7 +53,7 @@ export const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttr
({ className, ...props }, ref) => (
<th
ref={ref}
className={cn("h-11 px-4 text-left align-middle text-xs font-semibold text-grayScale-500 [&:has([role=checkbox])]:pr-0", className)}
className={cn("h-11 px-3 text-left align-middle text-xs font-semibold text-grayScale-500 sm:px-4 [&:has([role=checkbox])]:pr-0", className)}
{...props}
/>
),
@ -62,7 +62,7 @@ TableHead.displayName = "TableHead"
export const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
({ className, ...props }, ref) => (
<td ref={ref} className={cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className)} {...props} />
<td ref={ref} className={cn("p-3 align-middle sm:p-4 [&:has([role=checkbox])]:pr-0", className)} {...props} />
),
)
TableCell.displayName = "TableCell"

View File

@ -38,6 +38,15 @@ export function AppLayout() {
setSidebarOpen(false)
}, [])
useEffect(() => {
if (!sidebarOpen) return
const previous = document.body.style.overflow
document.body.style.overflow = "hidden"
return () => {
document.body.style.overflow = previous
}
}, [sidebarOpen])
useEffect(() => {
const container = mainRef.current
if (!container) return
@ -100,8 +109,8 @@ export function AppLayout() {
>
<Outlet />
</main>
<footer className="shrink-0 border-t bg-grayScale-50 px-4 py-3 lg:px-6">
<div className="flex items-center justify-center gap-1.5 text-xs text-grayScale-400">
<footer className="shrink-0 border-t bg-grayScale-50 px-3 py-2.5 sm:px-4 sm:py-3 lg:px-6">
<div className="flex flex-wrap items-center justify-center gap-x-1.5 gap-y-0.5 text-[11px] text-grayScale-400 sm:text-xs">
<span>Powered by</span>
<a
href="https://yimaruacademy.com"
@ -111,7 +120,7 @@ export function AppLayout() {
>
Yimaru Academy
</a>
<span>·</span>
<span aria-hidden>·</span>
<span>© {new Date().getFullYear()}</span>
</div>
</footer>

View File

@ -29,7 +29,7 @@ export function isContentManagerRole(role?: string): boolean {
}
export function canSendTeamInvitations(role?: string): boolean {
return normalizedTeamRole(role) === "SUPER_ADMIN"
return FULL_PANEL_TEAM_ROLES.has(normalizedTeamRole(role))
}
export function isPathAllowedForTeamRole(pathname: string, role?: string): boolean {

View File

@ -20,8 +20,10 @@ function normalizeQuestionRow(question: PracticeFormState["questions"][number])
stimulusBlockKey: question.stimulusBlockKey ?? null,
questionTypeDefinitionId: question.questionTypeDefinitionId ?? null,
text: String(question.text ?? "").trim(),
difficultyLevel: question.difficultyLevel,
points: Number(question.points),
difficultyLevel: question.difficultyLevel ?? "EASY",
points: Number.isFinite(Number(question.points)) && Number(question.points) > 0
? Number(question.points)
: 1,
dynamicFieldValues: question.dynamicFieldValues ?? {},
mcqOptions: (question.mcqOptions ?? []).map((option) => ({
text: String(option.text ?? "").trim(),

View File

@ -56,8 +56,8 @@ export interface PracticeFormQuestionRow {
stimulusBlockKey: string | null
questionTypeDefinitionId: number | null
text: string
difficultyLevel: "EASY" | "MEDIUM" | "HARD"
points: number
difficultyLevel?: "EASY" | "MEDIUM" | "HARD"
points?: number
dynamicFieldValues: Record<string, string>
sourceDynamicPayload?: DynamicQuestionPayload | null
mcqOptions: { text: string; isCorrect: boolean }[]
@ -641,8 +641,6 @@ export function mapPracticeFullToFormState(
stimulusBlockKey: null,
questionTypeDefinitionId: typeDefinitions[0]?.id ?? null,
text: "",
difficultyLevel: "EASY" as const,
points: 1,
dynamicFieldValues: typeDefinitions[0]
? emptyDynamicFieldValuesForDefinition(typeDefinitions[0])
: {},

View File

@ -243,8 +243,6 @@ export function AddPracticeFlow() {
stimulusBlockKey: null as string | null,
questionTypeDefinitionId: null as number | null,
text: "",
difficultyLevel: "EASY" as "EASY" | "MEDIUM" | "HARD",
points: 1,
dynamicFieldValues: {} as Record<string, string>,
mcqOptions: [
{ text: "", isCorrect: true },
@ -576,8 +574,6 @@ export function AddPracticeFlow() {
questionTypeDefinitionId:
typeDefinitions[0]?.id ?? (null as number | null),
text: "",
difficultyLevel: "EASY" as "EASY" | "MEDIUM" | "HARD",
points: 1,
dynamicFieldValues: typeDefinitions[0]
? emptyDynamicFieldValuesForDefinition(typeDefinitions[0])
: {},
@ -750,26 +746,26 @@ export function AddPracticeFlow() {
};
return (
<div className="space-y-8 px-6 pb-16 pt-6">
<div className="mx-auto max-w-7xl w-full">
<div className="flex items-center justify-between mb-8">
<div className="space-y-6 px-0 pb-12 pt-2 sm:space-y-8 sm:px-2 sm:pb-16 sm:pt-4">
<div className="mx-auto w-full max-w-7xl min-w-0">
<div className="mb-6 flex items-center justify-between sm:mb-8">
<PageBackLink fallbackTo={backPath} label={backLabel} />
</div>
<div className=" mb-10">
<div className="flex items-center justify-between">
<h1 className="text-3xl font-bold text-[#0F172A]">
<div className="mb-8 sm:mb-10">
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
<h1 className="text-2xl font-bold text-[#0F172A] sm:text-3xl">
{isFromQuestionType ? "Create Practice from Question Type" : "Add New Practice"}
</h1>
<Button
variant="outline"
className="rounded-[8px] border-grayScale-200 text-grayScale-600 h-10 px-6 font-bold bg-white hover:bg-grayScale-50"
className="h-10 w-full rounded-[8px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
onClick={goBack}
>
Cancel
</Button>
</div>
<p className="text-grayScale-400 text-base">
<p className="mt-1 text-sm text-grayScale-400 sm:text-base">
{isFromQuestionType
? `Build a practice using ${seededQuestionType?.display_name ?? "the selected question type"}. Locations are optional — attach courses, modules, or lessons later.`
: "Create a practice with story details, a persona, and questions from your question type library."}
@ -813,12 +809,12 @@ export function AddPracticeFlow() {
) : null}
</div>
<div className="mx-auto w-[70%] mb-12">
<div className="mx-auto mb-8 w-full max-w-3xl sm:mb-12">
<Stepper steps={[...STEP_LABELS]} currentStep={currentStep} />
</div>
<div
className={`mx-auto ${currentStep === 3 || currentStep === 4 ? "max-w-6xl" : "max-w-4xl"}`}
className={`mx-auto min-w-0 ${currentStep === 3 || currentStep === 4 ? "max-w-6xl" : "max-w-4xl"}`}
>
{renderStep()}
</div>

View File

@ -186,31 +186,31 @@ export function AddVideoFlow() {
}
return (
<div className="space-y-8 pb-32 px-6 pt-6 min-h-screen ">
<div className="mx-auto max-w-7xl w-full">
<div className="flex items-center justify-between mb-8">
<div className="min-h-screen space-y-6 px-0 pb-24 pt-2 sm:space-y-8 sm:px-2 sm:pb-32 sm:pt-4">
<div className="mx-auto w-full max-w-7xl min-w-0">
<div className="mb-6 flex flex-col gap-3 sm:mb-8 sm:flex-row sm:items-center sm:justify-between">
<PageBackLink fallbackTo={backPath} label="Back to module" className="text-grayScale-500" />
<Button
variant="outline"
className="rounded-[8px] border-grayScale-200 text-grayScale-600 h-10 px-6 font-bold bg-white hover:bg-grayScale-50"
className="h-10 w-full rounded-[8px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
onClick={goBack}
>
Cancel
</Button>
</div>
<h1 className="text-2xl font-bold text-[#0F172A] mb-10">
<h1 className="mb-8 text-2xl font-bold text-[#0F172A] sm:mb-10">
Add new lesson
</h1>
<div className="mx-auto max-w-4xl mb-12">
<div className="mx-auto mb-8 w-full max-w-3xl sm:mb-12">
<Stepper
steps={STEPS.map((s) => s.label)}
currentStep={currentStep}
/>
</div>
<div className="mx-auto max-w-7xl">
<div className="mx-auto min-w-0 max-w-7xl">
{currentStep === 1 && (
<VideoDetailStep
key={formResetKey}

View File

@ -145,13 +145,13 @@ export function AttachPracticeFlow() {
: "Verify practice details before publishing it.";
return (
<div className="space-y-8 pb-32 px-6 pt-10 min-h-screen animate-in fade-in duration-500">
<div className="mx-auto w-full">
<div className="min-h-screen animate-in fade-in space-y-6 px-0 pb-24 pt-4 duration-500 sm:space-y-8 sm:px-2 sm:pb-32 sm:pt-8">
<div className="mx-auto w-full min-w-0 max-w-7xl">
{/* Navigation Breadcrumb */}
<div className="flex items-center justify-between mb-12">
<div className="mb-8 flex items-center justify-between sm:mb-12">
<Link
to={backPath}
className="flex items-center gap-2 text-[15px] font-bold text-grayScale-600 transition-colors hover:text-brand-500 group"
className="group flex items-center gap-2 text-[15px] font-bold text-grayScale-600 transition-colors hover:text-brand-500"
>
<ArrowLeft className="h-5 w-5 transition-transform group-hover:-translate-x-1" />
Back to Videos
@ -159,34 +159,34 @@ export function AttachPracticeFlow() {
</div>
{/* Stepper Area */}
<div className="mb-20 w-full pointer-events-none">
<div className="pointer-events-none mb-10 w-full max-w-3xl sm:mb-16">
<Stepper steps={steps} currentStep={currentStep} />
</div>
{/* Page Title & Header Actions */}
<div className="mb-10 flex items-start justify-between">
<div className="">
<h1 className="text-[30px] font-bold text-[#0D1421] ">{title}</h1>
<p className="text-grayScale-400 text-[16px] font-medium ">
<div className="mb-8 flex flex-col gap-4 sm:mb-10 sm:flex-row sm:items-start sm:justify-between">
<div className="min-w-0">
<h1 className="text-2xl font-bold text-[#0D1421] sm:text-[30px]">{title}</h1>
<p className="text-sm font-medium text-grayScale-400 sm:text-[16px]">
{description}
</p>
</div>
<div className="flex items-center gap-3">
<div className="flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3">
<Button
variant="outline"
className="h-10 px-8 rounded-[6px] border-grayScale-100 text-grayScale-600 font-bold bg-white hover:bg-grayScale-50 shadow-sm"
className="h-10 w-full rounded-[6px] border-grayScale-100 bg-white px-8 font-bold text-grayScale-600 shadow-sm hover:bg-grayScale-50 sm:w-auto"
onClick={() => navigate(backPath)}
>
Cancel
</Button>
<Button className="h-10 px-8 rounded-[6px] bg-[#9E2891] font-bold text-white shadow-md hover:bg-[#8A237E] transition-all">
<Button className="h-10 w-full rounded-[6px] bg-[#9E2891] px-8 font-bold text-white shadow-md transition-all hover:bg-[#8A237E] sm:w-auto">
Save as Draft
</Button>
</div>
</div>
{/* Form Content */}
<div className="w-full">{renderStep()}</div>
<div className="w-full min-w-0">{renderStep()}</div>
</div>
</div>
);

View File

@ -105,13 +105,13 @@ export function AttachProgramPracticeFlow() {
: "Verify practice details before publishing it.";
return (
<div className="space-y-8 px-6 pt-10 min-h-screen animate-in fade-in duration-500">
<div className=" w-full">
<div className="min-h-screen animate-in fade-in space-y-6 px-0 pt-4 duration-500 sm:space-y-8 sm:px-2 sm:pt-8">
<div className="mx-auto w-full min-w-0 max-w-7xl">
{/* Navigation Breadcrumb */}
<div className="flex items-center justify-between mb-12">
<div className="mb-8 flex items-center justify-between sm:mb-12">
<Link
to={backPath}
className="flex items-center gap-2 text-[15px] font-bold text-grayScale-600 transition-colors hover:text-brand-500 group"
className="group flex items-center gap-2 text-[15px] font-bold text-grayScale-600 transition-colors hover:text-brand-500"
>
<ArrowLeft className="h-5 w-5 transition-transform group-hover:-translate-x-1" />
Back to Program
@ -119,20 +119,20 @@ export function AttachProgramPracticeFlow() {
</div>
{/* Stepper Area */}
<div className="mb-20 pointer-events-none">
<div className="pointer-events-none mb-10 max-w-3xl sm:mb-16">
<Stepper steps={steps} currentStep={currentStep} />
</div>
{/* Page Title & Header Actions */}
<div className="mb-10 flex items-start justify-between">
<div className="">
<h1 className="text-[30px] font-bold text-[#0D1421] ">{title}</h1>
<p className="text-grayScale-500 text-[14px]">{description}</p>
<div className="mb-8 flex flex-col gap-4 sm:mb-10 sm:flex-row sm:items-start sm:justify-between">
<div className="min-w-0">
<h1 className="text-2xl font-bold text-[#0D1421] sm:text-[30px]">{title}</h1>
<p className="text-sm text-grayScale-500 sm:text-[14px]">{description}</p>
</div>
<div className="flex items-center gap-3">
<div className="flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3">
<Button
variant="outline"
className="h-10 px-8 rounded-[6px] border-grayScale-100 text-grayScale-600 font-bold bg-white hover:bg-grayScale-50 shadow-sm"
className="h-10 w-full rounded-[6px] border-grayScale-100 bg-white px-8 font-bold text-grayScale-600 shadow-sm hover:bg-grayScale-50 sm:w-auto"
onClick={() => navigate(backPath)}
>
Cancel

View File

@ -3,11 +3,11 @@ import { Outlet } from "react-router-dom";
export function ContentManagementLayout() {
return (
<div className="mx-auto w-full min-w-0 max-w-7xl px-0 py-4 sm:px-4 sm:py-6 lg:px-6">
<div className="mb-8">
<div className="mb-8 flex items-center gap-3">
<div className="h-9 w-1 rounded-full bg-gradient-to-b from-brand-500 to-brand-600" />
<div>
<h1 className="text-2xl font-bold tracking-tight text-grayScale-900 sm:text-[1.65rem]">
<div className="mb-6 sm:mb-8">
<div className="mb-6 flex items-center gap-3 sm:mb-8">
<div className="h-9 w-1 shrink-0 rounded-full bg-gradient-to-b from-brand-500 to-brand-600" />
<div className="min-w-0">
<h1 className="text-xl font-bold tracking-tight text-grayScale-900 sm:text-2xl sm:text-[1.65rem]">
Content Management
</h1>
<p className="mt-1 max-w-2xl text-sm leading-relaxed text-grayScale-500">

View File

@ -346,7 +346,7 @@ export function CreateQuestionTypeFlow() {
<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 dark:bg-grayScale-50 backdrop-blur">
<div className="max-w-[1440px] mx-auto py-6 px-4 sm:px-6">
<div className="flex items-center justify-between mb-8">
<div className="mb-6 flex items-center justify-between sm:mb-8">
<PageBackLink
fallbackTo="/new-content/question-types"
label="Back to Question Type Library"
@ -354,27 +354,27 @@ export function CreateQuestionTypeFlow() {
/>
</div>
<div className="flex flex-col lg:flex-row lg:items-start lg:justify-between gap-6">
<div className="space-y-1">
<h1 className="text-[28px] font-bold text-grayScale-900 dark:text-grayScale-600 tracking-tight">
<div className="flex flex-col gap-4 lg:flex-row lg:items-start lg:justify-between lg:gap-6">
<div className="min-w-0 space-y-1">
<h1 className="text-2xl font-bold tracking-tight text-grayScale-900 dark:text-grayScale-600 sm:text-[28px]">
{isEdit ? "Edit question type definition" : "Create question type definition"}
</h1>
<p className="text-grayScale-500 dark:text-grayScale-400 text-[14px] font-medium max-w-2xl">
<p className="max-w-2xl text-[14px] font-medium text-grayScale-500 dark:text-grayScale-400">
{isEdit
? `Update reusable question type definition #${editDefinitionId}.`
: "Build a reusable question type template for dynamic practice and assessment questions."}
</p>
</div>
<div className="flex items-center gap-4 shrink-0">
<div className="flex w-full flex-col-reverse gap-2 sm:flex-row sm:items-center sm:gap-3 lg:w-auto lg:shrink-0">
<Button
variant="outline"
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"
className="h-10 w-full rounded-[6px] border-grayScale-200 px-8 font-medium text-grayScale-900 hover:bg-grayScale-50 dark:text-grayScale-600 dark:hover:bg-grayScale-100 sm:w-auto"
onClick={() => navigate("/new-content/question-types")}
>
Cancel
</Button>
<Button
className="h-10 px-8 rounded-[6px] bg-[#9E2891] font-medium text-white shadow-lg shadow-brand-500/10 hover:bg-[#8A237E] transition-all"
className="h-10 w-full rounded-[6px] bg-[#9E2891] px-8 font-medium text-white shadow-lg shadow-brand-500/10 transition-all hover:bg-[#8A237E] sm:w-auto"
onClick={() => void handleHeaderSaveDraft()}
disabled={saving || (isEdit && !hasUnsavedChanges)}
>

View File

@ -280,8 +280,6 @@ export function EditPracticeFlow() {
stimulusBlockKey: null as string | null,
questionTypeDefinitionId: null as number | null,
text: "",
difficultyLevel: "EASY" as "EASY" | "MEDIUM" | "HARD",
points: 1,
dynamicFieldValues: {} as Record<string, string>,
mcqOptions: [
{ text: "", isCorrect: true },
@ -740,18 +738,26 @@ export function EditPracticeFlow() {
};
return (
<div className="space-y-8 px-6 pb-16 pt-6">
<div className="mx-auto max-w-7xl w-full">
<div className="flex items-center justify-between mb-8">
<div className="space-y-6 px-0 pb-12 pt-2 sm:space-y-8 sm:px-2 sm:pb-16 sm:pt-4">
<div className="mx-auto w-full max-w-7xl min-w-0">
<div className="mb-6 flex items-center justify-between sm:mb-8">
<PageBackLink fallbackTo={backPath} label={backLabel} />
</div>
<div className="mb-10">
<div className="flex items-center justify-between gap-4">
<h1 className="text-3xl font-bold text-[#0F172A]">Edit Practice</h1>
<div className="flex shrink-0 items-center gap-3">
<div className="mb-8 sm:mb-10">
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
<h1 className="text-2xl font-bold text-[#0F172A] sm:text-3xl">Edit Practice</h1>
<div className="flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-3">
<Button
className="h-10 rounded-[8px] bg-brand-500 px-6 font-bold text-white shadow-md shadow-brand-500/20 hover:bg-brand-600 disabled:opacity-50"
variant="outline"
className="h-10 w-full rounded-[8px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
disabled={submitting}
onClick={() => goBack()}
>
Cancel
</Button>
<Button
className="h-10 w-full rounded-[8px] bg-brand-500 px-6 font-bold text-white shadow-md shadow-brand-500/20 hover:bg-brand-600 disabled:opacity-50 sm:w-auto"
disabled={submitting || !hasUnsavedChanges}
onClick={handleSaveChanges}
>
@ -764,27 +770,19 @@ export function EditPracticeFlow() {
"Save changes"
)}
</Button>
<Button
variant="outline"
className="h-10 rounded-[8px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50"
disabled={submitting}
onClick={() => goBack()}
>
Cancel
</Button>
</div>
</div>
<p className="text-grayScale-400 text-base">
<p className="mt-1 text-sm text-grayScale-400 sm:text-base">
Update story details, persona, and questions for practice #{practiceId}.
</p>
</div>
<div className="mx-auto w-[70%] mb-12">
<div className="mx-auto mb-8 w-full max-w-3xl sm:mb-12">
<Stepper steps={[...STEP_LABELS]} currentStep={currentStep} />
</div>
<div
className={`mx-auto ${currentStep === 3 || currentStep === 4 ? "max-w-6xl" : "max-w-4xl"}`}
className={`mx-auto min-w-0 ${currentStep === 3 || currentStep === 4 ? "max-w-6xl" : "max-w-4xl"}`}
>
{renderStep()}
</div>

View File

@ -252,24 +252,24 @@ export function LinkExistingPracticeFlow() {
}
return (
<div className="space-y-8 px-6 pb-16 pt-6">
<div className="mx-auto w-full max-w-7xl">
<div className="mb-8 flex items-center justify-between">
<div className="space-y-6 px-0 pb-12 pt-2 sm:space-y-8 sm:px-2 sm:pb-16 sm:pt-4">
<div className="mx-auto w-full max-w-7xl min-w-0">
<div className="mb-6 flex items-center justify-between sm:mb-8">
<PageBackLink fallbackTo={backPath} label={backLabel} />
</div>
<div className="mb-10">
<div className="flex items-center justify-between">
<h1 className="text-3xl font-bold text-[#0F172A]">Attach Existing Practice</h1>
<div className="mb-8 sm:mb-10">
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between sm:gap-4">
<h1 className="text-2xl font-bold text-[#0F172A] sm:text-3xl">Attach Existing Practice</h1>
<Button
variant="outline"
className="h-10 rounded-[8px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50"
className="h-10 w-full rounded-[8px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
onClick={goBack}
>
Cancel
</Button>
</div>
<p className="text-base text-grayScale-400">
<p className="mt-1 text-sm text-grayScale-400 sm:text-base">
Browse your practice library and link an existing practice to this content location.
</p>
<div className="mt-4 rounded-xl border border-violet-200 bg-violet-50/80 px-4 py-3 text-sm text-violet-950">
@ -287,11 +287,11 @@ export function LinkExistingPracticeFlow() {
</div>
</div>
<div className="mx-auto mb-12 w-[70%] max-w-md">
<div className="mx-auto mb-8 w-full max-w-3xl sm:mb-12">
<Stepper steps={[...STEP_LABELS]} currentStep={currentStep} />
</div>
<div className="mx-auto max-w-4xl">
<div className="mx-auto min-w-0 max-w-4xl">
{currentStep === 1 ? (
<SelectPracticeToAttachStep
isExamPrep={isExamPrep}

View File

@ -186,18 +186,18 @@ export function AttachPracticeReviewStep({
</div>
{/* 4. Action Footer */}
<div className="flex items-center justify-between pt-10 px-2">
<div className="flex flex-col-reverse gap-3 px-0 pt-8 sm:flex-row sm:items-center sm:justify-between sm:px-2 sm:pt-10">
<Button
onClick={prevStep}
variant="outline"
className="h-12 px-10 rounded-[6px] bg-transparent border-grayScale-400 font-bold text-grayScale-600 transition-all"
className="h-12 w-full rounded-[6px] border-grayScale-400 bg-transparent px-10 font-bold text-grayScale-600 transition-all sm:w-auto"
>
Back
</Button>
<div className="flex gap-4">
<div className="flex w-full flex-col gap-3 sm:w-auto sm:flex-row sm:gap-4">
<Button
variant="outline"
className="h-12 px-10 rounded-[6px] border-grayScale-200 font-bold text-grayScale-600 bg-white shadow-none transition-all"
className="h-12 w-full rounded-[6px] border-grayScale-200 bg-white px-10 font-bold text-grayScale-600 shadow-none transition-all sm:w-auto"
>
Save as Draft
</Button>
@ -205,10 +205,10 @@ export function AttachPracticeReviewStep({
onClick={onPublish}
disabled={!isConfirmed}
className={cn(
"h-12 px-10 rounded-[6px] font-bold text-white shadow-xl flex items-center gap-3 transition-all active:scale-95",
"flex h-12 w-full items-center justify-center gap-3 rounded-[6px] px-10 font-bold text-white shadow-xl transition-all active:scale-95 sm:w-auto",
isConfirmed
? "bg-[#9E2891] hover:bg-[#8A237E] shadow-[#9E2891]/20"
: "bg-grayScale-200 cursor-not-allowed opacity-50",
? "bg-[#9E2891] shadow-[#9E2891]/20 hover:bg-[#8A237E]"
: "cursor-not-allowed bg-grayScale-200 opacity-50",
)}
>
<Rocket className="h-5 w-5" />

View File

@ -148,7 +148,7 @@ export function AttachPracticeStep1({
</div>
</div>
<div className="flex items-center justify-between border-t border-grayScale-200 bg-[#F8FAFC] py-4 px-12">
<div className="flex flex-col-reverse gap-3 border-t border-grayScale-200 bg-[#F8FAFC] px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-8">
<button
className="text-[14px] text-grayScale-500 transition-colors hover:text-grayScale-700"
onClick={onCancel}
@ -157,7 +157,7 @@ export function AttachPracticeStep1({
</button>
<Button
onClick={nextStep}
className="h-10 px-12 rounded-[6px] bg-[#9E2891] text-[14px] font-bold text-white shadow-lg shadow-brand-500/10 transition-all active:scale-95 flex items-center gap-3"
className="flex h-10 w-full items-center justify-center gap-3 rounded-[6px] bg-[#9E2891] px-8 text-[14px] font-bold text-white shadow-lg shadow-brand-500/10 transition-all active:scale-95 sm:w-auto sm:px-12"
>
Next: Review
<ArrowRight className="h-4 w-4" />

View File

@ -348,7 +348,7 @@ export function ContextStep({
</div>
</div>
<div className="flex items-center justify-between border-t border-grayScale-100 bg-[#F8FAFC] p-4 px-12">
<div className="flex flex-col-reverse gap-3 border-t border-grayScale-100 bg-[#F8FAFC] p-4 sm:flex-row sm:items-center sm:justify-between sm:px-8">
<button
type="button"
className="text-[14px] font-bold text-grayScale-500 transition-colors hover:text-grayScale-700"
@ -360,7 +360,7 @@ export function ContextStep({
type="button"
onClick={nextStep}
disabled={!canContinue}
className="h-10 px-10 rounded-[6px] bg-brand-500 text-[14px] font-bold text-white transition-all active:scale-95 flex items-center gap-2 disabled:opacity-50"
className="flex h-10 w-full items-center justify-center gap-2 rounded-[6px] bg-brand-500 px-8 text-[14px] font-bold text-white transition-all active:scale-95 disabled:opacity-50 sm:w-auto sm:px-10"
>
Next: Persona <ArrowRight className="h-5 w-5" />
</Button>

View File

@ -115,12 +115,12 @@ export function PersonaStep({
</div>
)}
<div className="flex items-center justify-between pt-8">
<div className="flex flex-col-reverse gap-3 pt-8 sm:flex-row sm:items-center sm:justify-between">
<Button
type="button"
onClick={prevStep}
variant="outline"
className="h-10 w-20 rounded-[6px] border-grayScale-200 text-grayScale-600"
className="h-10 w-full rounded-[6px] border-grayScale-200 text-grayScale-600 sm:w-20"
>
Back
</Button>
@ -128,7 +128,7 @@ export function PersonaStep({
type="button"
onClick={nextStep}
disabled={!selectedPersona || loading || personas.length === 0}
className="h-10 rounded-[6px] bg-brand-500 px-8 shadow-md shadow-brand-500/20 hover:bg-brand-600 disabled:opacity-50"
className="h-10 w-full rounded-[6px] bg-brand-500 px-8 shadow-md shadow-brand-500/20 hover:bg-brand-600 disabled:opacity-50 sm:w-auto"
>
Next: Questions <ArrowRight className="ml-2 h-4 w-4" />
</Button>

View File

@ -75,17 +75,17 @@ export function ProgramAttachReviewStep({
</div>
{/* Footer Actions */}
<div className="flex bg-[#F8FAFC] border border-grayScale-200 items-center rounded-[12px] justify-between py-4 px-6">
<div className="flex flex-col-reverse gap-3 rounded-[12px] border border-grayScale-200 bg-[#F8FAFC] px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-6">
<Button
onClick={onCancel}
variant="outline"
className="h-10 px-6 rounded-[6px] border-grayScale-100 font-bold text-grayScale-500 bg-white hover:bg-grayScale-50 transition-all text-lg"
className="h-10 w-full rounded-[6px] border-grayScale-100 bg-white px-6 text-lg font-bold text-grayScale-500 transition-all hover:bg-grayScale-50 sm:w-auto"
>
Cancel
</Button>
<Button
onClick={onPublish}
className="h-10 px-10 rounded-[6px] bg-[#9E2891] text-[16px] font-medium text-white transition-all active:scale-95 flex items-center gap-3"
className="flex h-10 w-full items-center justify-center gap-3 rounded-[6px] bg-[#9E2891] px-10 text-[16px] font-medium text-white transition-all active:scale-95 sm:w-auto"
>
Next: Review & Publish
<ArrowRight className="h-4 w-4" />

View File

@ -121,7 +121,7 @@ export function ProgramAttachStep1({
</button>
</div>
<div className="flex items-center justify-between border-t border-grayScale-200 bg-[#F8FAFC] py-4 px-12">
<div className="flex flex-col-reverse gap-3 border-t border-grayScale-200 bg-[#F8FAFC] px-4 py-4 sm:flex-row sm:items-center sm:justify-between sm:px-8">
<button
className="text-[14px] text-grayScale-500 transition-colors hover:text-grayScale-700"
onClick={onCancel}
@ -130,7 +130,7 @@ export function ProgramAttachStep1({
</button>
<Button
onClick={nextStep}
className="h-10 px-12 rounded-[6px] bg-[#9E2891] text-[14px] font-bold text-white shadow-lg shadow-brand-500/10 transition-all active:scale-95 flex items-center gap-3"
className="flex h-10 w-full items-center justify-center gap-3 rounded-[6px] bg-[#9E2891] px-8 text-[14px] font-bold text-white shadow-lg shadow-brand-500/10 transition-all active:scale-95 sm:w-auto sm:px-12"
>
Next: Review
<ArrowRight className="h-4 w-4" />

View File

@ -77,8 +77,6 @@ function questionSummaryPreview(
text?: string;
dynamicFieldValues?: Record<string, string>;
questionTypeDefinitionId?: number | null;
difficultyLevel?: string;
points?: number;
},
def: QuestionTypeDefinition | undefined,
): string {
@ -186,8 +184,6 @@ function createEmptyQuestionRow(id: string, displayOrder = 1, inheritAnchor?: {
stimulusBlockKey: null as string | null,
questionTypeDefinitionId: null as number | null,
text: "",
difficultyLevel: "EASY" as "EASY" | "MEDIUM" | "HARD",
points: 1,
dynamicFieldValues: {} as Record<string, string>,
mcqOptions: defaultMcqOptions(),
trueFalseCorrect: true,
@ -781,9 +777,6 @@ export function QuestionsStep({
Bank #{q.serverQuestionId}
</span>
) : null}
<span className="rounded-full bg-grayScale-100 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wide text-grayScale-600">
{q.difficultyLevel ?? "EASY"}
</span>
<span className="rounded-full bg-sky-100 px-2.5 py-0.5 text-[11px] font-semibold text-sky-800">
{sectionBadgeLabel(q, formData.questions)}
</span>
@ -792,9 +785,6 @@ export function QuestionsStep({
{q.stimulusBlockKey}
</span>
) : null}
<span className="text-xs font-medium text-grayScale-500">
{q.points ?? 1} pt{(q.points ?? 1) === 1 ? "" : "s"}
</span>
</div>
<p className="text-xs font-medium text-brand-600">
{typeLabel}
@ -896,55 +886,6 @@ export function QuestionsStep({
</div>
) : null}
<div className="grid gap-4 sm:grid-cols-2">
<div className="space-y-2">
<label className="text-[10px] font-bold uppercase tracking-widest text-grayScale-700">
Difficulty
</label>
<select
className="h-11 w-full rounded-lg border border-grayScale-200 bg-white px-3 text-sm font-medium text-grayScale-800"
value={q.difficultyLevel ?? "EASY"}
onChange={(e) => {
const newQuestions = [...formData.questions];
newQuestions[i] = {
...newQuestions[i],
difficultyLevel: e.target.value as
| "EASY"
| "MEDIUM"
| "HARD",
};
setFormData({ ...formData, questions: newQuestions });
}}
>
<option value="EASY">Easy</option>
<option value="MEDIUM">Medium</option>
<option value="HARD">Hard</option>
</select>
</div>
<div className="space-y-2">
<label className="text-[10px] font-bold uppercase tracking-widest text-grayScale-700">
Points
</label>
<Input
type="number"
min={1}
step={1}
value={q.points ?? 1}
onChange={(e) => {
const newQuestions = [...formData.questions];
const parsed = Number.parseInt(e.target.value, 10);
newQuestions[i] = {
...newQuestions[i],
points:
Number.isFinite(parsed) && parsed > 0 ? parsed : 1,
};
setFormData({ ...formData, questions: newQuestions });
}}
className="h-11 rounded-lg border-grayScale-200"
/>
</div>
</div>
<div className="space-y-2">
<label className="text-[10px] font-bold uppercase tracking-widest text-grayScale-700">
Question type
@ -1090,12 +1031,12 @@ export function QuestionsStep({
typeDefinitions={typeDefinitions}
/>
<div className="flex items-center justify-between pt-8">
<div className="flex flex-col-reverse gap-3 pt-8 sm:flex-row sm:items-center sm:justify-between">
<Button
type="button"
onClick={prevStep}
variant="outline"
className="h-10 w-20 rounded-[6px] border-grayScale-200 font-bold text-grayScale-600 shadow-sm"
className="h-10 w-full rounded-[6px] border-grayScale-200 font-bold text-grayScale-600 shadow-sm sm:w-20"
>
Back
</Button>
@ -1157,7 +1098,7 @@ export function QuestionsStep({
nextStep();
}}
disabled={definitionsLoading || !!definitionsError || typeDefinitions.length === 0}
className="h-10 rounded-[6px] bg-brand-500 px-8 font-bold disabled:opacity-50"
className="h-10 w-full rounded-[6px] bg-brand-500 px-8 font-bold disabled:opacity-50 sm:w-auto"
>
Next: Review <ArrowRight className="ml-2 h-4 w-4" />
</Button>

View File

@ -334,10 +334,10 @@ export function SelectPracticeToAttachStep({
const footer = (
<div
className={cn(
"flex items-center justify-between border-t border-grayScale-100",
"flex flex-col-reverse gap-3 border-t border-grayScale-100 sm:flex-row sm:items-center sm:justify-between",
isDialog
? "bg-grayScale-50/60 px-5 py-3.5"
: "bg-[#F8FAFC] p-4 px-12",
? "bg-grayScale-50/60 px-4 py-3.5 sm:px-5"
: "bg-[#F8FAFC] px-4 py-4 sm:px-8",
)}
>
<button
@ -355,10 +355,10 @@ export function SelectPracticeToAttachStep({
disabled={!canContinue}
onClick={nextStep}
className={cn(
"bg-brand-500 font-bold text-white hover:bg-brand-600 disabled:opacity-50",
"w-full bg-brand-500 font-bold text-white hover:bg-brand-600 disabled:opacity-50 sm:w-auto",
isDialog
? "h-10 rounded-[6px] px-8 text-sm"
: "flex h-10 items-center gap-2 rounded-[6px] px-10 text-[14px] transition-all active:scale-95",
: "flex h-10 items-center justify-center gap-2 rounded-[6px] px-10 text-[14px] transition-all active:scale-95",
)}
>
Next: Review

View File

@ -17,17 +17,17 @@ export function QuestionTypeStepFooter({
nextDisabled = false,
}: QuestionTypeStepFooterProps) {
return (
<div className="px-4 py-4 border border-grayScale-200 flex flex-wrap items-center justify-between gap-3 bg-[#F8FAFC] dark:bg-grayScale-100">
<div className="flex flex-col-reverse gap-3 border border-grayScale-200 bg-[#F8FAFC] px-4 py-4 dark:bg-grayScale-100 sm:flex-row sm:flex-wrap sm:items-center sm:justify-between">
<div className="flex items-center gap-2">
{onBack ? (
<Button
type="button"
variant="outline"
className="h-10 px-6 rounded-[6px] border-none shadow-none text-grayScale-600 font-bold hover:bg-grayScale-100"
className="h-10 w-full rounded-[6px] border-none px-6 font-bold text-grayScale-600 shadow-none hover:bg-grayScale-100 sm:w-auto"
onClick={onBack}
disabled={saving}
>
<ArrowLeft className="h-4 w-4 mr-2 inline" />
<ArrowLeft className="mr-2 inline h-4 w-4" />
Back
</Button>
) : null}
@ -36,7 +36,7 @@ export function QuestionTypeStepFooter({
type="button"
onClick={onNext}
disabled={saving || nextDisabled}
className="h-10 px-10 rounded-[6px] bg-[#9E2891] font-medium text-white shadow-lg shadow-brand-500/10 hover:bg-[#8A237E] disabled:opacity-50 transition-all flex items-center gap-3"
className="flex h-10 w-full items-center justify-center gap-3 rounded-[6px] bg-[#9E2891] px-8 font-medium text-white shadow-lg shadow-brand-500/10 transition-all hover:bg-[#8A237E] disabled:opacity-50 sm:w-auto sm:px-10"
>
{nextLabel}
<ArrowRight className="h-5 w-5" />

View File

@ -346,7 +346,7 @@ export function RolesListPage({ embedded = false }: RolesListPageProps) {
{embedded
? canEditRoles
? "View and edit system roles and permissions."
: "View system roles and permissions. Only Super Admins can make changes."
: "View system roles and permissions. Only Admins can make changes."
: "Manage roles and their permissions."}
</p>
</div>

View File

@ -358,7 +358,7 @@ export function AppVersionsTab() {
) : null}
</div>
) : (
<div className="min-w-0 w-full max-w-full overflow-x-auto rounded-[8px] border border-grayScale-100">
<div className="min-w-0 w-full max-w-full overflow-x-auto overscroll-x-contain rounded-[8px] border border-grayScale-100 [-webkit-overflow-scrolling:touch]">
<table className="w-full min-w-[640px] text-left text-sm">
<thead>
<tr className="border-b border-grayScale-100 bg-grayScale-50/80 text-[11px] font-bold uppercase tracking-wider text-grayScale-400">

View File

@ -278,7 +278,7 @@ export function SubscriptionPlansTab() {
) : null}
</div>
) : (
<div className="min-w-0 w-full max-w-full overflow-x-auto rounded-[8px] border border-grayScale-100">
<div className="min-w-0 w-full max-w-full overflow-x-auto overscroll-x-contain rounded-[8px] border border-grayScale-100 [-webkit-overflow-scrolling:touch]">
<table className="w-full min-w-[800px] text-left text-sm">
<thead>
<tr className="border-b border-grayScale-100 bg-grayScale-50/80 text-[11px] font-bold uppercase tracking-wider text-grayScale-400">

View File

@ -214,7 +214,7 @@ export function TeamManagementPage() {
} catch (error) {
console.error("Failed to update member status:", error);
setToggledStatuses((prev) => ({ ...prev, [id]: previousActive }));
notifyApiError(err, "Failed to update team member status. Please try again.");
notifyApiError(error, "Failed to update team member status. Please try again.");
} finally {
setUpdating(false);
handleCancelConfirm();