Make client search cover the full dataset, restyle lesson practices, and unify admin button corners.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Yared Yemane 2026-08-13 16:26:50 +03:00
parent 4abc20d166
commit 8fa47328d4
97 changed files with 731 additions and 823 deletions

View File

@ -83,7 +83,7 @@ export function TablePagination({
onClick={() => onPageChange(Math.max(1, currentPage - 1))} onClick={() => onPageChange(Math.max(1, currentPage - 1))}
disabled={disabled || currentPage <= 1} disabled={disabled || currentPage <= 1}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
(disabled || currentPage <= 1) && "cursor-not-allowed opacity-50", (disabled || currentPage <= 1) && "cursor-not-allowed opacity-50",
)} )}
aria-label="Previous page" aria-label="Previous page"
@ -102,7 +102,7 @@ export function TablePagination({
disabled={disabled} disabled={disabled}
onClick={() => onPageChange(n)} onClick={() => onPageChange(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === currentPage n === currentPage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50", : "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -117,7 +117,7 @@ export function TablePagination({
onClick={() => onPageChange(Math.min(totalPages, currentPage + 1))} onClick={() => onPageChange(Math.min(totalPages, currentPage + 1))}
disabled={disabled || currentPage >= totalPages} disabled={disabled || currentPage >= totalPages}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
(disabled || currentPage >= totalPages) && "cursor-not-allowed opacity-50", (disabled || currentPage >= totalPages) && "cursor-not-allowed opacity-50",
)} )}
aria-label="Next page" aria-label="Next page"

View File

@ -165,7 +165,7 @@ export function AnalyticsTimeRangeFilter({ value, onChange, className }: Analyti
<button <button
type="button" type="button"
onClick={() => setOpen((prev) => !prev)} onClick={() => setOpen((prev) => !prev)}
className="inline-flex items-center gap-2 rounded-lg border border-grayScale-200 bg-white px-4 py-2 text-sm font-medium text-grayScale-700 shadow-sm transition-colors hover:bg-grayScale-50" className="inline-flex items-center gap-2 rounded-[6px] border border-grayScale-200 bg-white px-4 py-2 text-sm font-medium text-grayScale-700 shadow-sm transition-colors hover:bg-grayScale-50"
> >
Time Range Time Range
<ChevronDown className={cn("h-4 w-4 text-grayScale-400 transition-transform", open && "rotate-180")} /> <ChevronDown className={cn("h-4 w-4 text-grayScale-400 transition-transform", open && "rotate-180")} />
@ -236,7 +236,7 @@ export function AnalyticsTimeRangeFilter({ value, onChange, className }: Analyti
type="button" type="button"
onClick={() => setContextYear(year)} onClick={() => setContextYear(year)}
className={cn( className={cn(
"rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors", "rounded-[6px] px-2 py-0.5 text-[11px] font-medium transition-colors",
contextYear === year contextYear === year
? "bg-brand-100 text-brand-700" ? "bg-brand-100 text-brand-700"
: "text-grayScale-500 hover:bg-grayScale-100", : "text-grayScale-500 hover:bg-grayScale-100",

View File

@ -58,7 +58,7 @@ export function DynamicMatchingInputsSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addMatchingInputRow(parsed))} onClick={() => updateValue(addMatchingInputRow(parsed))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />
@ -153,7 +153,7 @@ export function DynamicMatchingAnswerSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 rounded-lg" className="h-8 rounded-[6px]"
onClick={() => onClick={() =>
updateValue(defaultMatchingAnswerFromInputs(matchingInputs)) updateValue(defaultMatchingAnswerFromInputs(matchingInputs))
} }
@ -166,7 +166,7 @@ export function DynamicMatchingAnswerSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addMatchingPair(parsed, matchingInputs))} onClick={() => updateValue(addMatchingPair(parsed, matchingInputs))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />

View File

@ -286,7 +286,7 @@ function DynamicImageSlot({
<ResolvedImage src={value} alt="" className="h-full w-full object-contain" /> <ResolvedImage src={value} alt="" className="h-full w-full object-contain" />
<button <button
type="button" type="button"
className="absolute right-1.5 top-1.5 rounded-full bg-white/95 p-1.5 text-[#9E2891] shadow-md hover:bg-white" className="absolute right-1.5 top-1.5 rounded-[6px] bg-white/95 p-1.5 text-[#9E2891] shadow-md hover:bg-white"
onClick={() => onChange("")} onClick={() => onChange("")}
disabled={zoneDisabled} disabled={zoneDisabled}
aria-label="Remove image" aria-label="Remove image"
@ -332,7 +332,7 @@ function DynamicImageSlot({
if (file) void processFile(file) if (file) void processFile(file)
}} }}
className={cn( className={cn(
"flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed border-[#9E289133] bg-white p-4 text-center transition-colors", "flex w-full cursor-pointer flex-col items-center justify-center rounded-[6px] border-2 border-dashed border-[#9E289133] bg-white p-4 text-center transition-colors",
"hover:border-[#9E289180] hover:bg-grayScale-50/30", "hover:border-[#9E289180] hover:bg-grayScale-50/30",
dragActive && "border-[#9E2891] bg-[#9E289108]", dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60", zoneDisabled && "cursor-not-allowed opacity-60",
@ -546,7 +546,7 @@ function DynamicAudioSlot({
</div> </div>
<button <button
type="button" type="button"
className="shrink-0 rounded-md p-1.5 text-[#9E2891] transition hover:bg-white/80" className="shrink-0 rounded-[6px] p-1.5 text-[#9E2891] transition hover:bg-white/80"
onClick={() => { onClick={() => {
audioRef.current?.pause() audioRef.current?.pause()
setPlaying(false) setPlaying(false)
@ -596,7 +596,7 @@ function DynamicAudioSlot({
if (file) void processFile(file) if (file) void processFile(file)
}} }}
className={cn( className={cn(
"flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed border-[#9E289133] bg-white p-4 text-center transition-colors", "flex w-full cursor-pointer flex-col items-center justify-center rounded-[6px] border-2 border-dashed border-[#9E289133] bg-white p-4 text-center transition-colors",
"hover:border-[#9E289180] hover:bg-grayScale-50/30", "hover:border-[#9E289180] hover:bg-grayScale-50/30",
dragActive && "border-[#9E2891] bg-[#9E289108]", dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60", zoneDisabled && "cursor-not-allowed opacity-60",
@ -673,7 +673,7 @@ function DynamicMultipleChoiceSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addMultipleChoiceOption(parsed))} onClick={() => updateValue(addMultipleChoiceOption(parsed))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />

View File

@ -51,7 +51,7 @@ export function DynamicSelectMissingWordsStimulusSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addTextSegment(parsed))} onClick={() => updateValue(addTextSegment(parsed))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />
@ -62,7 +62,7 @@ export function DynamicSelectMissingWordsStimulusSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addBlankSegment(parsed))} onClick={() => updateValue(addBlankSegment(parsed))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />
@ -128,7 +128,7 @@ export function DynamicSelectMissingWordsStimulusSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addWordBankItem(parsed))} onClick={() => updateValue(addWordBankItem(parsed))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />
@ -219,7 +219,7 @@ export function DynamicSelectMissingWordsAnswerSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled} disabled={disabled}
className="h-8 rounded-lg" className="h-8 rounded-[6px]"
onClick={() => onClick={() =>
updateValue(defaultSelectMissingWordsResponseFromStimulus(stimulus)) updateValue(defaultSelectMissingWordsResponseFromStimulus(stimulus))
} }

View File

@ -73,7 +73,7 @@ function SortableSequenceRow({
> >
<button <button
type="button" type="button"
className="flex h-9 w-9 shrink-0 cursor-grab items-center justify-center rounded-md text-grayScale-400 hover:bg-white hover:text-grayScale-600 active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-40" className="flex h-9 w-9 shrink-0 cursor-grab items-center justify-center rounded-[6px] text-grayScale-400 hover:bg-white hover:text-grayScale-600 active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-40"
disabled={disabled} disabled={disabled}
aria-label={`Drag item ${itemId}`} aria-label={`Drag item ${itemId}`}
{...attributes} {...attributes}
@ -159,7 +159,7 @@ export function DynamicSequenceOrderSlot({
variant="outline" variant="outline"
size="sm" size="sm"
disabled={disabled || !canAdd} disabled={disabled || !canAdd}
className="h-8 gap-1.5 rounded-lg border-brand-200 text-brand-600 hover:bg-brand-50" className="h-8 gap-1.5 rounded-[6px] border-brand-200 text-brand-600 hover:bg-brand-50"
onClick={() => updateValue(addSequenceOrderItem(parsed, maxItems))} onClick={() => updateValue(addSequenceOrderItem(parsed, maxItems))}
> >
<Plus className="h-3.5 w-3.5" /> <Plus className="h-3.5 w-3.5" />

View File

@ -887,7 +887,7 @@ export function PracticeQuestionEditorFields({
<button <button
type="button" type="button"
onClick={() => removeOption(optIdx)} onClick={() => removeOption(optIdx)}
className="rounded-lg p-1 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500" className="rounded-[6px] p-1 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500"
> >
<X className="h-4 w-4" /> <X className="h-4 w-4" />
</button> </button>
@ -897,7 +897,7 @@ export function PracticeQuestionEditorFields({
<button <button
type="button" type="button"
onClick={addOption} onClick={addOption}
className="mt-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="mt-1 flex items-center gap-1.5 rounded-[6px] px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Add Option Add Option
@ -929,7 +929,7 @@ export function PracticeQuestionEditorFields({
], ],
}) })
} }
className={`flex-1 rounded-lg border-2 px-4 py-2.5 text-sm font-medium transition-colors ${ className={`flex-1 rounded-[6px] border-2 px-4 py-2.5 text-sm font-medium transition-colors ${
value.options[i]?.isCorrect value.options[i]?.isCorrect
? "border-green-500 bg-green-50 text-green-700" ? "border-green-500 bg-green-50 text-green-700"
: "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300" : "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300"

View File

@ -154,7 +154,7 @@ export function EmailComposeFields({
type="button" type="button"
onClick={switchToFreeForm} onClick={switchToFreeForm}
className={cn( className={cn(
"rounded-full px-3 py-1.5 transition-colors", "rounded-[6px] px-3 py-1.5 transition-colors",
isFreeForm isFreeForm
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "text-grayScale-500 hover:text-grayScale-700", : "text-grayScale-500 hover:text-grayScale-700",
@ -167,7 +167,7 @@ export function EmailComposeFields({
onClick={switchToTemplate} onClick={switchToTemplate}
disabled={templatesLoading || templates.length === 0} disabled={templatesLoading || templates.length === 0}
className={cn( className={cn(
"rounded-full px-3 py-1.5 transition-colors disabled:cursor-not-allowed disabled:opacity-50", "rounded-[6px] px-3 py-1.5 transition-colors disabled:cursor-not-allowed disabled:opacity-50",
!isFreeForm !isFreeForm
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "text-grayScale-500 hover:text-grayScale-700", : "text-grayScale-500 hover:text-grayScale-700",

View File

@ -74,7 +74,7 @@ export function NotificationDetailDialog({
<Button <Button
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-lg" className="rounded-[6px]"
onClick={onRetry} onClick={onRetry}
> >
Try again Try again
@ -236,7 +236,7 @@ function DetailsTab({
<div className="border-t border-grayScale-100 pt-4"> <div className="border-t border-grayScale-100 pt-4">
<Button <Button
size="sm" size="sm"
className="h-9 rounded-lg bg-destructive px-4 text-xs font-medium text-white hover:bg-destructive/90" className="h-9 rounded-[6px] bg-destructive px-4 text-xs font-medium text-white hover:bg-destructive/90"
onClick={onDelete} onClick={onDelete}
> >
Delete notification Delete notification

View File

@ -53,7 +53,7 @@ export function NotificationSchedulePicker({
type="button" type="button"
disabled={disabled} disabled={disabled}
className={cn( className={cn(
"flex h-11 w-full items-center justify-between rounded-xl border border-grayScale-200 bg-grayScale-50/70 px-3 text-sm text-grayScale-700 shadow-sm transition-all", "flex h-11 w-full items-center justify-between rounded-[6px] border border-grayScale-200 bg-grayScale-50/70 px-3 text-sm text-grayScale-700 shadow-sm transition-all",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-100", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-100",
disabled && "cursor-not-allowed opacity-50", disabled && "cursor-not-allowed opacity-50",
className, className,

View File

@ -215,7 +215,7 @@ export function Sidebar({
{isCollapsed && ( {isCollapsed && (
<button <button
type="button" type="button"
className="grid h-10 w-10 place-items-center rounded-md border border-grayScale-200 text-grayScale-400 transition-all hover:bg-grayScale-100 hover:text-brand-600 dark:border-grayScale-200/20 dark:hover:bg-white/5 dark:hover:text-brand-400" className="grid h-10 w-10 place-items-center rounded-[6px] border border-grayScale-200 text-grayScale-400 transition-all hover:bg-grayScale-100 hover:text-brand-600 dark:border-grayScale-200/20 dark:hover:bg-white/5 dark:hover:text-brand-400"
onClick={onToggleCollapse} onClick={onToggleCollapse}
aria-label="Expand sidebar" aria-label="Expand sidebar"
> >
@ -225,7 +225,7 @@ export function Sidebar({
{!isCollapsed && ( {!isCollapsed && (
<button <button
type="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" className="hidden h-10 w-10 rounded-[6px] 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} onClick={onToggleCollapse}
aria-label="Collapse sidebar" aria-label="Collapse sidebar"
> >
@ -234,7 +234,7 @@ export function Sidebar({
)} )}
<button <button
type="button" type="button"
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" className="grid h-7 w-7 place-items-center rounded-[6px] text-grayScale-400 hover:bg-grayScale-100 hover:text-brand-600 lg:hidden dark:hover:bg-white/5 dark:hover:text-brand-400"
onClick={onClose} onClick={onClose}
aria-label="Close sidebar" aria-label="Close sidebar"
> >
@ -424,7 +424,7 @@ export function Sidebar({
window.location.href = "/login"; window.location.href = "/login";
}} }}
className={cn( className={cn(
"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", "flex w-full items-center gap-3 rounded-[6px] px-3 py-2 text-sm font-medium text-grayScale-500 transition hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isCollapsed && "justify-center gap-0 p-2", isCollapsed && "justify-center gap-0 p-2",
)} )}
title={isCollapsed ? "Logout" : undefined} title={isCollapsed ? "Logout" : undefined}

View File

@ -91,7 +91,7 @@ export function SidebarNavGroup({
aria-controls={panelId} aria-controls={panelId}
onClick={() => setExpanded((open) => !open)} onClick={() => setExpanded((open) => !open)}
className={cn( className={cn(
"relative group flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-grayScale-600 transition", "relative group flex w-full items-center gap-3 rounded-[6px] px-3 py-2 text-left text-sm font-medium text-grayScale-600 transition",
"hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400", "hover:bg-grayScale-100 hover:text-brand-600 dark:text-grayScale-400 dark:hover:bg-white/5 dark:hover:text-brand-400",
isSectionActive && isSectionActive &&
"bg-brand-500/10 text-black dark:bg-brand-500/15 dark:text-white", "bg-brand-500/10 text-black dark:bg-brand-500/15 dark:text-white",

View File

@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority"
import { cn } from "../../lib/utils" import { cn } from "../../lib/utils"
const buttonVariants = cva( const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-lg text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-[6px] text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
{ {
variants: { variants: {
variant: { variant: {
@ -18,7 +18,7 @@ const buttonVariants = cva(
}, },
size: { size: {
default: "h-10 px-4 py-2", default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3", sm: "h-9 px-3",
lg: "h-11 px-6", lg: "h-11 px-6",
icon: "h-10 w-10", icon: "h-10 w-10",
}, },

View File

@ -38,7 +38,7 @@ const DialogContent = React.forwardRef<
{...props} {...props}
> >
{children} {children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-md p-1 opacity-40 transition-opacity hover:opacity-70 disabled:pointer-events-none"> <DialogPrimitive.Close className="absolute right-4 top-4 rounded-[6px] p-1 opacity-40 transition-opacity hover:opacity-70 disabled:pointer-events-none">
<X className="h-4 w-4" /> <X className="h-4 w-4" />
<span className="sr-only">Close</span> <span className="sr-only">Close</span>
</DialogPrimitive.Close> </DialogPrimitive.Close>

View File

@ -123,7 +123,7 @@ export const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(
type="button" type="button"
onClick={() => inputRef.current?.click()} onClick={() => inputRef.current?.click()}
className={cn( className={cn(
"shrink-0 rounded-lg bg-brand-500 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-brand-600", "shrink-0 rounded-[6px] bg-brand-500 px-4 py-2 text-sm font-medium text-white shadow-sm hover:bg-brand-600",
isCompact ? "mx-auto w-full max-w-[200px] sm:mx-0 sm:w-auto" : "mt-1", isCompact ? "mx-auto w-full max-w-[200px] sm:mx-0 sm:w-auto" : "mt-1",
)} )}
> >

View File

@ -53,7 +53,7 @@ export function SensitiveRevealToggle({
type="button" type="button"
onClick={toggle} onClick={toggle}
className={cn( className={cn(
"inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-grayScale-500 transition-colors hover:bg-grayScale-100 hover:text-grayScale-800", "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-[6px] text-grayScale-500 transition-colors hover:bg-grayScale-100 hover:text-grayScale-800",
className, className,
)} )}
aria-label={revealed ? `Hide ${label}` : `Show ${label}`} aria-label={revealed ? `Hide ${label}` : `Show ${label}`}
@ -115,7 +115,7 @@ export function SensitiveChart({
<button <button
type="button" type="button"
onClick={toggle} onClick={toggle}
className="absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-lg bg-white/40 text-sm font-medium text-grayScale-600 backdrop-blur-[1px] transition-colors hover:bg-white/55 hover:text-grayScale-800" className="absolute inset-0 z-10 flex flex-col items-center justify-center gap-2 rounded-[6px] bg-white/40 text-sm font-medium text-grayScale-600 backdrop-blur-[1px] transition-colors hover:bg-white/55 hover:text-grayScale-800"
> >
<Eye className="h-5 w-5" /> <Eye className="h-5 w-5" />
Show revenue Show revenue

View File

@ -5,6 +5,24 @@ export type OffsetPageResult<T> = {
const DEFAULT_BATCH_SIZE = 100 const DEFAULT_BATCH_SIZE = 100
/** Unwrap `{ data: { <key>: T[], total_count } }` list envelopes used by LMS/exam-prep APIs. */
export function offsetPageFromListEnvelope<T>(
res: { data?: { data?: unknown; Data?: unknown } },
key: string,
): OffsetPageResult<T> {
const body = res.data?.data ?? res.data?.Data
if (!body || typeof body !== "object") return { items: [] }
const record = body as Record<string, unknown>
const pascalKey = key.charAt(0).toUpperCase() + key.slice(1)
const raw = record[key] ?? record[pascalKey]
const items = Array.isArray(raw) ? (raw as T[]) : []
const total = Number(record.total_count ?? record.TotalCount ?? record.totalCount)
return {
items,
total_count: Number.isFinite(total) && total >= 0 ? total : undefined,
}
}
/** /**
* Fetches every page from an offset/limit API so client-side search can run across the full dataset. * Fetches every page from an offset/limit API so client-side search can run across the full dataset.
*/ */

View File

@ -39,6 +39,19 @@ export function normalizeParentContextPractice(raw: unknown): ParentContextPract
} }
} }
export function unwrapPracticesPage(res: {
data?: GetPracticesByParentContextResponse & {
Data?: GetPracticesByParentContextResponse["data"]
}
}): { items: ParentContextPractice[]; total_count?: number } {
const data = res.data?.data ?? res.data?.Data
const total = Number(data?.total_count)
return {
items: unwrapPracticesList(res),
total_count: Number.isFinite(total) && total >= 0 ? total : undefined,
}
}
export function unwrapPracticesList( export function unwrapPracticesList(
res: { res: {
data?: GetPracticesByParentContextResponse & { data?: GetPracticesByParentContextResponse & {

View File

@ -115,7 +115,12 @@ export async function executePracticeCreation(
const byId = new Map(opts.definitions.map((d) => [d.id, d])) const byId = new Map(opts.definitions.map((d) => [d.id, d]))
const linkedParents = dedupeParents(opts.parents ?? []) const linkedParents = dedupeParents([
...(opts.parentKind && opts.parentId
? [{ parent_kind: opts.parentKind, parent_id: opts.parentId }]
: []),
...(opts.parents ?? []),
])
const createParents = buildCreatePracticeParentsPayload(linkedParents) const createParents = buildCreatePracticeParentsPayload(linkedParents)
const primaryParent = linkedParents[0] ?? null const primaryParent = linkedParents[0] ?? null

View File

@ -317,7 +317,7 @@ export function ProfilePage() {
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-8 gap-1.5 rounded-lg text-xs font-medium text-grayScale-500" className="h-8 gap-1.5 rounded-[6px] text-xs font-medium text-grayScale-500"
onClick={startEditing} onClick={startEditing}
> >
<Pencil className="h-3.5 w-3.5" /> <Pencil className="h-3.5 w-3.5" />

View File

@ -317,7 +317,7 @@ function AppearanceTab() {
type="button" type="button"
onClick={() => setTheme(id)} onClick={() => setTheme(id)}
className={cn( className={cn(
"flex flex-col items-stretch gap-3 rounded-[8px] border-2 p-3 text-left transition-all", "flex flex-col items-stretch gap-3 rounded-[6px] border-2 p-3 text-left transition-all",
selected selected
? "border-brand-500 bg-brand-500/10 shadow-sm ring-1 ring-brand-500/30" ? "border-brand-500 bg-brand-500/10 shadow-sm ring-1 ring-brand-500/30"
: "border-grayScale-200 bg-grayScale-50 hover:border-grayScale-300 hover:bg-grayScale-100", : "border-grayScale-200 bg-grayScale-50 hover:border-grayScale-300 hover:bg-grayScale-100",

View File

@ -87,7 +87,7 @@ export function ForgotPasswordPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 rounded-xl px-6 text-sm font-semibold" className="h-11 rounded-[6px] px-6 text-sm font-semibold"
onClick={() => { onClick={() => {
setSubmitted(false) setSubmitted(false)
setError(null) setError(null)
@ -143,7 +143,7 @@ export function ForgotPasswordPage() {
<Button <Button
type="submit" type="submit"
disabled={submitting} disabled={submitting}
className="mt-2 h-11 w-full rounded-xl text-sm font-semibold tracking-wide" className="mt-2 h-11 w-full rounded-[6px] text-sm font-semibold tracking-wide"
> >
{submitting ? ( {submitting ? (
<span className="inline-flex items-center gap-2"> <span className="inline-flex items-center gap-2">

View File

@ -306,7 +306,7 @@ export function LoginPage() {
type="button" type="button"
onClick={handleGoogleClick} onClick={handleGoogleClick}
disabled={googleLoading || !googleReady} disabled={googleLoading || !googleReady}
className="group mb-6 flex w-full items-center justify-center gap-3 rounded-xl border border-grayScale-200 bg-white px-4 py-3 text-sm font-medium text-grayScale-600 transition-all duration-200 hover:border-grayScale-300 hover:bg-grayScale-100 hover:shadow-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 disabled:cursor-not-allowed disabled:opacity-60" className="group mb-6 flex w-full items-center justify-center gap-3 rounded-[6px] border border-grayScale-200 bg-white px-4 py-3 text-sm font-medium text-grayScale-600 transition-all duration-200 hover:border-grayScale-300 hover:bg-grayScale-100 hover:shadow-soft focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand-500/40 disabled:cursor-not-allowed disabled:opacity-60"
> >
{googleLoading ? ( {googleLoading ? (
<SpinnerIcon className="h-5 w-5" /> <SpinnerIcon className="h-5 w-5" />
@ -403,7 +403,7 @@ export function LoginPage() {
<Button <Button
type="submit" type="submit"
className="mt-2 h-11 w-full rounded-xl text-sm font-semibold tracking-wide" className="mt-2 h-11 w-full rounded-[6px] text-sm font-semibold tracking-wide"
disabled={loading} disabled={loading}
> >
{loading ? "Signing in…" : "Sign in"} {loading ? "Signing in…" : "Sign in"}

View File

@ -309,7 +309,7 @@ export function ResetPasswordPage() {
<Button <Button
type="submit" type="submit"
disabled={submitting || !canSubmit} disabled={submitting || !canSubmit}
className="mt-2 h-11 w-full rounded-xl text-sm font-semibold tracking-wide" className="mt-2 h-11 w-full rounded-[6px] text-sm font-semibold tracking-wide"
> >
{submitting ? ( {submitting ? (
<span className="inline-flex items-center gap-2"> <span className="inline-flex items-center gap-2">

View File

@ -852,7 +852,7 @@ export function AddNewPracticePage() {
</div> </div>
<button <button
onClick={() => removeQuestion(question.id)} onClick={() => removeQuestion(question.id)}
className="rounded-lg p-1.5 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500" className="rounded-[6px] p-1.5 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500"
> >
<Trash2 className="h-4 w-4" /> <Trash2 className="h-4 w-4" />
</button> </button>
@ -910,7 +910,7 @@ export function AddNewPracticePage() {
<button <button
type="button" type="button"
onClick={addQuestion} onClick={addQuestion}
className="inline-flex w-full items-center justify-center gap-2 rounded-xl border-2 border-dashed border-brand-200/90 bg-brand-50/20 px-4 py-3.5 text-sm font-semibold text-brand-600 transition-all hover:border-brand-300 hover:bg-brand-50/60 hover:text-brand-700 sm:py-3" className="inline-flex w-full items-center justify-center gap-2 rounded-[6px] border-2 border-dashed border-brand-200/90 bg-brand-50/20 px-4 py-3.5 text-sm font-semibold text-brand-600 transition-all hover:border-brand-300 hover:bg-brand-50/60 hover:text-brand-700 sm:py-3"
> >
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Add another question Add another question

View File

@ -156,7 +156,9 @@ export function AddPracticeFlow() {
const backLabel = isFromQuestionType const backLabel = isFromQuestionType
? "Back to Question Types" ? "Back to Question Types"
: effectiveBackTo === "module" : effectiveBackTo === "lesson"
? "Back to Lesson"
: effectiveBackTo === "module"
? "Back to Module" ? "Back to Module"
: effectiveBackTo === "unit" : effectiveBackTo === "unit"
? "Back to Unit" ? "Back to Unit"
@ -186,11 +188,36 @@ export function AddPracticeFlow() {
if (effectiveBackTo === "courses" && programType && courseId) { if (effectiveBackTo === "courses" && programType && courseId) {
return `/new-content/courses/${programType}/${courseId}`; return `/new-content/courses/${programType}/${courseId}`;
} }
if (
effectiveBackTo === "lesson" &&
programType &&
courseId &&
unitId &&
moduleId &&
lessonId
) {
const titleQuery = lessonTitleRaw?.trim()
? `?lessonTitle=${encodeURIComponent(lessonTitleDisplay || lessonTitleRaw)}`
: "";
return `/new-content/courses/${programType}/${courseId}/${unitId}/${moduleId}/lessons/${lessonId}/practices${titleQuery}`;
}
if (programType) { if (programType) {
return `/new-content/courses/${programType}`; return `/new-content/courses/${programType}`;
} }
return "/new-content"; return "/new-content";
} }
if (
effectiveBackTo === "lesson" &&
level &&
courseId &&
moduleId &&
lessonId
) {
const titleQuery = lessonTitleRaw?.trim()
? `?lessonTitle=${encodeURIComponent(lessonTitleDisplay || lessonTitleRaw)}`
: "";
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}/lessons/${lessonId}/practices${titleQuery}`;
}
if (effectiveBackTo === "module" && level && courseId && moduleId) { if (effectiveBackTo === "module" && level && courseId && moduleId) {
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}`; return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}`;
} }
@ -205,6 +232,9 @@ export function AddPracticeFlow() {
courseId, courseId,
unitId, unitId,
moduleId, moduleId,
lessonId,
lessonTitleRaw,
lessonTitleDisplay,
level, level,
isFromQuestionType, isFromQuestionType,
]); ]);
@ -342,11 +372,12 @@ export function AddPracticeFlow() {
}); });
return; return;
} }
const parents = dedupeParents( const parents = dedupeParents([
isExamPrep && parentContext ...(parentContext
? [{ parent_kind: parentContext.kind, parent_id: parentContext.id }] ? [{ parent_kind: parentContext.kind, parent_id: parentContext.id }]
: formData.parents, : []),
); ...(formData.parents ?? []),
]);
const parentsErr = validatePracticeParents(parents, { const parentsErr = validatePracticeParents(parents, {
required: !isFromQuestionType && !isExamPrep, required: !isFromQuestionType && !isExamPrep,
}); });
@ -759,7 +790,7 @@ export function AddPracticeFlow() {
</h1> </h1>
<Button <Button
variant="outline" 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" className="h-10 w-full rounded-[6px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
onClick={goBack} onClick={goBack}
> >
Cancel Cancel

View File

@ -144,7 +144,7 @@ export function AddPracticePage() {
variant="ghost" variant="ghost"
size="icon" size="icon"
onClick={() => navigate("/content/speaking")} onClick={() => navigate("/content/speaking")}
className="h-10 w-10 shrink-0 rounded-xl border border-grayScale-200 bg-white shadow-sm transition-colors hover:bg-grayScale-50 hover:border-grayScale-300" className="h-10 w-10 shrink-0 rounded-[6px] border border-grayScale-200 bg-white shadow-sm transition-colors hover:bg-grayScale-50 hover:border-grayScale-300"
> >
<ArrowLeft className="h-4 w-4 text-grayScale-600" /> <ArrowLeft className="h-4 w-4 text-grayScale-600" />
</Button> </Button>

View File

@ -354,7 +354,7 @@ export function AddQuestionPage() {
variant="ghost" variant="ghost"
size="icon" size="icon"
onClick={() => navigateBack(navigate, "/content/questions")} onClick={() => navigateBack(navigate, "/content/questions")}
className="h-9 w-9 shrink-0 rounded-lg bg-grayScale-50 hover:bg-brand-500/10 hover:text-brand-500" className="h-9 w-9 shrink-0 rounded-[6px] bg-grayScale-50 hover:bg-brand-500/10 hover:text-brand-500"
> >
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
</Button> </Button>

View File

@ -192,7 +192,7 @@ export function AddVideoFlow() {
<PageBackLink fallbackTo={backPath} label="Back to module" className="text-grayScale-500" /> <PageBackLink fallbackTo={backPath} label="Back to module" className="text-grayScale-500" />
<Button <Button
variant="outline" 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" className="h-10 w-full rounded-[6px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
onClick={goBack} onClick={goBack}
> >
Cancel Cancel

View File

@ -35,7 +35,7 @@ export function AddVideoPage() {
variant="ghost" variant="ghost"
size="icon" size="icon"
onClick={() => navigate("/content/courses")} onClick={() => navigate("/content/courses")}
className="h-9 w-9 rounded-lg border border-grayScale-200 bg-white shadow-sm transition-colors hover:bg-grayScale-50 hover:border-grayScale-300" className="h-9 w-9 rounded-[6px] border border-grayScale-200 bg-white shadow-sm transition-colors hover:bg-grayScale-50 hover:border-grayScale-300"
> >
<ArrowLeft className="h-4 w-4 text-grayScale-500" /> <ArrowLeft className="h-4 w-4 text-grayScale-500" />
</Button> </Button>

View File

@ -448,7 +448,7 @@ export function AllCoursesPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)} onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1} disabled={safePage === 1}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === 1 && "cursor-not-allowed opacity-50", safePage === 1 && "cursor-not-allowed opacity-50",
)} )}
> >
@ -465,7 +465,7 @@ export function AllCoursesPage() {
type="button" type="button"
onClick={() => setPage(n)} onClick={() => setPage(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === safePage n === safePage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50", : "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -479,7 +479,7 @@ export function AllCoursesPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)} onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages} disabled={safePage === totalPages}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === totalPages && "cursor-not-allowed opacity-50", safePage === totalPages && "cursor-not-allowed opacity-50",
)} )}
> >

View File

@ -53,7 +53,7 @@ export function AttachProgramPracticeFlow() {
<div className="flex flex-col gap-4 w-full max-w-[440px]"> <div className="flex flex-col gap-4 w-full max-w-[440px]">
<Button <Button
onClick={() => navigate(backPath)} onClick={() => navigate(backPath)}
className="h-14 rounded-[12px] bg-[#9E2891] font-bold shadow-xl shadow-brand-500/20 text-[16px] text-white " className="h-14 rounded-[6px] bg-[#9E2891] font-bold shadow-xl shadow-brand-500/20 text-[16px] text-white "
> >
Go back to Program Go back to Program
</Button> </Button>
@ -63,7 +63,7 @@ export function AttachProgramPracticeFlow() {
setIsPublished(false); setIsPublished(false);
setCurrentStep(1); setCurrentStep(1);
}} }}
className="h-14 rounded-[12px] border-[#9E2891] text-[#9E2891] font-bold text-[16px] bg-white " className="h-14 rounded-[6px] border-[#9E2891] text-[#9E2891] font-bold text-[16px] bg-white "
> >
Attach More Practice Attach More Practice
</Button> </Button>

View File

@ -176,7 +176,7 @@ export function ContentOverviewPage() {
<div className="flex items-center gap-3"> <div className="flex items-center gap-3">
<Link <Link
to="/content" to="/content"
className="grid h-9 w-9 shrink-0 place-items-center rounded-xl border border-grayScale-100 bg-white text-grayScale-400 shadow-sm transition-all duration-200 hover:border-brand-200 hover:bg-brand-50 hover:text-brand-600 hover:shadow-md" className="grid h-9 w-9 shrink-0 place-items-center rounded-[6px] border border-grayScale-100 bg-white text-grayScale-400 shadow-sm transition-all duration-200 hover:border-brand-200 hover:bg-brand-50 hover:text-brand-600 hover:shadow-md"
> >
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
</Link> </Link>

View File

@ -80,7 +80,7 @@ export function CourseCategoryPage() {
</div> </div>
<button <button
onClick={fetchCategories} onClick={fetchCategories}
className="mt-1 inline-flex items-center gap-2 rounded-lg bg-red-500 px-4 py-2 text-xs font-medium text-white transition-colors hover:bg-red-600" className="mt-1 inline-flex items-center gap-2 rounded-[6px] bg-red-500 px-4 py-2 text-xs font-medium text-white transition-colors hover:bg-red-600"
> >
<RefreshCw className="h-3.5 w-3.5" /> <RefreshCw className="h-3.5 w-3.5" />
Retry Retry
@ -178,7 +178,7 @@ export function CourseCategoryPage() {
</span> </span>
<button <button
type="button" type="button"
className="inline-flex h-8 w-8 items-center justify-center rounded-md border border-red-200 bg-white text-red-500 hover:bg-red-50" className="inline-flex h-8 w-8 items-center justify-center rounded-[6px] border border-red-200 bg-white text-red-500 hover:bg-red-50"
onClick={(e) => { onClick={(e) => {
e.preventDefault() e.preventDefault()
e.stopPropagation() e.stopPropagation()
@ -295,7 +295,7 @@ export function CourseCategoryPage() {
<button <button
key={name} key={name}
type="button" type="button"
className="group inline-flex items-center gap-1 rounded-full bg-white px-2 py-0.5 text-[11px] text-grayScale-600 shadow-sm ring-1 ring-grayScale-200 hover:bg-red-50 hover:text-red-600 hover:ring-red-200" className="group inline-flex items-center gap-1 rounded-[6px] bg-white px-2 py-0.5 text-[11px] text-grayScale-600 shadow-sm ring-1 ring-grayScale-200 hover:bg-red-50 hover:text-red-600 hover:ring-red-200"
onClick={() => onClick={() =>
setPendingSubCategories((prev) => setPendingSubCategories((prev) =>
prev.filter((subName) => subName !== name), prev.filter((subName) => subName !== name),

View File

@ -53,7 +53,11 @@ import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
type PublishStatusFilter, type PublishStatusFilter,
} from "../../lib/contentListFilters"; } from "../../lib/contentListFilters";
import { unwrapPracticesList } from "../../lib/parentContextPractice"; import { unwrapPracticesPage } from "../../lib/parentContextPractice";
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
import { AddModuleModal } from "./components/AddModuleModal"; import { AddModuleModal } from "./components/AddModuleModal";
import { ModuleIconUploadField } from "./components/ModuleIconUploadField"; import { ModuleIconUploadField } from "./components/ModuleIconUploadField";
import { ModulePracticeCard } from "./components/ModulePracticeCard"; import { ModulePracticeCard } from "./components/ModulePracticeCard";
@ -234,13 +238,22 @@ export function CourseDetailPage() {
setError(null); setError(null);
try { try {
const [courseOutcome, modulesOutcome] = await Promise.allSettled([ const [courseOutcome, modulesOutcome] = await Promise.allSettled([
getProgramCourses(programId, { limit: 200, offset: 0 }), fetchAllOffsetPages(async (offset, limit) =>
getTopLevelCourseModules(courseIdNum, { limit: 100, offset: 0 }), offsetPageFromListEnvelope<ProgramCourseListItem>(
await getProgramCourses(programId, { limit, offset }),
"courses",
),
),
fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<TopLevelCourseModuleItem>(
await getTopLevelCourseModules(courseIdNum, { limit, offset }),
"modules",
),
),
]); ]);
if (courseOutcome.status === "fulfilled") { if (courseOutcome.status === "fulfilled") {
const raw = courseOutcome.value.data?.data?.courses; const list = courseOutcome.value;
const list = Array.isArray(raw) ? raw : [];
const found = list.find((c) => c.id === courseIdNum) ?? null; const found = list.find((c) => c.id === courseIdNum) ?? null;
setCourse(found); setCourse(found);
if (!found) { if (!found) {
@ -253,8 +266,7 @@ export function CourseDetailPage() {
} }
if (modulesOutcome.status === "fulfilled") { if (modulesOutcome.status === "fulfilled") {
const raw = modulesOutcome.value.data?.data?.modules; const list = modulesOutcome.value;
const list = Array.isArray(raw) ? raw : [];
const refreshed = await Promise.all( const refreshed = await Promise.all(
list.map(async (module) => { list.map(async (module) => {
const icon = module.icon?.trim() ?? ""; const icon = module.icon?.trim() ?? "";
@ -312,11 +324,12 @@ export function CourseDetailPage() {
setPracticesLoading(true); setPracticesLoading(true);
setPracticesLoadError(null); setPracticesLoadError(null);
try { try {
const res = await getPracticesByParentCourse(courseIdNum, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 100, unwrapPracticesPage(
offset: 0, await getPracticesByParentCourse(courseIdNum, { limit, offset }),
}); ),
setPractices(unwrapPracticesList(res)); );
setPractices(list);
} catch { } catch {
setPractices([]); setPractices([]);
setPracticesLoadError("Failed to load practices. Please try again."); setPracticesLoadError("Failed to load practices. Please try again.");
@ -735,7 +748,7 @@ export function CourseDetailPage() {
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${module.name}`} aria-label={`Edit ${module.name}`}
onClick={() => openEditModule(module)} onClick={() => openEditModule(module)}
> >
@ -745,7 +758,7 @@ export function CourseDetailPage() {
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${module.name}`} aria-label={`Delete ${module.name}`}
onClick={() => setDeletingModule(module)} onClick={() => setDeletingModule(module)}
> >
@ -892,7 +905,7 @@ export function CourseDetailPage() {
{practices.length === 0 ? ( {practices.length === 0 ? (
<PracticeActionButton <PracticeActionButton
variant="outline" variant="outline"
className="flex h-12 items-center gap-2 rounded-xl border-brand-500 px-8 font-bold text-brand-500 transition-all hover:bg-brand-50" className="flex h-12 items-center gap-2 rounded-[6px] border-brand-500 px-8 font-bold text-brand-500 transition-all hover:bg-brand-50"
pathOptions={{ pathOptions={{
isExamPrep: false, isExamPrep: false,
level: programIdParam, level: programIdParam,
@ -923,7 +936,7 @@ export function CourseDetailPage() {
!deletingModuleInFlight && setDeletingModule(null) !deletingModuleInFlight && setDeletingModule(null)
} }
disabled={deletingModuleInFlight} disabled={deletingModuleInFlight}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -125,7 +125,7 @@ function SortableChip({
<button <button
type="button" type="button"
className={cn( className={cn(
"grid h-6 w-6 shrink-0 place-items-center rounded-md transition-colors", "grid h-6 w-6 shrink-0 place-items-center rounded-[6px] transition-colors",
active active
? "text-white/80 hover:bg-white/15 hover:text-white" ? "text-white/80 hover:bg-white/15 hover:text-white"
: "text-grayScale-300 hover:bg-grayScale-100 hover:text-grayScale-500", : "text-grayScale-300 hover:bg-grayScale-100 hover:text-grayScale-500",
@ -171,7 +171,7 @@ function SortableRow({
<div className="flex items-center gap-2 border-b border-grayScale-100 px-2.5 py-2"> <div className="flex items-center gap-2 border-b border-grayScale-100 px-2.5 py-2">
<button <button
type="button" type="button"
className="grid h-6 w-6 place-items-center rounded-md text-grayScale-300 hover:bg-grayScale-100 hover:text-grayScale-500" className="grid h-6 w-6 place-items-center rounded-[6px] text-grayScale-300 hover:bg-grayScale-100 hover:text-grayScale-500"
{...attributes} {...attributes}
{...listeners} {...listeners}
> >
@ -760,7 +760,7 @@ export function CourseFlowBuilderPage() {
return next return next
}) })
}} }}
className="flex w-full flex-col items-start gap-2 rounded-lg border border-grayScale-100 bg-grayScale-50 px-3 py-2 text-left sm:flex-row sm:items-center sm:justify-between" className="flex w-full flex-col items-start gap-2 rounded-[6px] border border-grayScale-100 bg-grayScale-50 px-3 py-2 text-left sm:flex-row sm:items-center sm:justify-between"
> >
<div className="min-w-0"> <div className="min-w-0">
<p className="truncate text-sm font-semibold text-grayScale-700">{subCourse.title}</p> <p className="truncate text-sm font-semibold text-grayScale-700">{subCourse.title}</p>

View File

@ -46,9 +46,18 @@ 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 { ContentPageDescription } from "./components/ContentPageDescription"; import { ContentPageDescription } from "./components/ContentPageDescription";
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types"; import type {
ContentAccessTier,
ExamPrepCatalogCourseItem,
ExamPrepCatalogUnitItem,
PracticePublishStatus,
} from "../../types/course.types";
import { DisplayValue } from "../../lib/displayValue" import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight" import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
import { import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
type PublishStatusFilter, type PublishStatusFilter,
@ -137,9 +146,12 @@ export function CourseManagementPage() {
const loadCatalogCourse = useCallback(async () => { const loadCatalogCourse = useCallback(async () => {
if (!Number.isFinite(catalogCourseId) || catalogCourseId < 1) return; if (!Number.isFinite(catalogCourseId) || catalogCourseId < 1) return;
try { try {
const response = await getExamPrepCatalogCourses({ limit: 100, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) =>
const rows = response.data?.data?.catalog_courses; offsetPageFromListEnvelope<ExamPrepCatalogCourseItem>(
const list = Array.isArray(rows) ? rows : []; await getExamPrepCatalogCourses({ limit, offset }),
"catalog_courses",
),
);
const row = list.find((c) => Number(c.id) === catalogCourseId); const row = list.find((c) => Number(c.id) === catalogCourseId);
if (row) { if (row) {
setCatalogCourseName(row.name?.trim() || `Course ${catalogCourseId}`); setCatalogCourseName(row.name?.trim() || `Course ${catalogCourseId}`);
@ -158,12 +170,12 @@ export function CourseManagementPage() {
} }
setUnitsLoading(true); setUnitsLoading(true);
try { try {
const response = await getExamPrepCatalogUnits(catalogCourseId, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 20, offsetPageFromListEnvelope<ExamPrepCatalogUnitItem>(
offset: 0, await getExamPrepCatalogUnits(catalogCourseId, { limit, offset }),
}); "units",
const rows = response.data?.data?.units; ),
const list = Array.isArray(rows) ? rows : []; );
setUnits( setUnits(
list.map((row, index) => ({ list.map((row, index) => ({
id: Number(row.id), id: Number(row.id),
@ -670,7 +682,7 @@ export function CourseManagementPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={creating || uploadingThumbnail} disabled={creating || uploadingThumbnail}
onClick={clearCreateUnitForm} onClick={clearCreateUnitForm}
> >
@ -679,7 +691,7 @@ export function CourseManagementPage() {
</DialogClose> </DialogClose>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
disabled={creating || uploadingThumbnail} disabled={creating || uploadingThumbnail}
onClick={() => void handleCreateUnit()} onClick={() => void handleCreateUnit()}
> >
@ -795,7 +807,7 @@ export function CourseManagementPage() {
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
onClick={() => openEditUnit(unit)} onClick={() => openEditUnit(unit)}
aria-label={`Edit ${unit.name}`} aria-label={`Edit ${unit.name}`}
> >
@ -805,7 +817,7 @@ export function CourseManagementPage() {
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
onClick={() => setDeletingUnitId(unit.id)} onClick={() => setDeletingUnitId(unit.id)}
aria-label={`Delete ${unit.name}`} aria-label={`Delete ${unit.name}`}
> >
@ -1007,7 +1019,7 @@ export function CourseManagementPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
onClick={closeEditUnit} onClick={closeEditUnit}
> >
@ -1015,7 +1027,7 @@ export function CourseManagementPage() {
</Button> </Button>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
onClick={() => void handleSaveEditUnit()} onClick={() => void handleSaveEditUnit()}
> >

View File

@ -41,6 +41,8 @@ import { vimeoResultToStoredUrl } from "../../lib/video-upload/upload-video";
import { resolveThumbnailForPreview } from "../../lib/videoPreview"; import { resolveThumbnailForPreview } from "../../lib/videoPreview";
import type { import type {
ContentAccessTier, ContentAccessTier,
ExamPrepModuleLessonItem,
ExamPrepUnitModuleItem,
PracticePublishStatus, PracticePublishStatus,
} from "../../types/course.types"; } from "../../types/course.types";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar"; import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
@ -51,6 +53,10 @@ import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
type PublishStatusFilter, type PublishStatusFilter,
} from "../../lib/contentListFilters"; } from "../../lib/contentListFilters";
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
const LESSON_THUMB_GRADIENTS = [ const LESSON_THUMB_GRADIENTS = [
"from-[#CBD5E1] to-[#94A3B8]", "from-[#CBD5E1] to-[#94A3B8]",
@ -165,12 +171,12 @@ export function CourseModuleDetailPage() {
return; return;
} }
try { try {
const response = await getExamPrepUnitModules(parsedUnitId, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 100, offsetPageFromListEnvelope<ExamPrepUnitModuleItem>(
offset: 0, await getExamPrepUnitModules(parsedUnitId, { limit, offset }),
}); "modules",
const rows = response.data?.data?.modules; ),
const list = Array.isArray(rows) ? rows : []; );
const row = list.find((m) => Number(m.id) === parsedModuleId); const row = list.find((m) => Number(m.id) === parsedModuleId);
if (row) { if (row) {
setModuleTitle(row.name?.trim() || `Module ${parsedModuleId}`); setModuleTitle(row.name?.trim() || `Module ${parsedModuleId}`);
@ -222,12 +228,12 @@ export function CourseModuleDetailPage() {
setLessonsLoading(true); setLessonsLoading(true);
setLessonsLoadError(null); setLessonsLoadError(null);
try { try {
const response = await getExamPrepModuleLessons(parsedModuleId, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 20, offsetPageFromListEnvelope<ExamPrepModuleLessonItem>(
offset: 0, await getExamPrepModuleLessons(parsedModuleId, { limit, offset }),
}); "lessons",
const rows = response.data?.data?.lessons; ),
const list = Array.isArray(rows) ? rows : []; );
setLessons( setLessons(
list.map((row) => { list.map((row) => {
const raw = row.duration_seconds ?? row.duration ?? null; const raw = row.duration_seconds ?? row.duration ?? null;
@ -804,7 +810,7 @@ export function CourseModuleDetailPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={creatingLesson || uploadingThumbnail || uploadingVideo} disabled={creatingLesson || uploadingThumbnail || uploadingVideo}
onClick={clearCreateLessonForm} onClick={clearCreateLessonForm}
> >
@ -814,7 +820,7 @@ export function CourseModuleDetailPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold hover:bg-grayScale-50" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold hover:bg-grayScale-50"
disabled={creatingLesson || uploadingThumbnail || uploadingVideo} disabled={creatingLesson || uploadingThumbnail || uploadingVideo}
onClick={() => void handleCreateLesson("DRAFT")} onClick={() => void handleCreateLesson("DRAFT")}
> >
@ -822,7 +828,7 @@ export function CourseModuleDetailPage() {
</Button> </Button>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
disabled={creatingLesson || uploadingThumbnail || uploadingVideo} disabled={creatingLesson || uploadingThumbnail || uploadingVideo}
onClick={() => void handleCreateLesson("PUBLISHED")} onClick={() => void handleCreateLesson("PUBLISHED")}
> >
@ -922,7 +928,7 @@ export function CourseModuleDetailPage() {
</p> </p>
<Button <Button
variant="outline" variant="outline"
className="h-12 px-8 rounded-xl border-brand-500 text-brand-500 font-bold hover:bg-brand-50 transition-all flex items-center gap-2" className="h-12 px-8 rounded-[6px] border-brand-500 text-brand-500 font-bold hover:bg-brand-50 transition-all flex items-center gap-2"
onClick={() => setCreateLessonOpen(true)} onClick={() => setCreateLessonOpen(true)}
> >
<Video className="h-5 w-5" /> <Video className="h-5 w-5" />
@ -1088,7 +1094,7 @@ export function CourseModuleDetailPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={savingEdit || uploadingEditThumbnail || uploadingEditVideo} disabled={savingEdit || uploadingEditThumbnail || uploadingEditVideo}
onClick={closeEditLesson} onClick={closeEditLesson}
> >
@ -1096,7 +1102,7 @@ export function CourseModuleDetailPage() {
</Button> </Button>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
disabled={savingEdit || uploadingEditThumbnail || uploadingEditVideo} disabled={savingEdit || uploadingEditThumbnail || uploadingEditVideo}
onClick={() => void handleSaveEditLesson()} onClick={() => void handleSaveEditLesson()}
> >

View File

@ -317,7 +317,7 @@ export function CoursesPage() {
<div className="flex items-center gap-3.5"> <div className="flex items-center gap-3.5">
<Link <Link
to="/content" to="/content"
className="grid h-9 w-9 shrink-0 place-items-center rounded-xl bg-grayScale-50 text-grayScale-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="grid h-9 w-9 shrink-0 place-items-center rounded-[6px] bg-grayScale-50 text-grayScale-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
</Link> </Link>
@ -536,7 +536,7 @@ export function CoursesPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)} onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1} disabled={safePage === 1}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === 1 && "cursor-not-allowed opacity-50", safePage === 1 && "cursor-not-allowed opacity-50",
)} )}
> >
@ -553,7 +553,7 @@ export function CoursesPage() {
type="button" type="button"
onClick={() => setPage(n)} onClick={() => setPage(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === safePage n === safePage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50", : "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -568,7 +568,7 @@ export function CoursesPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)} onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages} disabled={safePage === totalPages}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === totalPages && "cursor-not-allowed opacity-50", safePage === totalPages && "cursor-not-allowed opacity-50",
)} )}
> >
@ -588,7 +588,7 @@ export function CoursesPage() {
<h2 className="text-lg font-bold text-grayScale-700">Add New Sub-category</h2> <h2 className="text-lg font-bold text-grayScale-700">Add New Sub-category</h2>
<button <button
onClick={handleCloseModal} onClick={handleCloseModal}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -677,7 +677,7 @@ export function CoursesPage() {
<h2 className="text-lg font-bold text-grayScale-700">Edit Sub-category</h2> <h2 className="text-lg font-bold text-grayScale-700">Edit Sub-category</h2>
<button <button
onClick={handleCloseEditModal} onClick={handleCloseEditModal}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -761,7 +761,7 @@ export function CoursesPage() {
<h2 className="text-lg font-bold text-grayScale-700">Delete Sub-category</h2> <h2 className="text-lg font-bold text-grayScale-700">Delete Sub-category</h2>
<button <button
onClick={() => setShowDeleteModal(false)} onClick={() => setShowDeleteModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -785,14 +785,14 @@ export function EditPracticeFlow() {
<div className="flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row sm:items-center sm: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 <Button
variant="outline" 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" className="h-10 w-full rounded-[6px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
disabled={submitting} disabled={submitting}
onClick={() => goBack()} onClick={() => goBack()}
> >
Cancel Cancel
</Button> </Button>
<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" className="h-10 w-full rounded-[6px] 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} disabled={submitting || !hasUnsavedChanges}
onClick={handleSaveChanges} onClick={handleSaveChanges}
> >

View File

@ -620,7 +620,7 @@ export function InitialAssessmentPage() {
aria-selected={selected} aria-selected={selected}
onClick={() => setSelectedLevel(level)} onClick={() => setSelectedLevel(level)}
className={cn( className={cn(
"rounded-full px-3.5 py-1.5 text-sm font-semibold transition", "rounded-[6px] px-3.5 py-1.5 text-sm font-semibold transition",
selected selected
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "border border-grayScale-200 bg-white text-grayScale-600 hover:border-grayScale-300", : "border border-grayScale-200 bg-white text-grayScale-600 hover:border-grayScale-300",
@ -934,7 +934,7 @@ export function InitialAssessmentPage() {
<button <button
type="button" type="button"
onClick={closeQuestionForm} onClick={closeQuestionForm}
className="rounded-lg p-1 hover:bg-grayScale-100" className="rounded-[6px] p-1 hover:bg-grayScale-100"
disabled={savingQuestion} disabled={savingQuestion}
> >
<X className="h-4 w-4" /> <X className="h-4 w-4" />

View File

@ -44,6 +44,10 @@ import { refreshFileUrl, uploadImageFile } from "../../api/files.api";
import type { LearningProgramListItem } from "../../types/course.types"; import type { LearningProgramListItem } from "../../types/course.types";
import { DisplayValue } from "../../lib/displayValue" import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight" import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
/** 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 {
@ -358,9 +362,12 @@ export function LearnEnglishPage() {
setLoading(true); setLoading(true);
setError(null); setError(null);
try { try {
const res = await getLearningPrograms({ limit: 100, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) =>
const raw = res.data?.data?.programs; offsetPageFromListEnvelope<LearningProgramListItem>(
const list = Array.isArray(raw) ? raw : []; await getLearningPrograms({ limit, offset }),
"programs",
),
);
const sorted = [...list].sort( const sorted = [...list].sort(
(a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0), (a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0),
); );
@ -535,7 +542,7 @@ export function LearnEnglishPage() {
/> />
<button <button
type="button" type="button"
className="relative w-full cursor-pointer rounded-2xl border-2 border-dashed border-[#9E289133] bg-white p-10 text-left transition-all hover:border-[#9E289180] disabled:cursor-not-allowed disabled:opacity-60" className="relative w-full cursor-pointer rounded-[6px] border-2 border-dashed border-[#9E289133] bg-white p-10 text-left transition-all hover:border-[#9E289180] disabled:cursor-not-allowed disabled:opacity-60"
disabled={createSaving || createUploadingThumbnail} disabled={createSaving || createUploadingThumbnail}
onClick={() => createThumbnailFileInputRef.current?.click()} onClick={() => createThumbnailFileInputRef.current?.click()}
> >
@ -675,7 +682,7 @@ export function LearnEnglishPage() {
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${program.name}`} aria-label={`Edit ${program.name}`}
onClick={() => openEdit(program)} onClick={() => openEdit(program)}
> >
@ -685,7 +692,7 @@ export function LearnEnglishPage() {
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${program.name}`} aria-label={`Delete ${program.name}`}
onClick={() => setDeletingProgram(program)} onClick={() => setDeletingProgram(program)}
> >
@ -835,7 +842,7 @@ export function LearnEnglishPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 shrink-0 rounded-xl border-grayScale-200 font-semibold" className="h-11 shrink-0 rounded-[6px] border-grayScale-200 font-semibold"
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()} onClick={() => editThumbnailFileInputRef.current?.click()}
> >
@ -898,7 +905,7 @@ export function LearnEnglishPage() {
type="button" type="button"
onClick={() => !deleting && setDeletingProgram(null)} onClick={() => !deleting && setDeletingProgram(null)}
disabled={deleting} disabled={deleting}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -1,22 +1,11 @@
import { notifyApiError } from "../../lib/apiErrors" import { notifyApiError } from "../../lib/apiErrors"
import { useCallback, useEffect, useMemo, useState } from "react"; import { useCallback, useEffect, useMemo, useState } from "react";
import { import { ArrowLeft, BookOpen, Calendar, RefreshCw } from "lucide-react";
AlertCircle,
ArrowLeft,
BookOpen,
Calendar,
Clock,
Edit2,
Hash,
Loader2,
RefreshCw,
Sparkles,
Trash2,
} from "lucide-react";
import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom"; import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom";
import { toast } from "sonner"; import { toast } from "sonner";
import { import {
deleteExamPrepPractice, deleteExamPrepPractice,
deleteParentLinkedPractice,
getExamPrepLessonPractices, getExamPrepLessonPractices,
getPracticesByParentLesson, getPracticesByParentLesson,
setExamPrepPracticePublishStatus, setExamPrepPracticePublishStatus,
@ -25,14 +14,11 @@ import {
import { parentsFromPractice } from "../../lib/practiceParents"; import { parentsFromPractice } from "../../lib/practiceParents";
import { import {
isPracticeParentUnlinkNotLinkedError, isPracticeParentUnlinkNotLinkedError,
mapPracticeParentUnlinkError,
unlinkPracticeFromParent, unlinkPracticeFromParent,
} from "../../lib/practiceParentUnlink"; } from "../../lib/practiceParentUnlink";
import { Badge } from "../../components/ui/badge";
import { Button } from "../../components/ui/button"; import { Button } from "../../components/ui/button";
import { PracticeActionButton } from "./components/PracticeActionButton"; import { PracticeActionButton } from "./components/PracticeActionButton";
import { ModulePracticeCard } from "./components/ModulePracticeCard"; import { ModulePracticeCard } from "./components/ModulePracticeCard";
import { Card, CardContent } from "../../components/ui/card";
import { import {
Dialog, Dialog,
DialogContent, DialogContent,
@ -43,27 +29,19 @@ import {
import type { import type {
ExamPrepLessonPractice, ExamPrepLessonPractice,
GetExamPrepLessonPracticesResponse, GetExamPrepLessonPracticesResponse,
GetPracticesByParentContextResponse,
ParentContextPractice, ParentContextPractice,
PracticeParent, PracticeParent,
PracticePublishStatus, PracticePublishStatus,
} from "../../types/course.types"; } from "../../types/course.types";
import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar"; import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
import { ContentPageDescription } from "./components/ContentPageDescription";
import { import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
type PublishStatusFilter, type PublishStatusFilter,
} from "../../lib/contentListFilters"; } from "../../lib/contentListFilters";
import { resolveThumbnailForPreview } from "../../lib/videoPreview";
import { cn } from "../../lib/utils"; import { cn } from "../../lib/utils";
import { fetchAllOffsetPages } from "../../lib/fetchAllOffsetPages";
function unwrapPracticesEnvelope( import { unwrapPracticesPage } from "../../lib/parentContextPractice";
res: { data?: GetPracticesByParentContextResponse & { Data?: GetPracticesByParentContextResponse["data"] } },
): GetPracticesByParentContextResponse["data"] | null {
const b = res.data;
if (!b) return null;
return b.data ?? b.Data ?? null;
}
function unwrapExamPrepPracticesEnvelope( function unwrapExamPrepPracticesEnvelope(
res: { data?: GetExamPrepLessonPracticesResponse & { Data?: GetExamPrepLessonPracticesResponse["data"] } }, res: { data?: GetExamPrepLessonPracticesResponse & { Data?: GetExamPrepLessonPracticesResponse["data"] } },
@ -92,171 +70,6 @@ function mapExamPrepPracticeToCard(
}; };
} }
function formatPracticeDate(iso: string): string {
const d = new Date(iso);
return Number.isNaN(d.getTime())
? iso
: d.toLocaleString(undefined, { dateStyle: "medium", timeStyle: "short" });
}
function PracticeCard({
practice,
index,
total,
onEdit,
onUnlink,
onDelete,
onTogglePublishStatus,
publishStatusUpdating,
}: {
practice: ParentContextPractice;
index: number;
total: number;
onEdit?: () => void;
onUnlink?: () => void;
onDelete?: () => void;
onTogglePublishStatus?: (nextStatus: PracticePublishStatus) => void;
publishStatusUpdating?: boolean;
}) {
const [imgFailed, setImgFailed] = useState(false);
const thumb = resolveThumbnailForPreview(practice.story_image);
const showThumb = Boolean(thumb) && !imgFailed;
return (
<Card
className={cn(
"overflow-hidden border-grayScale-100/90 bg-white shadow-sm transition-all duration-300",
"hover:border-brand-200/60 hover:shadow-md hover:shadow-brand-500/5",
)}
>
<CardContent className="p-0">
<div className="flex flex-col lg:flex-row lg:items-stretch">
<div className="relative shrink-0 lg:w-[280px]">
<div
className={cn(
"relative aspect-[16/10] w-full overflow-hidden bg-gradient-to-br from-grayScale-100 to-grayScale-50 lg:aspect-auto lg:h-full lg:min-h-[220px]",
!showThumb && "grid min-h-[180px] place-items-center lg:min-h-[220px]",
)}
>
{showThumb ? (
<>
<img
src={thumb!}
alt=""
className="h-full w-full object-cover"
onError={() => setImgFailed(true)}
/>
<div className="pointer-events-none absolute inset-0 bg-gradient-to-t from-black/25 via-transparent to-black/10" />
</>
) : (
<div className="flex flex-col items-center gap-2 text-grayScale-400">
<div className="flex h-14 w-14 items-center justify-center rounded-2xl bg-white/80 shadow-inner ring-1 ring-grayScale-200/80">
<BookOpen className="h-7 w-7" />
</div>
<span className="text-[11px] font-semibold uppercase tracking-wider">
No cover image
</span>
</div>
)}
</div>
</div>
<div className="flex min-w-0 flex-1 flex-col p-6 sm:p-7">
<div className="mb-3 flex flex-wrap items-center justify-between gap-2">
<div className="flex flex-wrap items-center gap-2">
<span className="text-[11px] font-bold uppercase tracking-[0.14em] text-brand-500">
Practice {index + 1} of {total}
</span>
<Badge variant="secondary" className="font-mono text-[10px] font-semibold">
ID {practice.id}
</Badge>
<ContentPublishStatusChip
publishStatus={practice.publish_status}
updating={publishStatusUpdating}
contentLabel="practice"
onToggle={onTogglePublishStatus}
/>
</div>
{onUnlink ? (
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 gap-1.5 text-grayScale-700 hover:bg-grayScale-100"
onClick={onUnlink}
>
Unlink
</Button>
) : null}
{onDelete ? (
<Button
type="button"
variant="ghost"
size="sm"
className="h-8 gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700"
onClick={onDelete}
>
<Trash2 className="h-3.5 w-3.5" />
Delete
</Button>
) : null}
</div>
<h2 className="text-xl font-semibold leading-snug tracking-tight text-grayScale-900 sm:text-[1.35rem]">
{practice.title}
</h2>
{practice.story_description?.trim() ? (
<div className="mt-4 rounded-xl border border-grayScale-100 bg-grayScale-50/80 px-4 py-3.5">
<p className="text-[10px] font-bold uppercase tracking-wider text-grayScale-400">
Story & instructions
</p>
<p className="mt-2 whitespace-pre-line text-[14px] leading-relaxed text-grayScale-700">
{practice.story_description}
</p>
</div>
) : null}
{practice.quick_tips?.trim() ? (
<div className="mt-4 border-l-[3px] border-amber-400 bg-gradient-to-r from-amber-50/90 to-amber-50/30 py-3 pl-4 pr-3">
<p className="text-[10px] font-bold uppercase tracking-wider text-amber-900/75">
Quick tips
</p>
<p className="mt-1.5 whitespace-pre-line text-[13px] leading-relaxed text-grayScale-800">
{practice.quick_tips}
</p>
</div>
) : null}
<div className="mt-6 flex flex-wrap items-center gap-2 border-t border-grayScale-100 pt-5">
<Badge variant="secondary" className="gap-1.5 pl-2 pr-2.5 py-1 font-medium normal-case">
<Hash className="h-3 w-3 opacity-70" aria-hidden />
Question set {practice.question_set_id}
</Badge>
<Badge variant="secondary" className="gap-1.5 pl-2 pr-2.5 py-1 font-medium normal-case">
<Clock className="h-3 w-3 opacity-70" aria-hidden />
{formatPracticeDate(practice.created_at)}
</Badge>
{onEdit ? (
<Button
type="button"
variant="outline"
size="sm"
className="ml-auto h-9 rounded-[10px] border-brand-500 text-xs font-bold text-brand-500 hover:bg-brand-50"
onClick={onEdit}
>
<Edit2 className="mr-1.5 h-3.5 w-3.5" />
Edit
</Button>
) : null}
</div>
</div>
</div>
</CardContent>
</Card>
);
}
export function LessonPracticesPage() { export function LessonPracticesPage() {
const navigate = useNavigate(); const navigate = useNavigate();
const { level, programType, courseId, unitId, moduleId, lessonId } = useParams<{ const { level, programType, courseId, unitId, moduleId, lessonId } = useParams<{
@ -319,27 +132,27 @@ export function LessonPracticesPage() {
setLoadError(null); setLoadError(null);
try { try {
if (isExamPrep) { if (isExamPrep) {
const res = await getExamPrepLessonPractices(lid, { limit: 100, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) => {
const envelope = unwrapExamPrepPracticesEnvelope(res); const res = await getExamPrepLessonPractices(lid, { limit, offset });
const list = Array.isArray(envelope?.practices) const envelope = unwrapExamPrepPracticesEnvelope(res);
? envelope.practices.map(mapExamPrepPracticeToCard) const practices = Array.isArray(envelope?.practices)
: []; ? envelope.practices.map(mapExamPrepPracticeToCard)
: [];
return {
items: practices,
total_count: envelope?.total_count,
};
});
setPractices(list); setPractices(list);
setTotalCount( setTotalCount(list.length);
typeof envelope?.total_count === "number"
? envelope.total_count
: list.length,
);
} else { } else {
const res = await getPracticesByParentLesson(lid, { limit: 100, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) =>
const envelope = unwrapPracticesEnvelope(res); unwrapPracticesPage(
const list = Array.isArray(envelope?.practices) ? envelope.practices : []; await getPracticesByParentLesson(lid, { limit, offset }),
setPractices(list); ),
setTotalCount(
typeof envelope?.total_count === "number"
? envelope.total_count
: list.length,
); );
setPractices(list);
setTotalCount(list.length);
} }
} catch (error) { } catch (error) {
setPractices([]); setPractices([]);
@ -368,7 +181,7 @@ export function LessonPracticesPage() {
moduleId, moduleId,
lessonId: validLesson ? String(lid) : null, lessonId: validLesson ? String(lid) : null,
lessonTitle: lessonTitle || displayTitle, lessonTitle: lessonTitle || displayTitle,
backTo: isExamPrep ? "lesson" : "module", backTo: "lesson",
}), }),
[ [
isExamPrep, isExamPrep,
@ -444,14 +257,14 @@ export function LessonPracticesPage() {
toast.success(`Practice removed from ${displayTitle}`); toast.success(`Practice removed from ${displayTitle}`);
setPracticeToUnlink(null); setPracticeToUnlink(null);
await load(); await load();
} catch (e) { } catch (error) {
if (isPracticeParentUnlinkNotLinkedError(e)) { if (isPracticeParentUnlinkNotLinkedError(error)) {
toast.info("This location was already removed."); toast.info("This location was already removed.");
setPracticeToUnlink(null); setPracticeToUnlink(null);
await load(); await load();
return; return;
} }
notifyApiError(err, "Could not remove from lesson"); notifyApiError(error, "Could not remove from lesson");
} finally { } finally {
setUnlinking(false); setUnlinking(false);
} }
@ -461,7 +274,11 @@ export function LessonPracticesPage() {
if (!practiceToDelete) return; if (!practiceToDelete) return;
setDeleting(true); setDeleting(true);
try { try {
await deleteExamPrepPractice(practiceToDelete.id); if (isExamPrep) {
await deleteExamPrepPractice(practiceToDelete.id);
} else {
await deleteParentLinkedPractice(practiceToDelete.id);
}
toast.success("Practice deleted"); toast.success("Practice deleted");
setPracticeToDelete(null); setPracticeToDelete(null);
await load(); await load();
@ -474,223 +291,136 @@ export function LessonPracticesPage() {
}; };
return ( return (
<div className="min-h-screen bg-gradient-to-b from-[#F4F6FB] via-white to-[#F8FAFC]"> <div className="space-y-10 pt-10 pb-20 animate-in fade-in duration-500">
<div className="pointer-events-none fixed inset-0 -z-10 overflow-hidden"> <div className="flex items-center gap-2">
<div className="absolute -right-24 -top-24 h-72 w-72 rounded-full bg-brand-500/[0.06] blur-3xl" /> <Link
<div className="absolute -bottom-32 -left-20 h-80 w-80 rounded-full bg-violet-500/[0.05] blur-3xl" /> to={backHref}
className="flex items-center gap-2 text-[15px] font-medium text-grayScale-600 transition-colors hover:text-brand-500"
>
<ArrowLeft className="h-5 w-5" />
Back to module
</Link>
</div> </div>
<div <div className="flex flex-col gap-6 md:flex-row md:items-start md:justify-between">
className={cn( <div className="min-w-0">
"mx-auto px-4 pb-24 pt-8 sm:px-6 lg:px-8", <h1 className="text-2xl font-medium tracking-tight text-grayScale-900">
isExamPrep ? "max-w-7xl" : "max-w-4xl", {displayTitle}
)} </h1>
> <ContentPageDescription className="mt-1 text-[14px] text-grayScale-500">
<div className="animate-in fade-in slide-in-from-bottom-2 duration-500"> Review speaking practices linked to this lesson.
<Link </ContentPageDescription>
to={backHref} {!loading && !loadError ? (
className="group mb-6 inline-flex items-center gap-2 rounded-full border border-transparent px-1 py-1 text-[14px] font-medium text-grayScale-600 transition-colors hover:border-grayScale-200 hover:bg-white/80 hover:text-brand-600" <p className="mt-2 text-sm text-grayScale-500">
{totalCount} practice{totalCount === 1 ? "" : "s"} linked to this
lesson
{totalCount > practices.length
? ` · showing ${practices.length}`
: ""}
</p>
) : null}
</div>
<div className="flex items-center gap-3">
<Button
type="button"
variant="outline"
className="rounded-[6px] border-grayScale-200 text-grayScale-600"
disabled={loading}
onClick={() => void load()}
> >
<span className="flex h-8 w-8 items-center justify-center rounded-full bg-white shadow-sm ring-1 ring-grayScale-100 transition-transform group-hover:-translate-x-0.5"> <RefreshCw
<ArrowLeft className="h-4 w-4" /> className={cn("h-4 w-4", loading && "animate-spin")}
</span> />
Back to module Refresh
</Link> </Button>
<PracticeActionButton
className="rounded-[6px] bg-brand-500 font-semibold hover:bg-brand-600"
pathOptions={practicePathOptions}
parentLabel={displayTitle}
>
<Calendar className="h-4 w-4" />
Add Practice
</PracticeActionButton>
</div>
</div>
<Card className="mb-10 border-grayScale-100/80 bg-white/90 shadow-md shadow-grayScale-200/40 backdrop-blur-sm"> {loading ? (
<CardContent className="p-6 sm:p-8"> <div className="flex flex-col items-center justify-center py-24 text-[15px] font-medium text-grayScale-500">
<div className="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between"> Loading practices…
<div className="flex min-w-0 gap-4"> </div>
<div className="flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-brand-500 to-brand-600 text-white shadow-lg shadow-brand-500/25"> ) : loadError ? (
<BookOpen className="h-7 w-7" strokeWidth={1.75} /> <div className="mx-auto max-w-lg rounded-2xl border border-amber-100 bg-amber-50/80 px-6 py-8 text-center text-sm text-amber-900">
</div> {loadError}
<div className="min-w-0"> <div className="mt-4">
<p className="text-[11px] font-bold uppercase tracking-[0.2em] text-brand-500/90"> <Button
Lesson practices type="button"
</p> variant="outline"
<h1 className="mt-1.5 text-2xl font-semibold tracking-tight text-grayScale-900 sm:text-3xl"> size="sm"
{displayTitle} onClick={() => void load()}
</h1> >
<p className="mt-2 max-w-xl text-[15px] leading-relaxed text-grayScale-500"> Try again
Review speaking practices linked to this lesson. Thumbnails </Button>
and copy come from your published practice content. </div>
</p> </div>
{!loading && !loadError ? ( ) : practices.length === 0 ? (
<div className="mt-4 flex flex-wrap items-center gap-2"> <div className="flex flex-col items-center justify-center rounded-xl border border-dashed border-grayScale-200 bg-grayScale-50/50 px-6 py-14 text-center">
<Badge variant="default" className="px-3 py-1 text-xs font-semibold"> <BookOpen className="mb-3 h-10 w-10 text-grayScale-300" />
{practices.length}{" "} <p className="text-sm font-medium text-grayScale-600">
{practices.length === 1 ? "practice" : "practices"} No practices for this lesson yet
</Badge> </p>
{totalCount > practices.length ? ( <p className="mt-1 max-w-md text-sm text-grayScale-400">
<span className="text-[12px] text-grayScale-500"> Add a practice to give learners a structured speaking activity after
Showing {practices.length} of {totalCount} the video.
</span> </p>
) : null} <PracticeActionButton
</div> variant="outline"
) : null} className="mt-6 rounded-[6px] border-brand-500 text-brand-500"
</div> pathOptions={practicePathOptions}
</div> parentLabel={displayTitle}
>
<div className="flex shrink-0 flex-col gap-2 sm:flex-row lg:flex-col"> <Calendar className="h-4 w-4" />
<PracticeActionButton Add Practice
type="button" </PracticeActionButton>
className="h-11 rounded-xl bg-brand-500 px-6 font-semibold shadow-md shadow-brand-500/20 hover:bg-brand-600" </div>
pathOptions={practicePathOptions} ) : (
parentLabel={displayTitle} <div className="space-y-8">
> <ContentListSearchFilterBar
<Calendar className="mr-2 h-4 w-4" /> search={listSearch}
Add practice onSearchChange={setListSearch}
</PracticeActionButton> publishStatusFilter={publishStatusFilter}
<Button onPublishStatusFilterChange={setPublishStatusFilter}
type="button" searchPlaceholder="Search practices by title or description…"
variant="outline" searchAriaLabel="Search practices"
className="h-11 rounded-xl border-grayScale-200 font-semibold text-grayScale-700 hover:bg-grayScale-50" />
disabled={loading} {filteredPractices.length === 0 ? (
onClick={() => void load()} <div className="rounded-xl border border-dashed border-grayScale-200 bg-grayScale-50/50 px-6 py-14 text-center">
> <p className="text-sm font-medium text-grayScale-600">
<RefreshCw No practices match your search or status filter
className={cn("mr-2 h-4 w-4", loading && "animate-spin")} </p>
/> </div>
Refresh
</Button>
</div>
</div>
</CardContent>
</Card>
{loading ? (
<Card className="border-grayScale-100 bg-white/95 py-20 shadow-sm">
<CardContent className="flex flex-col items-center justify-center gap-4 pt-6">
<div className="flex h-16 w-16 items-center justify-center rounded-2xl bg-brand-50 ring-1 ring-brand-100">
<Loader2 className="h-8 w-8 animate-spin text-brand-500" />
</div>
<div className="text-center">
<p className="text-[16px] font-semibold text-grayScale-800">
Loading practices
</p>
<p className="mt-1 text-[14px] text-grayScale-500">
Fetching content for this lesson…
</p>
</div>
</CardContent>
</Card>
) : loadError ? (
<Card className="border-red-100 bg-gradient-to-br from-red-50/90 to-white shadow-sm">
<CardContent className="flex flex-col items-center gap-5 py-14 text-center sm:py-16">
<div className="flex h-16 w-16 items-center justify-center rounded-2xl bg-red-100 text-red-600">
<AlertCircle className="h-8 w-8" />
</div>
<div>
<p className="text-lg font-semibold text-grayScale-900">
Something went wrong
</p>
<p className="mx-auto mt-2 max-w-md text-[14px] leading-relaxed text-grayScale-600">
{loadError}
</p>
</div>
<Button
type="button"
variant="outline"
className="rounded-xl border-grayScale-300 font-semibold"
onClick={() => void load()}
>
Try again
</Button>
</CardContent>
</Card>
) : practices.length === 0 ? (
<Card className="border-dashed border-grayScale-200 bg-white/90 shadow-sm">
<CardContent className="flex flex-col items-center px-6 py-16 text-center sm:py-20">
<div className="mb-6 flex h-20 w-20 items-center justify-center rounded-3xl bg-gradient-to-br from-violet-50 to-brand-50 ring-1 ring-brand-100/60">
<Sparkles className="h-9 w-9 text-brand-500" strokeWidth={1.5} />
</div>
<p className="text-xl font-semibold text-grayScale-900">
No practices yet
</p>
<p className="mx-auto mt-3 max-w-md text-[15px] leading-relaxed text-grayScale-500">
This lesson does not have any linked practices. Create one to
give learners a structured speaking activity after the video.
</p>
<div className="mt-8 flex flex-col gap-3 sm:flex-row">
<PracticeActionButton
type="button"
className="h-11 rounded-xl bg-brand-500 px-8 font-semibold shadow-md shadow-brand-500/15 hover:bg-brand-600"
pathOptions={practicePathOptions}
parentLabel={displayTitle}
>
<Calendar className="mr-2 h-4 w-4" />
Create practice
</PracticeActionButton>
<Button
type="button"
variant="outline"
className="h-11 rounded-xl border-grayScale-200 px-8 font-semibold"
asChild
>
<Link to={backHref}>Return to module</Link>
</Button>
</div>
</CardContent>
</Card>
) : ( ) : (
<div className="space-y-5"> <div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4">
<ContentListSearchFilterBar {filteredPractices.map((p) => (
search={listSearch} <ModulePracticeCard
onSearchChange={setListSearch}
publishStatusFilter={publishStatusFilter}
onPublishStatusFilterChange={setPublishStatusFilter}
searchPlaceholder="Search practices by title or description…"
searchAriaLabel="Search practices"
/>
{filteredPractices.length === 0 ? (
<Card className="border-dashed border-grayScale-200 bg-white/90 shadow-sm">
<CardContent className="px-6 py-14 text-center">
<p className="text-sm font-medium text-grayScale-600">
No practices match your search or status filter
</p>
</CardContent>
</Card>
) : isExamPrep ? (
<div className="grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-4">
{filteredPractices.map((p) => (
<ModulePracticeCard
key={p.id}
practice={p}
statusUpdating={publishStatusUpdatingId === p.id}
searchQuery={listSearch}
onEdit={() => void navigate(editPracticeHref(p.id))}
onPublish={() =>
void handlePracticePublishStatus(p.id, "PUBLISHED")
}
onSaveAsDraft={() =>
void handlePracticePublishStatus(p.id, "DRAFT")
}
onUnlink={() => setPracticeToUnlink(p)}
onDelete={() => setPracticeToDelete(p)}
/>
))}
</div>
) : (
filteredPractices.map((p, i) => (
<PracticeCard
key={p.id} key={p.id}
practice={p} practice={p}
index={i} statusUpdating={publishStatusUpdatingId === p.id}
total={filteredPractices.length} searchQuery={listSearch}
onEdit={() => void navigate(editPracticeHref(p.id))} onEdit={() => void navigate(editPracticeHref(p.id))}
onUnlink={() => setPracticeToUnlink(p)} onPublish={() =>
onDelete={isExamPrep ? () => setPracticeToDelete(p) : undefined} void handlePracticePublishStatus(p.id, "PUBLISHED")
publishStatusUpdating={publishStatusUpdatingId === p.id}
onTogglePublishStatus={(nextStatus) =>
void handlePracticePublishStatus(p.id, nextStatus)
} }
onSaveAsDraft={() =>
void handlePracticePublishStatus(p.id, "DRAFT")
}
onUnlink={() => setPracticeToUnlink(p)}
onDelete={() => setPracticeToDelete(p)}
/> />
)) ))}
)}
</div> </div>
)} )}
</div> </div>
</div> )}
<Dialog <Dialog
open={practiceToUnlink !== null} open={practiceToUnlink !== null}
@ -698,16 +428,16 @@ export function LessonPracticesPage() {
if (!open && !unlinking) setPracticeToUnlink(null); if (!open && !unlinking) setPracticeToUnlink(null);
}} }}
> >
<DialogContent> <DialogContent className="max-w-md rounded-2xl">
<DialogHeader> <DialogHeader>
<DialogTitle>Remove from this lesson?</DialogTitle> <DialogTitle>Remove from this lesson?</DialogTitle>
</DialogHeader> </DialogHeader>
<p className="text-sm text-grayScale-600"> <p className="text-sm text-grayScale-600">
<span className="font-semibold text-grayScale-900"> <span className="font-semibold text-grayScale-800">
{practiceToUnlink?.title} {practiceToUnlink?.title}
</span>{" "} </span>{" "}
will be detached from{" "} will be detached from{" "}
<span className="font-semibold text-grayScale-900">{displayTitle}</span>. <span className="font-semibold text-grayScale-800">{displayTitle}</span>.
{practiceToUnlink && {practiceToUnlink &&
parentsFromPractice(practiceToUnlink).filter( parentsFromPractice(practiceToUnlink).filter(
(p) => (p) =>
@ -719,7 +449,7 @@ export function LessonPracticesPage() {
? " The practice will be unlinked until you attach it again. Questions are kept." ? " The practice will be unlinked until you attach it again. Questions are kept."
: " Other locations are unaffected."} : " Other locations are unaffected."}
</p> </p>
<DialogFooter className="border-t border-grayScale-100 px-6 py-4"> <DialogFooter className="gap-2 border-t border-grayScale-100 px-6 py-4 sm:justify-end">
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
@ -745,17 +475,17 @@ export function LessonPracticesPage() {
if (!open && !deleting) setPracticeToDelete(null); if (!open && !deleting) setPracticeToDelete(null);
}} }}
> >
<DialogContent> <DialogContent className="max-w-md rounded-2xl">
<DialogHeader> <DialogHeader>
<DialogTitle>Delete this practice permanently?</DialogTitle> <DialogTitle>Delete this practice permanently?</DialogTitle>
</DialogHeader> </DialogHeader>
<p className="text-sm text-grayScale-600"> <p className="text-sm text-grayScale-600">
<span className="font-semibold text-grayScale-900"> <span className="font-semibold text-grayScale-800">
{practiceToDelete?.title} {practiceToDelete?.title}
</span>{" "} </span>{" "}
and all of its questions will be deleted. This cannot be undone. and all of its questions will be deleted. This cannot be undone.
</p> </p>
<DialogFooter className="border-t border-grayScale-100 px-6 py-4"> <DialogFooter className="gap-2 border-t border-grayScale-100 px-6 py-4 sm:justify-end">
<Button <Button
type="button" type="button"
variant="outline" variant="outline"

View File

@ -263,7 +263,7 @@ export function LinkExistingPracticeFlow() {
<h1 className="text-2xl font-bold text-[#0F172A] sm:text-3xl">Attach Existing Practice</h1> <h1 className="text-2xl font-bold text-[#0F172A] sm:text-3xl">Attach Existing Practice</h1>
<Button <Button
variant="outline" 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" className="h-10 w-full rounded-[6px] border-grayScale-200 bg-white px-6 font-bold text-grayScale-600 hover:bg-grayScale-50 sm:w-auto"
onClick={goBack} onClick={goBack}
> >
Cancel Cancel

View File

@ -20,7 +20,11 @@ import type {
PracticePublishStatus, PracticePublishStatus,
TopLevelModuleLessonItem, TopLevelModuleLessonItem,
} from "../../types/course.types"; } from "../../types/course.types";
import { unwrapPracticesList } from "../../lib/parentContextPractice"; import { unwrapPracticesPage } from "../../lib/parentContextPractice";
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
import { parentsFromPractice } from "../../lib/practiceParents"; import { parentsFromPractice } from "../../lib/practiceParents";
import { import {
isPracticeParentUnlinkNotLinkedError, isPracticeParentUnlinkNotLinkedError,
@ -182,10 +186,14 @@ export function ModuleDetailPage() {
let cancelled = false; let cancelled = false;
(async () => { (async () => {
try { try {
const res = await getTopLevelCourseModules(cid, { limit: 100, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<{ id: number; name: string; description?: string | null }>(
await getTopLevelCourseModules(cid, { limit, offset }),
"modules",
),
);
if (cancelled) return; if (cancelled) return;
const list = res.data?.data?.modules; if (list.length > 0) {
if (Array.isArray(list)) {
const m = list.find((mod) => mod.id === id); const m = list.find((mod) => mod.id === id);
if (m) { if (m) {
setLoadedModuleName(m.name); setLoadedModuleName(m.name);
@ -229,17 +237,15 @@ export function ModuleDetailPage() {
setLessonsLoadError(null); setLessonsLoadError(null);
} }
try { try {
const res = await getModuleLessons(mid, { limit: 100, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) =>
const list = res.data?.data?.lessons; offsetPageFromListEnvelope<TopLevelModuleLessonItem>(
if (Array.isArray(list)) { await getModuleLessons(mid, { limit, offset }),
setLessons( "lessons",
[...list].sort( ),
(a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0), );
), setLessons(
); [...list].sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0)),
} else { );
setLessons([]);
}
if (showPageLoading) { if (showPageLoading) {
setLessonsLoadError(null); setLessonsLoadError(null);
} }
@ -274,11 +280,12 @@ export function ModuleDetailPage() {
setPracticesLoading(true); setPracticesLoading(true);
setPracticesLoadError(null); setPracticesLoadError(null);
try { try {
const res = await getPracticesByParentModule(mid, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 100, unwrapPracticesPage(
offset: 0, await getPracticesByParentModule(mid, { limit, offset }),
}); ),
setPractices(unwrapPracticesList(res)); );
setPractices(list);
} catch { } catch {
setPractices([]); setPractices([]);
setPracticesLoadError("Failed to load practices. Please try again."); setPracticesLoadError("Failed to load practices. Please try again.");
@ -633,7 +640,7 @@ export function ModuleDetailPage() {
moduleId, moduleId,
lessonId: String(lesson.id), lessonId: String(lesson.id),
lessonTitle: lesson.title, lessonTitle: lesson.title,
backTo: "module", backTo: "lesson",
}) })
} }
onViewPractices={() => onViewPractices={() =>
@ -671,7 +678,7 @@ export function ModuleDetailPage() {
</p> </p>
<Button <Button
variant="outline" variant="outline"
className="h-12 px-8 rounded-xl border-brand-500 text-brand-500 font-bold hover:bg-brand-50 transition-all flex items-center gap-2" className="h-12 px-8 rounded-[6px] border-brand-500 text-brand-500 font-bold hover:bg-brand-50 transition-all flex items-center gap-2"
onClick={() => onClick={() =>
navigate( navigate(
`/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}/add-video`, `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}/add-video`,
@ -748,7 +755,7 @@ export function ModuleDetailPage() {
{practices.length === 0 ? ( {practices.length === 0 ? (
<PracticeActionButton <PracticeActionButton
variant="outline" variant="outline"
className="h-12 px-8 rounded-xl border-brand-500 text-brand-500 font-bold hover:bg-brand-50 transition-all flex items-center gap-2" className="h-12 px-8 rounded-[6px] border-brand-500 text-brand-500 font-bold hover:bg-brand-50 transition-all flex items-center gap-2"
pathOptions={modulePracticePathOptions} pathOptions={modulePracticePathOptions}
parentLabel={displayModuleName} parentLabel={displayModuleName}
> >
@ -877,7 +884,7 @@ export function ModuleDetailPage() {
!deletingLessonInFlight && setDeletingLesson(null) !deletingLessonInFlight && setDeletingLesson(null)
} }
disabled={deletingLessonInFlight} disabled={deletingLessonInFlight}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -682,7 +682,7 @@ export function PracticeDetailsPage() {
aria-selected={flowMode === "view"} aria-selected={flowMode === "view"}
onClick={() => setFlowMode("view")} onClick={() => setFlowMode("view")}
className={cn( className={cn(
"inline-flex items-center justify-center gap-1.5 rounded-xl px-4 py-2 text-sm font-semibold transition", "inline-flex items-center justify-center gap-1.5 rounded-[6px] px-4 py-2 text-sm font-semibold transition",
flowMode === "view" flowMode === "view"
? "bg-white text-brand-600 shadow-sm" ? "bg-white text-brand-600 shadow-sm"
: "text-grayScale-500 hover:text-grayScale-800", : "text-grayScale-500 hover:text-grayScale-800",
@ -697,7 +697,7 @@ export function PracticeDetailsPage() {
aria-selected={flowMode === "create"} aria-selected={flowMode === "create"}
onClick={() => setFlowMode("create")} onClick={() => setFlowMode("create")}
className={cn( className={cn(
"inline-flex items-center justify-center gap-1.5 rounded-xl px-4 py-2 text-sm font-semibold transition", "inline-flex items-center justify-center gap-1.5 rounded-[6px] px-4 py-2 text-sm font-semibold transition",
flowMode === "create" flowMode === "create"
? "bg-white text-brand-600 shadow-sm" ? "bg-white text-brand-600 shadow-sm"
: "text-grayScale-500 hover:text-grayScale-800", : "text-grayScale-500 hover:text-grayScale-800",

View File

@ -678,7 +678,7 @@ export function PracticeQuestionsPage() {
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
className="h-8 w-8 rounded-lg text-grayScale-400 hover:text-brand-600" className="h-8 w-8 rounded-[6px] text-grayScale-400 hover:text-brand-600"
onClick={() => handleEditClick(question)} onClick={() => handleEditClick(question)}
> >
<Edit className="h-4 w-4" /> <Edit className="h-4 w-4" />
@ -686,7 +686,7 @@ export function PracticeQuestionsPage() {
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
className="h-8 w-8 rounded-lg text-grayScale-400 hover:bg-red-50 hover:text-red-500" className="h-8 w-8 rounded-[6px] text-grayScale-400 hover:bg-red-50 hover:text-red-500"
onClick={() => handleDeleteClick(question)} onClick={() => handleDeleteClick(question)}
> >
<Trash2 className="h-4 w-4" /> <Trash2 className="h-4 w-4" />
@ -801,7 +801,7 @@ export function PracticeQuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Delete Question</h2> <h2 className="text-lg font-semibold text-grayScale-900">Delete Question</h2>
<button <button
onClick={() => setShowDeleteModal(false)} onClick={() => setShowDeleteModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -831,7 +831,7 @@ export function PracticeQuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Add New Question</h2> <h2 className="text-lg font-semibold text-grayScale-900">Add New Question</h2>
<button <button
onClick={() => setShowAddModal(false)} onClick={() => setShowAddModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -919,7 +919,7 @@ export function PracticeQuestionsPage() {
<button <button
type="button" type="button"
onClick={() => removeDraftOption(index)} onClick={() => removeDraftOption(index)}
className="rounded-lg p-1 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500" className="rounded-[6px] p-1 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500"
> >
<X className="h-4 w-4" /> <X className="h-4 w-4" />
</button> </button>
@ -929,7 +929,7 @@ export function PracticeQuestionsPage() {
<button <button
type="button" type="button"
onClick={addDraftOption} onClick={addDraftOption}
className="mt-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="mt-1 flex items-center gap-1.5 rounded-[6px] px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Add Option Add Option
@ -958,7 +958,7 @@ export function PracticeQuestionsPage() {
], ],
})) }))
} }
className={`flex-1 rounded-lg border-2 px-4 py-2.5 text-sm font-medium transition-colors ${ className={`flex-1 rounded-[6px] border-2 px-4 py-2.5 text-sm font-medium transition-colors ${
draft.options[i]?.isCorrect draft.options[i]?.isCorrect
? "border-green-500 bg-green-50 text-green-700" ? "border-green-500 bg-green-50 text-green-700"
: "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300" : "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300"
@ -1047,7 +1047,7 @@ export function PracticeQuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Question</h2> <h2 className="text-lg font-semibold text-grayScale-900">Edit Question</h2>
<button <button
onClick={() => setShowEditModal(false)} onClick={() => setShowEditModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -1135,7 +1135,7 @@ export function PracticeQuestionsPage() {
<button <button
type="button" type="button"
onClick={() => removeDraftOption(index)} onClick={() => removeDraftOption(index)}
className="rounded-lg p-1 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500" className="rounded-[6px] p-1 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500"
> >
<X className="h-4 w-4" /> <X className="h-4 w-4" />
</button> </button>
@ -1145,7 +1145,7 @@ export function PracticeQuestionsPage() {
<button <button
type="button" type="button"
onClick={addDraftOption} onClick={addDraftOption}
className="mt-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="mt-1 flex items-center gap-1.5 rounded-[6px] px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<Plus className="h-4 w-4" /> <Plus className="h-4 w-4" />
Add Option Add Option
@ -1174,7 +1174,7 @@ export function PracticeQuestionsPage() {
], ],
})) }))
} }
className={`flex-1 rounded-lg border-2 px-4 py-2.5 text-sm font-medium transition-colors ${ className={`flex-1 rounded-[6px] border-2 px-4 py-2.5 text-sm font-medium transition-colors ${
draft.options[i]?.isCorrect draft.options[i]?.isCorrect
? "border-green-500 bg-green-50 text-green-700" ? "border-green-500 bg-green-50 text-green-700"
: "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300" : "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300"

View File

@ -48,6 +48,10 @@ import type {
import { PublishPracticeButton } from "./components/PublishPracticeButton"; import { PublishPracticeButton } from "./components/PublishPracticeButton";
import { DisplayValue } from "../../lib/displayValue" import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight" import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
export function ProgramCoursesPage() { export function ProgramCoursesPage() {
const navigate = useNavigate(); const navigate = useNavigate();
@ -165,18 +169,23 @@ export function ProgramCoursesPage() {
setLoading(true); setLoading(true);
setError(null); setError(null);
try { try {
const [coursesRes, programsRes] = await Promise.all([ const [courseList, programRows] = await Promise.all([
getProgramCourses(programId, { limit: 100, offset: 0 }), fetchAllOffsetPages(async (offset, limit) =>
getLearningPrograms({ limit: 100, offset: 0 }), offsetPageFromListEnvelope<ProgramCourseListItem>(
await getProgramCourses(programId, { limit, offset }),
"courses",
),
),
fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<LearningProgramListItem>(
await getLearningPrograms({ limit, offset }),
"programs",
),
),
]); ]);
const programRows = programsRes.data?.data?.programs; const found = programRows.find((p) => p.id === programId) ?? null;
const list = Array.isArray(programRows) ? programRows : [];
const found = list.find((p) => p.id === programId) ?? null;
setProgram(found); setProgram(found);
const raw = coursesRes.data?.data?.courses;
const courseList = Array.isArray(raw) ? raw : [];
const sorted = [...courseList].sort( const sorted = [...courseList].sort(
(a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0), (a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0),
); );
@ -549,7 +558,7 @@ export function ProgramCoursesPage() {
/> />
<button <button
type="button" type="button"
className="relative w-full cursor-pointer rounded-2xl border-2 border-dashed border-[#9E289133] bg-white p-10 text-left transition-all hover:border-[#9E289180] disabled:cursor-not-allowed disabled:opacity-60" className="relative w-full cursor-pointer rounded-[6px] border-2 border-dashed border-[#9E289133] bg-white p-10 text-left transition-all hover:border-[#9E289180] disabled:cursor-not-allowed disabled:opacity-60"
disabled={createSaving || createUploadingThumbnail} disabled={createSaving || createUploadingThumbnail}
onClick={() => onClick={() =>
createThumbnailFileInputRef.current?.click() createThumbnailFileInputRef.current?.click()
@ -601,7 +610,7 @@ export function ProgramCoursesPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-12 min-w-[120px] rounded-xl border-grayScale-200 font-semibold" className="h-12 min-w-[120px] rounded-[6px] border-grayScale-200 font-semibold"
disabled={createSaving || createUploadingThumbnail} disabled={createSaving || createUploadingThumbnail}
onClick={() => onClick={() =>
handleCreateCourseDialogOpenChange(false) handleCreateCourseDialogOpenChange(false)
@ -611,7 +620,7 @@ export function ProgramCoursesPage() {
</Button> </Button>
<Button <Button
type="submit" type="submit"
className="h-12 min-w-[160px] rounded-xl bg-brand-500 font-semibold hover:bg-brand-600" className="h-12 min-w-[160px] rounded-[6px] bg-brand-500 font-semibold hover:bg-brand-600"
disabled={createSaving || createUploadingThumbnail} disabled={createSaving || createUploadingThumbnail}
> >
{createSaving ? "Creating…" : "Create Course"} {createSaving ? "Creating…" : "Create Course"}
@ -705,7 +714,7 @@ export function ProgramCoursesPage() {
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${course.name}`} aria-label={`Edit ${course.name}`}
onClick={() => openEditCourse(course)} onClick={() => openEditCourse(course)}
> >
@ -715,7 +724,7 @@ export function ProgramCoursesPage() {
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${course.name}`} aria-label={`Delete ${course.name}`}
onClick={() => setDeletingCourse(course)} onClick={() => setDeletingCourse(course)}
> >
@ -898,7 +907,7 @@ export function ProgramCoursesPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 shrink-0 rounded-xl border-grayScale-200 font-semibold" className="h-11 shrink-0 rounded-[6px] border-grayScale-200 font-semibold"
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
onClick={() => editThumbnailFileInputRef.current?.click()} onClick={() => editThumbnailFileInputRef.current?.click()}
> >
@ -958,7 +967,7 @@ export function ProgramCoursesPage() {
type="button" type="button"
onClick={() => !deleting && setDeletingCourse(null)} onClick={() => !deleting && setDeletingCourse(null)}
disabled={deleting} disabled={deleting}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600 disabled:pointer-events-none disabled:opacity-50"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -36,7 +36,11 @@ 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 { ContentPageDescription } from "./components/ContentPageDescription"; import { ContentPageDescription } from "./components/ContentPageDescription";
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types"; import type {
ContentAccessTier,
ExamPrepCatalogCourseItem,
PracticePublishStatus,
} from "../../types/course.types";
import { import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
hasActiveContentFilters, hasActiveContentFilters,
@ -46,6 +50,10 @@ import { uploadImageFile } from "../../api/files.api";
import uploadIcon from "../../assets/icons/upload.png"; import uploadIcon from "../../assets/icons/upload.png";
import { DisplayValue } from "../../lib/displayValue" import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight" import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
export function ProgramDetailPage() { export function ProgramDetailPage() {
const navigate = useNavigate(); const navigate = useNavigate();
@ -111,9 +119,12 @@ export function ProgramDetailPage() {
if (programType !== "proficiency") return; if (programType !== "proficiency") return;
setCatalogLoading(true); setCatalogLoading(true);
try { try {
const response = await getExamPrepCatalogCourses({ limit: 20, offset: 0 }); const list = await fetchAllOffsetPages(async (offset, limit) =>
const rows = response.data?.data?.catalog_courses; offsetPageFromListEnvelope<ExamPrepCatalogCourseItem>(
const list = Array.isArray(rows) ? rows : []; await getExamPrepCatalogCourses({ limit, offset }),
"catalog_courses",
),
);
setCreatedCourses( setCreatedCourses(
list.map((row) => ({ list.map((row) => ({
id: Number(row.id), id: Number(row.id),
@ -551,7 +562,7 @@ export function ProgramDetailPage() {
/> />
<button <button
type="button" type="button"
className="relative w-full cursor-pointer rounded-[12px] border-2 border-dashed border-grayScale-400 bg-white px-10 py-8 text-left transition-all hover:border-brand-300 disabled:cursor-not-allowed disabled:opacity-60" className="relative w-full cursor-pointer rounded-[6px] border-2 border-dashed border-grayScale-400 bg-white px-10 py-8 text-left transition-all hover:border-brand-300 disabled:cursor-not-allowed disabled:opacity-60"
disabled={creating || uploadingThumbnail} disabled={creating || uploadingThumbnail}
onClick={() => createThumbnailFileInputRef.current?.click()} onClick={() => createThumbnailFileInputRef.current?.click()}
> >
@ -606,14 +617,14 @@ export function ProgramDetailPage() {
<DialogClose asChild> <DialogClose asChild>
<Button <Button
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={creating || uploadingThumbnail} disabled={creating || uploadingThumbnail}
> >
Cancel Cancel
</Button> </Button>
</DialogClose> </DialogClose>
<Button <Button
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
disabled={creating || uploadingThumbnail} disabled={creating || uploadingThumbnail}
onClick={() => void handleCreateCourse()} onClick={() => void handleCreateCourse()}
> >
@ -695,7 +706,7 @@ export function ProgramDetailPage() {
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
onClick={() => openEditCourse(course)} onClick={() => openEditCourse(course)}
aria-label={`Edit ${course.name}`} aria-label={`Edit ${course.name}`}
> >
@ -705,7 +716,7 @@ export function ProgramDetailPage() {
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
onClick={() => setDeletingCourseId(Number(course.id))} onClick={() => setDeletingCourseId(Number(course.id))}
aria-label={`Delete ${course.name}`} aria-label={`Delete ${course.name}`}
> >
@ -784,7 +795,7 @@ export function ProgramDetailPage() {
{/* Action Button */} {/* Action Button */}
<Button <Button
className="w-full mt-4 h-10 bg-brand-500 text-white rounded-[8px] font-bold flex items-center justify-center gap-2 group/btn" className="w-full mt-4 h-10 bg-brand-500 text-white rounded-[6px] font-bold flex items-center justify-center gap-2 group/btn"
onClick={() => onClick={() =>
navigate(`/new-content/courses/${programType}/${course.id}`) navigate(`/new-content/courses/${programType}/${course.id}`)
} }
@ -847,7 +858,7 @@ export function ProgramDetailPage() {
/> />
<button <button
type="button" type="button"
className="relative w-full cursor-pointer rounded-[12px] border-2 border-dashed border-grayScale-400 bg-white px-10 py-8 text-left transition-all hover:border-brand-300 disabled:cursor-not-allowed disabled:opacity-60" className="relative w-full cursor-pointer rounded-[6px] border-2 border-dashed border-grayScale-400 bg-white px-10 py-8 text-left transition-all hover:border-brand-300 disabled:cursor-not-allowed disabled:opacity-60"
onClick={() => editThumbnailFileInputRef.current?.click()} onClick={() => editThumbnailFileInputRef.current?.click()}
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
> >
@ -888,7 +899,7 @@ export function ProgramDetailPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
onClick={closeEditCourse} onClick={closeEditCourse}
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
> >
@ -896,7 +907,7 @@ export function ProgramDetailPage() {
</Button> </Button>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
onClick={() => void handleSaveEditCourse()} onClick={() => void handleSaveEditCourse()}
disabled={savingEdit || uploadingEditThumbnail} disabled={savingEdit || uploadingEditThumbnail}
> >

View File

@ -207,7 +207,7 @@ export function QuestionTypeGroupDetailPage() {
Create a definition in this group or move an existing one here from the library. Create a definition in this group or move an existing one here from the library.
</p> </p>
<Link to={`/new-content/question-types/create?groupId=${group.id}`}> <Link to={`/new-content/question-types/create?groupId=${group.id}`}>
<Button size="sm" className="rounded-[8px] bg-brand-600 hover:bg-brand-500"> <Button size="sm" className="rounded-[6px] bg-brand-600 hover:bg-brand-500">
<Plus className="mr-2 h-4 w-4" /> <Plus className="mr-2 h-4 w-4" />
Create definition Create definition
</Button> </Button>

View File

@ -197,7 +197,7 @@ export function QuestionTypeLibraryPage() {
</p> </p>
</div> </div>
<Link to="/new-content/question-types/create"> <Link to="/new-content/question-types/create">
<Button className="h-12 px-8 rounded-[10px] bg-[#9E2891] font-bold text-white shadow-lg shadow-brand-500/10 hover:bg-[#8A237E] transition-all flex items-center gap-3"> <Button className="h-12 px-8 rounded-[6px] bg-[#9E2891] font-bold text-white shadow-lg shadow-brand-500/10 hover:bg-[#8A237E] transition-all flex items-center gap-3">
<Plus className="h-5 w-5" /> <Plus className="h-5 w-5" />
Create definition Create definition
</Button> </Button>
@ -223,7 +223,7 @@ export function QuestionTypeLibraryPage() {
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-[8px] border-grayScale-200" className="rounded-[6px] border-grayScale-200"
disabled={loading} disabled={loading}
onClick={() => { onClick={() => {
void load() void load()
@ -254,7 +254,7 @@ export function QuestionTypeLibraryPage() {
<button <button
type="button" type="button"
onClick={() => setQuery("")} onClick={() => setQuery("")}
className="absolute right-3 top-1/2 -translate-y-1/2 rounded-md p-1 text-grayScale-400 hover:bg-grayScale-100 hover:text-grayScale-600" className="absolute right-3 top-1/2 -translate-y-1/2 rounded-[6px] p-1 text-grayScale-400 hover:bg-grayScale-100 hover:text-grayScale-600"
aria-label="Clear search" aria-label="Clear search"
> >
<X className="h-4 w-4" /> <X className="h-4 w-4" />
@ -328,14 +328,14 @@ export function QuestionTypeLibraryPage() {
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-[8px]" className="rounded-[6px]"
onClick={clearFilters} onClick={clearFilters}
> >
Clear filters Clear filters
</Button> </Button>
) : ( ) : (
<Link to="/new-content/question-types/create"> <Link to="/new-content/question-types/create">
<Button size="sm" className="rounded-[8px] bg-brand-600 hover:bg-brand-500"> <Button size="sm" className="rounded-[6px] bg-brand-600 hover:bg-brand-500">
<Plus className="mr-2 h-4 w-4" /> <Plus className="mr-2 h-4 w-4" />
Create definition Create definition
</Button> </Button>
@ -414,7 +414,7 @@ export function QuestionTypeLibraryPage() {
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-[8px] border-grayScale-200" className="rounded-[6px] border-grayScale-200"
disabled={!canPrev || loading} disabled={!canPrev || loading}
onClick={() => setOffset((o) => Math.max(0, o - pageSize))} onClick={() => setOffset((o) => Math.max(0, o - pageSize))}
> >
@ -425,7 +425,7 @@ export function QuestionTypeLibraryPage() {
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-[8px] border-grayScale-200" className="rounded-[6px] border-grayScale-200"
disabled={!canNext || loading} disabled={!canNext || loading}
onClick={() => setOffset((o) => o + pageSize)} onClick={() => setOffset((o) => o + pageSize)}
> >
@ -511,7 +511,7 @@ function FilterChip({
disabled={disabled} disabled={disabled}
onClick={onClick} onClick={onClick}
className={cn( className={cn(
"rounded-full border px-3.5 py-1.5 text-xs font-semibold transition-all", "rounded-[6px] border px-3.5 py-1.5 text-xs font-semibold transition-all",
active active
? "border-brand-500 bg-brand-500 text-white shadow-sm shadow-brand-500/20" ? "border-brand-500 bg-brand-500 text-white shadow-sm shadow-brand-500/20"
: "border-grayScale-200 bg-white text-grayScale-600 hover:border-brand-200 hover:text-brand-600", : "border-grayScale-200 bg-white text-grayScale-600 hover:border-brand-200 hover:text-brand-600",

View File

@ -596,7 +596,7 @@ export function QuestionsPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)} onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1} disabled={safePage === 1}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === 1 && "cursor-not-allowed opacity-50", safePage === 1 && "cursor-not-allowed opacity-50",
)} )}
> >
@ -613,7 +613,7 @@ export function QuestionsPage() {
type="button" type="button"
onClick={() => setPage(n)} onClick={() => setPage(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === safePage n === safePage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50", : "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -627,7 +627,7 @@ export function QuestionsPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)} onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages} disabled={safePage === totalPages}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === totalPages && "cursor-not-allowed opacity-50", safePage === totalPages && "cursor-not-allowed opacity-50",
)} )}
> >
@ -648,7 +648,7 @@ export function QuestionsPage() {
</h2> </h2>
<button <button
onClick={() => setDeleteDialogOpen(false)} onClick={() => setDeleteDialogOpen(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -681,7 +681,7 @@ export function QuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Question Details</h2> <h2 className="text-lg font-semibold text-grayScale-900">Question Details</h2>
<button <button
onClick={() => setDetailsOpen(false)} onClick={() => setDetailsOpen(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -798,7 +798,7 @@ export function QuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Question</h2> <h2 className="text-lg font-semibold text-grayScale-900">Edit Question</h2>
<button <button
onClick={() => setEditOpen(false)} onClick={() => setEditOpen(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -1356,7 +1356,7 @@ export function SpeakingPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-10 w-full justify-between rounded-md border border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-700 hover:bg-grayScale-50" className="h-10 w-full justify-between rounded-[6px] border border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-700 hover:bg-grayScale-50"
> >
<span className="truncate"> <span className="truncate">
{selectedPracticeId {selectedPracticeId
@ -1442,7 +1442,7 @@ export function SpeakingPage() {
<div className="inline-flex items-center gap-2"> <div className="inline-flex items-center gap-2">
<button <button
type="button" type="button"
className="rounded-md border border-grayScale-200 bg-white p-1 text-grayScale-600 hover:bg-grayScale-50" className="rounded-[6px] border border-grayScale-200 bg-white p-1 text-grayScale-600 hover:bg-grayScale-50"
onClick={() => togglePracticeCollapsed(group.practiceId)} onClick={() => togglePracticeCollapsed(group.practiceId)}
> >
{group.practiceId && collapsedPracticeIds.includes(group.practiceId) ? ( {group.practiceId && collapsedPracticeIds.includes(group.practiceId) ? (
@ -2044,7 +2044,7 @@ export function SpeakingPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 w-full justify-between rounded-xl border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-600 hover:bg-grayScale-50" className="h-11 w-full justify-between rounded-[6px] border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-600 hover:bg-grayScale-50"
> >
<span className="truncate"> <span className="truncate">
{selectedSubCourseOption {selectedSubCourseOption
@ -2097,7 +2097,7 @@ export function SpeakingPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 w-full justify-between rounded-xl border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-600 hover:bg-grayScale-50" className="h-11 w-full justify-between rounded-[6px] border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-600 hover:bg-grayScale-50"
> >
<span>{setStatus}</span> <span>{setStatus}</span>
<ChevronDown className="h-4 w-4 text-grayScale-400" /> <ChevronDown className="h-4 w-4 text-grayScale-400" />
@ -2198,7 +2198,7 @@ export function SpeakingPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 w-full justify-between rounded-xl border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-600 hover:bg-grayScale-50" className="h-11 w-full justify-between rounded-[6px] border-grayScale-200 bg-white px-3 text-sm font-normal text-grayScale-600 hover:bg-grayScale-50"
> >
<span>{draft.difficulty}</span> <span>{draft.difficulty}</span>
<ChevronDown className="h-4 w-4 text-grayScale-400" /> <ChevronDown className="h-4 w-4 text-grayScale-400" />

View File

@ -83,7 +83,7 @@ export function SubCategoryCoursesPage() {
<div className="flex items-start gap-3.5"> <div className="flex items-start gap-3.5">
<Link <Link
to={`/content/category/${categoryId}/courses`} to={`/content/category/${categoryId}/courses`}
className="mt-0.5 grid h-9 w-9 shrink-0 place-items-center rounded-xl bg-grayScale-50 text-grayScale-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="mt-0.5 grid h-9 w-9 shrink-0 place-items-center rounded-[6px] bg-grayScale-50 text-grayScale-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
</Link> </Link>
@ -113,7 +113,7 @@ export function SubCategoryCoursesPage() {
navigate(`/content/category/${categoryId}/courses/${c.id}/sub-modules`) navigate(`/content/category/${categoryId}/courses/${c.id}/sub-modules`)
} }
className={cn( className={cn(
"flex w-full items-center justify-between gap-4 rounded-xl border border-grayScale-200 bg-white px-4 py-4 text-left shadow-sm transition-all", "flex w-full items-center justify-between gap-4 rounded-[6px] border border-grayScale-200 bg-white px-4 py-4 text-left shadow-sm transition-all",
"hover:border-brand-200 hover:bg-brand-50/40 hover:shadow-md", "hover:border-brand-200 hover:bg-brand-50/40 hover:shadow-md",
)} )}
> >

View File

@ -631,13 +631,13 @@ export function SubModuleContentPage() {
<div className="flex gap-0.5" onClick={(e) => e.stopPropagation()}> <div className="flex gap-0.5" onClick={(e) => e.stopPropagation()}>
<button <button
onClick={() => handleEditClick(practice)} onClick={() => handleEditClick(practice)}
className="rounded-lg p-1.5 text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-700" className="rounded-[6px] p-1.5 text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-700"
> >
<Edit className="h-4 w-4" /> <Edit className="h-4 w-4" />
</button> </button>
<button <button
onClick={() => handleDeleteClick(practice)} onClick={() => handleDeleteClick(practice)}
className="rounded-lg p-1.5 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500" className="rounded-[6px] p-1.5 text-grayScale-400 transition-colors hover:bg-red-50 hover:text-red-500"
> >
<Trash2 className="h-4 w-4" /> <Trash2 className="h-4 w-4" />
</button> </button>
@ -718,7 +718,7 @@ export function SubModuleContentPage() {
<div className="relative"> <div className="relative">
<button <button
onClick={() => setOpenVideoMenuId(openVideoMenuId === video.id ? null : video.id)} onClick={() => setOpenVideoMenuId(openVideoMenuId === video.id ? null : video.id)}
className="rounded-lg p-1.5 text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="rounded-[6px] p-1.5 text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<MoreVertical className="h-4 w-4" /> <MoreVertical className="h-4 w-4" />
</button> </button>
@ -918,7 +918,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Delete Practice</h2> <h2 className="text-lg font-semibold text-grayScale-900">Delete Practice</h2>
<button <button
onClick={() => setShowDeleteModal(false)} onClick={() => setShowDeleteModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -949,7 +949,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Practice</h2> <h2 className="text-lg font-semibold text-grayScale-900">Edit Practice</h2>
<button <button
onClick={() => setShowEditPracticeModal(false)} onClick={() => setShowEditPracticeModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -1007,7 +1007,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Add Video</h2> <h2 className="text-lg font-semibold text-grayScale-900">Add Video</h2>
<button <button
onClick={() => { setShowAddVideoModal(false); setVideoFile(null) }} onClick={() => { setShowAddVideoModal(false); setVideoFile(null) }}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -1150,7 +1150,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Video</h2> <h2 className="text-lg font-semibold text-grayScale-900">Edit Video</h2>
<button <button
onClick={() => setShowEditVideoModal(false)} onClick={() => setShowEditVideoModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -1208,7 +1208,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Delete Video</h2> <h2 className="text-lg font-semibold text-grayScale-900">Delete Video</h2>
<button <button
onClick={() => setShowDeleteVideoModal(false)} onClick={() => setShowDeleteVideoModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>
@ -1248,7 +1248,7 @@ export function SubModuleContentPage() {
</div> </div>
<button <button
onClick={() => setShowPreviewModal(false)} onClick={() => setShowPreviewModal(false)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -195,7 +195,7 @@ export function SubModulesPage() {
<div className="flex items-start gap-3 min-w-0"> <div className="flex items-start gap-3 min-w-0">
<Link <Link
to={`/content/category/${categoryId}/courses`} to={`/content/category/${categoryId}/courses`}
className="mt-1 grid h-9 w-9 shrink-0 place-items-center rounded-xl border border-grayScale-200 bg-white text-grayScale-500 shadow-sm transition-all hover:border-brand-200 hover:bg-brand-50 hover:text-brand-600" className="mt-1 grid h-9 w-9 shrink-0 place-items-center rounded-[6px] border border-grayScale-200 bg-white text-grayScale-500 shadow-sm transition-all hover:border-brand-200 hover:bg-brand-50 hover:text-brand-600"
> >
<ArrowLeft className="h-4 w-4" /> <ArrowLeft className="h-4 w-4" />
</Link> </Link>

View File

@ -42,7 +42,12 @@ 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 { ContentPageDescription } from "./components/ContentPageDescription"; import { ContentPageDescription } from "./components/ContentPageDescription";
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types"; import type {
ContentAccessTier,
ExamPrepCatalogUnitItem,
ExamPrepUnitModuleItem,
PracticePublishStatus,
} from "../../types/course.types";
import { import {
filterBySearchAndPublishStatus, filterBySearchAndPublishStatus,
type PublishStatusFilter, type PublishStatusFilter,
@ -52,6 +57,10 @@ import { UnitPracticesPanel } from "./components/UnitPracticesPanel";
import { cn } from "../../lib/utils"; import { cn } from "../../lib/utils";
import { DisplayValue } from "../../lib/displayValue" import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight" import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
export function UnitManagementPage() { export function UnitManagementPage() {
const navigate = useNavigate(); const navigate = useNavigate();
@ -172,12 +181,12 @@ export function UnitManagementPage() {
return; return;
} }
try { try {
const response = await getExamPrepCatalogUnits(catalogCourseId, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 100, offsetPageFromListEnvelope<ExamPrepCatalogUnitItem>(
offset: 0, await getExamPrepCatalogUnits(catalogCourseId, { limit, offset }),
}); "units",
const rows = response.data?.data?.units; ),
const list = Array.isArray(rows) ? rows : []; );
const row = list.find((u) => Number(u.id) === parsedUnitId); const row = list.find((u) => Number(u.id) === parsedUnitId);
if (row) { if (row) {
setUnitDisplayName(row.name?.trim() || `Unit ${parsedUnitId}`); setUnitDisplayName(row.name?.trim() || `Unit ${parsedUnitId}`);
@ -201,12 +210,12 @@ export function UnitManagementPage() {
} }
setModulesLoading(true); setModulesLoading(true);
try { try {
const response = await getExamPrepUnitModules(parsedUnitId, { const list = await fetchAllOffsetPages(async (offset, limit) =>
limit: 20, offsetPageFromListEnvelope<ExamPrepUnitModuleItem>(
offset: 0, await getExamPrepUnitModules(parsedUnitId, { limit, offset }),
}); "modules",
const rows = response.data?.data?.modules; ),
const list = Array.isArray(rows) ? rows : []; );
setModules( setModules(
list.map((row, index) => ({ list.map((row, index) => ({
id: Number(row.id), id: Number(row.id),
@ -614,7 +623,7 @@ export function UnitManagementPage() {
<DialogTitle className="text-[20px] font-bold relative top-2 text-grayScale-900"> <DialogTitle className="text-[20px] font-bold relative top-2 text-grayScale-900">
Create Modules Create Modules
</DialogTitle> </DialogTitle>
<DialogClose className="rounded-full p-1.5 hover:bg-grayScale-50 transition-colors"> <DialogClose className="rounded-[6px] p-1.5 hover:bg-grayScale-50 transition-colors">
<X className="h-5 w-5 text-grayScale-400" /> <X className="h-5 w-5 text-grayScale-400" />
<span className="sr-only">Close</span> <span className="sr-only">Close</span>
</DialogClose> </DialogClose>
@ -764,7 +773,7 @@ export function UnitManagementPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={creating || uploadingThumbnail || uploadingIcon} disabled={creating || uploadingThumbnail || uploadingIcon}
onClick={clearCreateModuleForm} onClick={clearCreateModuleForm}
> >
@ -773,7 +782,7 @@ export function UnitManagementPage() {
</DialogClose> </DialogClose>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
onClick={() => void handleCreateModule()} onClick={() => void handleCreateModule()}
disabled={creating || uploadingThumbnail || uploadingIcon} disabled={creating || uploadingThumbnail || uploadingIcon}
> >
@ -889,7 +898,7 @@ export function UnitManagementPage() {
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
onClick={() => openEditModule(module)} onClick={() => openEditModule(module)}
aria-label={`Edit ${module.name}`} aria-label={`Edit ${module.name}`}
> >
@ -899,7 +908,7 @@ export function UnitManagementPage() {
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
onClick={() => setDeletingModuleId(module.id)} onClick={() => setDeletingModuleId(module.id)}
aria-label={`Delete ${module.name}`} aria-label={`Delete ${module.name}`}
> >
@ -1154,7 +1163,7 @@ export function UnitManagementPage() {
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-11 px-8 rounded-[8px] border-grayScale-200 text-grayScale-700 font-bold" className="h-11 px-8 rounded-[6px] border-grayScale-200 text-grayScale-700 font-bold"
disabled={savingEdit || uploadingEditThumbnail || uploadingEditIcon} disabled={savingEdit || uploadingEditThumbnail || uploadingEditIcon}
onClick={closeEditModule} onClick={closeEditModule}
> >
@ -1162,7 +1171,7 @@ export function UnitManagementPage() {
</Button> </Button>
<Button <Button
type="button" type="button"
className="h-11 px-8 rounded-[8px] bg-brand-500 text-white font-bold hover:bg-brand-600" className="h-11 px-8 rounded-[6px] bg-brand-500 text-white font-bold hover:bg-brand-600"
onClick={() => void handleSaveEditModule()} onClick={() => void handleSaveEditModule()}
disabled={savingEdit || uploadingEditThumbnail || uploadingEditIcon} disabled={savingEdit || uploadingEditThumbnail || uploadingEditIcon}
> >

View File

@ -201,7 +201,7 @@ export function AddModuleModal({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-12 min-w-[120px] rounded-xl border-grayScale-200 font-semibold" className="h-12 min-w-[120px] rounded-[6px] border-grayScale-200 font-semibold"
disabled={submitting || iconUploadBusy} disabled={submitting || iconUploadBusy}
> >
Cancel Cancel
@ -209,7 +209,7 @@ export function AddModuleModal({
</DialogClose> </DialogClose>
<Button <Button
type="submit" type="submit"
className="h-12 min-w-[160px] rounded-xl bg-brand-500 font-semibold text-white shadow-lg shadow-brand-500/20 hover:bg-brand-600" className="h-12 min-w-[160px] rounded-[6px] bg-brand-500 font-semibold text-white shadow-lg shadow-brand-500/20 hover:bg-brand-600"
disabled={submitting || iconUploadBusy} disabled={submitting || iconUploadBusy}
> >
{submitting ? "Creating…" : "Create module"} {submitting ? "Creating…" : "Create module"}

View File

@ -9,6 +9,7 @@ import {
setExamPrepPracticePublishStatus, setExamPrepPracticePublishStatus,
} from "../../../api/courses.api" } from "../../../api/courses.api"
import { unwrapPracticesList } from "../../../lib/parentContextPractice" import { unwrapPracticesList } from "../../../lib/parentContextPractice"
import { fetchAllOffsetPages } from "../../../lib/fetchAllOffsetPages"
import { parentsFromPractice } from "../../../lib/practiceParents" import { parentsFromPractice } from "../../../lib/practiceParents"
import { import {
isPracticeParentUnlinkNotLinkedError, isPracticeParentUnlinkNotLinkedError,
@ -85,10 +86,16 @@ export function CatalogCoursePracticesPanel({
setLoading(true) setLoading(true)
setLoadError(null) setLoadError(null)
try { try {
const res = await getExamPrepCatalogCoursePractices(catalogCourseId) const list = await fetchAllOffsetPages(async (offset, limit) => {
const { practices: list, totalCount: total } = extractPracticesPage(res) const res = await getExamPrepCatalogCoursePractices(catalogCourseId, {
limit,
offset,
})
const { practices, totalCount } = extractPracticesPage(res)
return { items: practices, total_count: totalCount }
})
setPractices(list) setPractices(list)
setTotalCount(total) setTotalCount(list.length)
} catch (error) { } catch (error) {
setPractices([]) setPractices([])
setTotalCount(0) setTotalCount(0)

View File

@ -25,6 +25,16 @@ import {
sortBySortOrder, sortBySortOrder,
type BaseItem, type BaseItem,
} from "./ContentHierarchyList" } from "./ContentHierarchyList"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../../lib/fetchAllOffsetPages"
import type {
ExamPrepCatalogCourseItem,
ExamPrepCatalogUnitItem,
ExamPrepModuleLessonItem,
ExamPrepUnitModuleItem,
} from "../../../types/course.types"
interface CatalogCourse extends BaseItem {} interface CatalogCourse extends BaseItem {}
interface Unit extends BaseItem { interface Unit extends BaseItem {
@ -37,8 +47,6 @@ interface ModuleLesson extends BaseItem {
moduleId: string moduleId: string
} }
const FETCH_LIMIT = 500
export function ExamPrepContentHierarchyList() { export function ExamPrepContentHierarchyList() {
const [catalogCourses, setCatalogCourses] = useState<CatalogCourse[]>([]) const [catalogCourses, setCatalogCourses] = useState<CatalogCourse[]>([])
const [units, setUnits] = useState<Unit[]>([]) const [units, setUnits] = useState<Unit[]>([])
@ -52,13 +60,13 @@ export function ExamPrepContentHierarchyList() {
const fetchHierarchy = useCallback(async () => { const fetchHierarchy = useCallback(async () => {
setLoading({ catalogCourse: true }) setLoading({ catalogCourse: true })
try { try {
const coursesRes = await getExamPrepCatalogCourses({ const catalogRows = await fetchAllOffsetPages(async (offset, limit) =>
limit: FETCH_LIMIT, offsetPageFromListEnvelope<ExamPrepCatalogCourseItem>(
offset: 0, await getExamPrepCatalogCourses({ limit, offset }),
}) "catalog_courses",
const fetchedCourses: CatalogCourse[] = sortBySortOrder( ),
coursesRes.data?.data?.catalog_courses ?? [], )
).map((c) => ({ const fetchedCourses: CatalogCourse[] = sortBySortOrder(catalogRows).map((c) => ({
id: String(c.id), id: String(c.id),
name: c.name, name: c.name,
thumbnail: c.thumbnail ?? undefined, thumbnail: c.thumbnail ?? undefined,
@ -76,11 +84,16 @@ export function ExamPrepContentHierarchyList() {
setLoading((prev) => ({ ...prev, unit: true })) setLoading((prev) => ({ ...prev, unit: true }))
const unitsResults = await Promise.all( const unitsResults = await Promise.all(
fetchedCourses.map((c) => fetchedCourses.map((c) =>
getExamPrepCatalogUnits(Number(c.id), { limit: FETCH_LIMIT, offset: 0 }), fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepCatalogUnitItem>(
await getExamPrepCatalogUnits(Number(c.id), { limit, offset }),
"units",
),
),
), ),
) )
const fetchedUnits: Unit[] = unitsResults.flatMap((res, idx) => const fetchedUnits: Unit[] = unitsResults.flatMap((rows, idx) =>
sortBySortOrder(res.data?.data?.units ?? []).map((u) => ({ sortBySortOrder(rows).map((u) => ({
id: String(u.id), id: String(u.id),
name: u.name, name: u.name,
thumbnail: u.thumbnail ?? undefined, thumbnail: u.thumbnail ?? undefined,
@ -99,11 +112,16 @@ export function ExamPrepContentHierarchyList() {
setLoading((prev) => ({ ...prev, module: true })) setLoading((prev) => ({ ...prev, module: true }))
const modulesResults = await Promise.all( const modulesResults = await Promise.all(
fetchedUnits.map((u) => fetchedUnits.map((u) =>
getExamPrepUnitModules(Number(u.id), { limit: FETCH_LIMIT, offset: 0 }), fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepUnitModuleItem>(
await getExamPrepUnitModules(Number(u.id), { limit, offset }),
"modules",
),
),
), ),
) )
const fetchedModules: UnitModule[] = modulesResults.flatMap((res, idx) => const fetchedModules: UnitModule[] = modulesResults.flatMap((rows, idx) =>
sortBySortOrder(res.data?.data?.modules ?? []).map((m) => ({ sortBySortOrder(rows).map((m) => ({
id: String(m.id), id: String(m.id),
name: m.name, name: m.name,
thumbnail: m.thumbnail ?? m.icon ?? undefined, thumbnail: m.thumbnail ?? m.icon ?? undefined,
@ -121,11 +139,16 @@ export function ExamPrepContentHierarchyList() {
setLoading((prev) => ({ ...prev, lesson: true })) setLoading((prev) => ({ ...prev, lesson: true }))
const lessonsResults = await Promise.all( const lessonsResults = await Promise.all(
fetchedModules.map((m) => fetchedModules.map((m) =>
getExamPrepModuleLessons(Number(m.id), { limit: FETCH_LIMIT, offset: 0 }), fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepModuleLessonItem>(
await getExamPrepModuleLessons(Number(m.id), { limit, offset }),
"lessons",
),
),
), ),
) )
const fetchedLessons: ModuleLesson[] = lessonsResults.flatMap((res, idx) => const fetchedLessons: ModuleLesson[] = lessonsResults.flatMap((rows, idx) =>
sortBySortOrder(res.data?.data?.lessons ?? []).map((l) => ({ sortBySortOrder(rows).map((l) => ({
id: String(l.id), id: String(l.id),
name: l.title, name: l.title,
thumbnail: l.thumbnail ?? undefined, thumbnail: l.thumbnail ?? undefined,

View File

@ -197,7 +197,7 @@ export function LessonMediaUploadField({
onDragLeave={handleDragLeave} onDragLeave={handleDragLeave}
onDrop={handleDrop} onDrop={handleDrop}
className={cn( className={cn(
"flex w-full cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-[#9E289133] bg-white p-10 text-center transition-colors", "flex w-full cursor-pointer flex-col items-center justify-center rounded-[6px] border-2 border-dashed border-[#9E289133] bg-white p-10 text-center transition-colors",
"hover:border-[#9E289180] hover:bg-grayScale-50/30", "hover:border-[#9E289180] hover:bg-grayScale-50/30",
dragActive && "border-[#9E2891] bg-[#9E289108]", dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60", zoneDisabled && "cursor-not-allowed opacity-60",

View File

@ -126,7 +126,7 @@ export function ModuleIconUploadField({
onDragLeave={handleDragLeave} onDragLeave={handleDragLeave}
onDrop={handleDrop} onDrop={handleDrop}
className={cn( className={cn(
"flex w-full cursor-pointer flex-col items-center justify-center rounded-2xl border-2 border-dashed border-[#9E289133] bg-white p-10 text-center transition-colors", "flex w-full cursor-pointer flex-col items-center justify-center rounded-[6px] border-2 border-dashed border-[#9E289133] bg-white p-10 text-center transition-colors",
"hover:border-[#9E289180] hover:bg-grayScale-50/30", "hover:border-[#9E289180] hover:bg-grayScale-50/30",
dragActive && "border-[#9E2891] bg-[#9E289108]", dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60", zoneDisabled && "cursor-not-allowed opacity-60",

View File

@ -117,7 +117,7 @@ export function ModulePracticeCard({
type="button" type="button"
variant="ghost" variant="ghost"
size="icon" size="icon"
className="h-8 w-8 flex-shrink-0 rounded-full text-grayScale-400 hover:bg-grayScale-50 hover:text-grayScale-600" className="h-8 w-8 flex-shrink-0 rounded-[6px] text-grayScale-400 hover:bg-grayScale-50 hover:text-grayScale-600"
disabled={statusUpdating} disabled={statusUpdating}
aria-label={`Practice options: ${practice.title}`} aria-label={`Practice options: ${practice.title}`}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
@ -177,7 +177,7 @@ export function ModulePracticeCard({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-10 w-full rounded-[10px] border-brand-500 text-[12px] font-bold text-brand-500 hover:bg-brand-50" className="h-10 w-full rounded-[6px] border-brand-500 text-[12px] font-bold text-brand-500 hover:bg-brand-50"
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
onEdit?.(); onEdit?.();
@ -190,7 +190,7 @@ export function ModulePracticeCard({
type="button" type="button"
disabled={isPublished || statusUpdating} disabled={isPublished || statusUpdating}
className={cn( className={cn(
"h-10 w-full rounded-[10px] text-[12px] font-bold shadow-sm transition-all", "h-10 w-full rounded-[6px] text-[12px] font-bold shadow-sm transition-all",
isPublished isPublished
? "cursor-default bg-[#ECD5E9] text-[#9E2891] hover:bg-[#ECD5E9]" ? "cursor-default bg-[#ECD5E9] text-[#9E2891] hover:bg-[#ECD5E9]"
: "bg-brand-500 text-white hover:bg-brand-600", : "bg-brand-500 text-white hover:bg-brand-600",

View File

@ -71,7 +71,7 @@ export function PracticeActionChoiceDialog({
onOpenChange(false) onOpenChange(false)
navigate(createHref) navigate(createHref)
}} }}
className="group flex flex-col gap-3 rounded-xl border border-grayScale-200 bg-white p-5 text-left transition-all hover:border-brand-300 hover:shadow-md" className="group flex flex-col gap-3 rounded-[6px] border border-grayScale-200 bg-white p-5 text-left transition-all hover:border-brand-300 hover:shadow-md"
> >
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-brand-50 text-brand-600"> <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-brand-50 text-brand-600">
<Plus className="h-5 w-5" /> <Plus className="h-5 w-5" />
@ -87,7 +87,7 @@ export function PracticeActionChoiceDialog({
<button <button
type="button" type="button"
onClick={openAttachPage} onClick={openAttachPage}
className="group flex flex-col gap-3 rounded-xl border border-grayScale-200 bg-white p-5 text-left transition-all hover:border-brand-300 hover:shadow-md" className="group flex flex-col gap-3 rounded-[6px] border border-grayScale-200 bg-white p-5 text-left transition-all hover:border-brand-300 hover:shadow-md"
> >
<div className="flex h-10 w-10 items-center justify-center rounded-lg bg-violet-50 text-violet-700"> <div className="flex h-10 w-10 items-center justify-center rounded-lg bg-violet-50 text-violet-700">
<Link2 className="h-5 w-5" /> <Link2 className="h-5 w-5" />
@ -105,7 +105,7 @@ export function PracticeActionChoiceDialog({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="w-full rounded-[8px]" className="w-full rounded-[6px]"
onClick={() => onOpenChange(false)} onClick={() => onOpenChange(false)}
> >
Cancel Cancel

View File

@ -148,7 +148,7 @@ export function QuestionTypeDefinitionPracticesDialog({
<Button <Button
type="button" type="button"
size="sm" size="sm"
className="rounded-[8px] bg-brand-600 hover:bg-brand-500" className="rounded-[6px] bg-brand-600 hover:bg-brand-500"
onClick={handleCreatePractice} onClick={handleCreatePractice}
> >
<Plus className="mr-1.5 h-4 w-4" /> <Plus className="mr-1.5 h-4 w-4" />
@ -179,7 +179,7 @@ export function QuestionTypeDefinitionPracticesDialog({
<Button <Button
type="button" type="button"
size="sm" size="sm"
className="mt-2 rounded-[8px] bg-brand-600 hover:bg-brand-500" className="mt-2 rounded-[6px] bg-brand-600 hover:bg-brand-500"
onClick={handleCreatePractice} onClick={handleCreatePractice}
> >
<Plus className="mr-1.5 h-4 w-4" /> <Plus className="mr-1.5 h-4 w-4" />
@ -218,7 +218,7 @@ export function QuestionTypeDefinitionPracticesDialog({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-8 rounded-[8px] border-grayScale-200 px-3 text-xs font-semibold" className="h-8 rounded-[6px] border-grayScale-200 px-3 text-xs font-semibold"
disabled={editingPracticeId === practice.practice_id} disabled={editingPracticeId === practice.practice_id}
onClick={() => void handleEditPractice(practice)} onClick={() => void handleEditPractice(practice)}
> >
@ -284,7 +284,7 @@ export function QuestionTypeDefinitionPracticesDialog({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-[8px] border-grayScale-200" className="rounded-[6px] border-grayScale-200"
disabled={!canPrev || loading} disabled={!canPrev || loading}
onClick={() => setOffset((o) => Math.max(0, o - pageSize))} onClick={() => setOffset((o) => Math.max(0, o - pageSize))}
> >
@ -295,7 +295,7 @@ export function QuestionTypeDefinitionPracticesDialog({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="rounded-[8px] border-grayScale-200" className="rounded-[6px] border-grayScale-200"
disabled={!canNext || loading} disabled={!canNext || loading}
onClick={() => setOffset((o) => o + pageSize)} onClick={() => setOffset((o) => o + pageSize)}
> >

View File

@ -9,6 +9,7 @@ import {
setExamPrepPracticePublishStatus, setExamPrepPracticePublishStatus,
} from "../../../api/courses.api" } from "../../../api/courses.api"
import { unwrapPracticesList } from "../../../lib/parentContextPractice" import { unwrapPracticesList } from "../../../lib/parentContextPractice"
import { fetchAllOffsetPages } from "../../../lib/fetchAllOffsetPages"
import { parentsFromPractice } from "../../../lib/practiceParents" import { parentsFromPractice } from "../../../lib/practiceParents"
import { import {
isPracticeParentUnlinkNotLinkedError, isPracticeParentUnlinkNotLinkedError,
@ -87,10 +88,13 @@ export function UnitPracticesPanel({
setLoading(true) setLoading(true)
setLoadError(null) setLoadError(null)
try { try {
const res = await getExamPrepUnitPractices(unitId) const list = await fetchAllOffsetPages(async (offset, limit) => {
const { practices: list, totalCount: total } = extractPracticesPage(res) const res = await getExamPrepUnitPractices(unitId, { limit, offset })
const { practices, totalCount } = extractPracticesPage(res)
return { items: practices, total_count: totalCount }
})
setPractices(list) setPractices(list)
setTotalCount(total) setTotalCount(list.length)
} catch (error) { } catch (error) {
setPractices([]) setPractices([])
setTotalCount(0) setTotalCount(0)

View File

@ -314,7 +314,7 @@ export function VideoCard({
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-brand-600 shadow-sm transition-colors hover:bg-brand-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-brand-600 shadow-sm transition-colors hover:bg-brand-50"
aria-label={`View practices for ${title}`} aria-label={`View practices for ${title}`}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -329,7 +329,7 @@ export function VideoCard({
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-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${title}`} aria-label={`Edit ${title}`}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -344,7 +344,7 @@ export function VideoCard({
type="button" type="button"
variant="secondary" variant="secondary"
size="icon" size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50" className="h-8 w-8 rounded-[6px] bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
aria-label={`Delete ${title}`} aria-label={`Delete ${title}`}
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@ -548,7 +548,7 @@ export function VideoCard({
{!hoverModuleActions ? ( {!hoverModuleActions ? (
<button <button
type="button" type="button"
className="h-8 w-8 flex flex-shrink-0 items-center justify-center rounded-full hover:bg-grayScale-50 transition-colors text-grayScale-400" className="h-8 w-8 flex flex-shrink-0 items-center justify-center rounded-[6px] hover:bg-grayScale-50 transition-colors text-grayScale-400"
> >
<MoreVertical className="h-5 w-5" /> <MoreVertical className="h-5 w-5" />
</button> </button>
@ -574,7 +574,7 @@ export function VideoCard({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-9 w-full rounded-lg border-brand-200 text-[12px] font-bold text-brand-600 hover:bg-brand-50" className="h-9 w-full rounded-[6px] border-brand-200 text-[12px] font-bold text-brand-600 hover:bg-brand-50"
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
onAddPractice(); onAddPractice();
@ -592,7 +592,7 @@ export function VideoCard({
<Button <Button
variant="outline" variant="outline"
onClick={onEdit} onClick={onEdit}
className="w-full h-10 rounded-xl border-grayScale-200 text-grayScale-600 font-bold hover:bg-grayScale-50 transition-all flex items-center justify-center gap-2" className="w-full h-10 rounded-[6px] border-grayScale-200 text-grayScale-600 font-bold hover:bg-grayScale-50 transition-all flex items-center justify-center gap-2"
> >
<Edit2 className="h-4 w-4" /> <Edit2 className="h-4 w-4" />
Edit Edit
@ -602,7 +602,7 @@ export function VideoCard({
disabled={status === "Published"} disabled={status === "Published"}
onClick={onPublish} onClick={onPublish}
className={cn( className={cn(
"w-full h-10 rounded-xl font-bold transition-all shadow-sm", "w-full h-10 rounded-[6px] font-bold transition-all shadow-sm",
status === "Published" status === "Published"
? "bg-[#E9D5E5] text-white opacity-100 cursor-default" ? "bg-[#E9D5E5] text-white opacity-100 cursor-default"
: "bg-brand-500 text-white hover:bg-brand-600 shadow-brand-500/10", : "bg-brand-500 text-white hover:bg-brand-600 shadow-brand-500/10",

View File

@ -153,7 +153,7 @@ export function ContextStep({
<button <button
type="button" type="button"
onClick={() => setParentsExpanded((open) => !open)} onClick={() => setParentsExpanded((open) => !open)}
className="flex w-full items-center justify-between rounded-xl border border-grayScale-200 bg-grayScale-50/60 px-4 py-3 text-left transition-colors hover:bg-grayScale-50" className="flex w-full items-center justify-between rounded-[6px] border border-grayScale-200 bg-grayScale-50/60 px-4 py-3 text-left transition-colors hover:bg-grayScale-50"
> >
<div> <div>
<p className="text-sm font-semibold text-grayScale-800">Locations (optional)</p> <p className="text-sm font-semibold text-grayScale-800">Locations (optional)</p>

View File

@ -80,7 +80,7 @@ export function PersonaStep({
type="button" type="button"
onClick={() => setSelectedPersona(persona.id)} onClick={() => setSelectedPersona(persona.id)}
className={cn( className={cn(
"group relative w-full cursor-pointer rounded-2xl border-2 bg-white p-6 text-left transition-all duration-300", "group relative w-full cursor-pointer rounded-[6px] border-2 bg-white p-6 text-left transition-all duration-300",
isSelected isSelected
? "border-brand-500 shadow-md shadow-brand-100/50" ? "border-brand-500 shadow-md shadow-brand-100/50"
: "border-grayScale-100 hover:border-brand-200", : "border-grayScale-100 hover:border-brand-200",

View File

@ -244,7 +244,7 @@ export function PracticeParentsField({
size="sm" size="sm"
disabled={disabled || Boolean(unlinkingKey)} disabled={disabled || Boolean(unlinkingKey)}
onClick={addRow} onClick={addRow}
className="rounded-[8px] border-grayScale-200 text-xs font-semibold" className="rounded-[6px] border-grayScale-200 text-xs font-semibold"
> >
<Plus className="mr-1.5 h-3.5 w-3.5" /> <Plus className="mr-1.5 h-3.5 w-3.5" />
Add location Add location

View File

@ -84,7 +84,7 @@ export function ReviewAudioPlayer({
> >
<button <button
type="button" type="button"
className="flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-brand-500 text-white shadow-sm transition-colors hover:bg-brand-600" className="flex h-8 w-8 shrink-0 items-center justify-center rounded-[6px] bg-brand-500 text-white shadow-sm transition-colors hover:bg-brand-600"
aria-label={`Play ${fileName}`} aria-label={`Play ${fileName}`}
onClick={() => { onClick={() => {
const audio = new Audio(src); const audio = new Audio(src);
@ -196,7 +196,7 @@ export function PracticeSequentialReview({
<button <button
type="button" type="button"
onClick={onEditContext} onClick={onEditContext}
className="flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="flex items-center gap-1.5 rounded-[6px] px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<Edit className="h-3.5 w-3.5" /> <Edit className="h-3.5 w-3.5" />
Edit Edit
@ -335,7 +335,7 @@ export function PracticeSequentialReview({
<button <button
type="button" type="button"
onClick={onEditQuestions} onClick={onEditQuestions}
className="flex items-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600" className="flex items-center gap-1.5 rounded-[6px] px-2 py-1 text-sm font-medium text-brand-500 transition-colors hover:bg-brand-50 hover:text-brand-600"
> >
<Edit className="h-3.5 w-3.5" /> <Edit className="h-3.5 w-3.5" />
Edit Edit

View File

@ -349,7 +349,7 @@ export function QuestionBankAttachDialog({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="rounded-lg" className="rounded-[6px]"
onClick={() => onOpenChange(false)} onClick={() => onOpenChange(false)}
disabled={attaching} disabled={attaching}
> >
@ -357,7 +357,7 @@ export function QuestionBankAttachDialog({
</Button> </Button>
<Button <Button
type="button" type="button"
className="rounded-lg bg-brand-500 text-white hover:bg-brand-600" className="rounded-[6px] bg-brand-500 text-white hover:bg-brand-600"
onClick={handleAttach} onClick={handleAttach}
disabled={attaching || selectedIds.length === 0} disabled={attaching || selectedIds.length === 0}
> >

View File

@ -677,7 +677,7 @@ export function QuestionsStep({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-9 gap-2 rounded-lg border-grayScale-200 text-grayScale-700" className="h-9 gap-2 rounded-[6px] border-grayScale-200 text-grayScale-700"
onClick={collapseAllQuestions} onClick={collapseAllQuestions}
> >
<ChevronsDownUp className="h-4 w-4" /> <ChevronsDownUp className="h-4 w-4" />
@ -687,7 +687,7 @@ export function QuestionsStep({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-9 gap-2 rounded-lg border-grayScale-200 text-grayScale-700" className="h-9 gap-2 rounded-[6px] border-grayScale-200 text-grayScale-700"
onClick={expandAllQuestions} onClick={expandAllQuestions}
> >
<ChevronsUpDown className="h-4 w-4" /> <ChevronsUpDown className="h-4 w-4" />
@ -747,7 +747,7 @@ export function QuestionsStep({
{canReorder ? ( {canReorder ? (
<button <button
{...dragHandleProps} {...dragHandleProps}
className="mt-0.5 shrink-0 cursor-grab touch-none rounded-lg p-1 text-grayScale-400 transition-colors hover:bg-grayScale-50 hover:text-grayScale-600 active:cursor-grabbing" className="mt-0.5 shrink-0 cursor-grab touch-none rounded-[6px] p-1 text-grayScale-400 transition-colors hover:bg-grayScale-50 hover:text-grayScale-600 active:cursor-grabbing"
aria-label={`Drag to reorder question ${i + 1}`} aria-label={`Drag to reorder question ${i + 1}`}
> >
<GripVertical className="h-5 w-5" /> <GripVertical className="h-5 w-5" />
@ -805,7 +805,7 @@ export function QuestionsStep({
variant="ghost" variant="ghost"
size="icon" size="icon"
type="button" type="button"
className="shrink-0 text-brand-500 hover:bg-brand-50 rounded-lg" className="shrink-0 text-brand-500 hover:bg-brand-50 rounded-[6px]"
onClick={() => { onClick={() => {
const newQuestions = formData.questions.filter( const newQuestions = formData.questions.filter(
(item: any) => item.id !== q.id, (item: any) => item.id !== q.id,

View File

@ -156,7 +156,7 @@ export function SelectPracticeToAttachStep({
type="button" type="button"
onClick={() => setUnlinkedOnly(false)} onClick={() => setUnlinkedOnly(false)}
className={cn( className={cn(
"rounded-full px-3 py-1 text-xs font-semibold transition-colors", "rounded-[6px] px-3 py-1 text-xs font-semibold transition-colors",
!unlinkedOnly !unlinkedOnly
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",
@ -168,7 +168,7 @@ export function SelectPracticeToAttachStep({
type="button" type="button"
onClick={() => setUnlinkedOnly(true)} onClick={() => setUnlinkedOnly(true)}
className={cn( className={cn(
"rounded-full px-3 py-1 text-xs font-semibold transition-colors", "rounded-[6px] px-3 py-1 text-xs font-semibold transition-colors",
unlinkedOnly unlinkedOnly
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -15,7 +15,7 @@ export function ComponentKindCard({ label, Icon, selected, onClick }: ComponentK
type="button" type="button"
onClick={onClick} onClick={onClick}
className={cn( className={cn(
"w-full 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-[6px] border text-left transition-all group relative",
selected selected
? "border-[#9E2891] bg-white dark:bg-grayScale-100 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 dark:bg-grayScale-50 hover:border-grayScale-300 hover:bg-grayScale-50/80 dark:hover:bg-grayScale-100/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",

View File

@ -228,7 +228,7 @@ export function ReviewPublishStep({
variant="outline" variant="outline"
onClick={prevStep} onClick={prevStep}
disabled={publishing} disabled={publishing}
className="h-10 px-8 rounded-xl border-grayScale-200 font-bold text-grayScale-600 hover:bg-grayScale-50 transition-all shadow-sm" className="h-10 px-8 rounded-[6px] border-grayScale-200 font-bold text-grayScale-600 hover:bg-grayScale-50 transition-all shadow-sm"
> >
Back Back
</Button> </Button>

View File

@ -186,21 +186,21 @@ export function VideoDetailStep({
<button <button
type="button" type="button"
onClick={() => handleCommand("bold")} onClick={() => handleCommand("bold")}
className="h-9 w-9 flex items-center justify-center rounded-lg hover:bg-white hover:shadow-sm text-grayScale-900 transition-all font-serif font-bold text-[17px] pb-0.5 active:bg-grayScale-50" className="h-9 w-9 flex items-center justify-center rounded-[6px] hover:bg-white hover:shadow-sm text-grayScale-900 transition-all font-serif font-bold text-[17px] pb-0.5 active:bg-grayScale-50"
> >
B B
</button> </button>
<button <button
type="button" type="button"
onClick={() => handleCommand("italic")} onClick={() => handleCommand("italic")}
className="h-9 w-9 flex items-center justify-center rounded-lg hover:bg-white hover:shadow-sm text-grayScale-900 transition-all font-serif italic text-[17px] pr-0.5 active:bg-grayScale-50" className="h-9 w-9 flex items-center justify-center rounded-[6px] hover:bg-white hover:shadow-sm text-grayScale-900 transition-all font-serif italic text-[17px] pr-0.5 active:bg-grayScale-50"
> >
I I
</button> </button>
<button <button
type="button" type="button"
onClick={() => handleCommand("insertUnorderedList")} onClick={() => handleCommand("insertUnorderedList")}
className="h-9 w-9 flex items-center justify-center rounded-lg hover:bg-white hover:shadow-sm text-grayScale-900 transition-all active:bg-grayScale-50" className="h-9 w-9 flex items-center justify-center rounded-[6px] hover:bg-white hover:shadow-sm text-grayScale-900 transition-all active:bg-grayScale-50"
> >
<List className="h-5 w-5" /> <List className="h-5 w-5" />
</button> </button>
@ -210,7 +210,7 @@ export function VideoDetailStep({
const url = prompt("Enter URL:"); const url = prompt("Enter URL:");
if (url) handleCommand("createLink", url); if (url) handleCommand("createLink", url);
}} }}
className="h-9 w-9 flex items-center justify-center rounded-lg hover:bg-white hover:shadow-sm text-grayScale-900 transition-all active:bg-grayScale-50" className="h-9 w-9 flex items-center justify-center rounded-[6px] hover:bg-white hover:shadow-sm text-grayScale-900 transition-all active:bg-grayScale-50"
> >
<LinkIcon className="h-4 w-4" /> <LinkIcon className="h-4 w-4" />
</button> </button>

View File

@ -838,7 +838,7 @@ export function CreateNotificationPage() {
type="button" type="button"
onClick={() => setAudienceMode("platform_role")} onClick={() => setAudienceMode("platform_role")}
className={cn( className={cn(
"rounded-lg px-3 py-2 transition-all", "rounded-[6px] px-3 py-2 transition-all",
audienceMode === "platform_role" audienceMode === "platform_role"
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700", : "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700",
@ -853,7 +853,7 @@ export function CreateNotificationPage() {
setUserSearchQuery("") setUserSearchQuery("")
}} }}
className={cn( className={cn(
"rounded-lg px-3 py-2 transition-all", "rounded-[6px] px-3 py-2 transition-all",
audienceMode === "platform_selected" audienceMode === "platform_selected"
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700", : "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700",
@ -866,7 +866,7 @@ export function CreateNotificationPage() {
type="button" type="button"
onClick={() => setAudienceMode("direct")} onClick={() => setAudienceMode("direct")}
className={cn( className={cn(
"rounded-lg px-3 py-2 transition-all", "rounded-[6px] px-3 py-2 transition-all",
audienceMode === "direct" audienceMode === "direct"
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700", : "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700",
@ -1051,7 +1051,7 @@ export function CreateNotificationPage() {
type="button" type="button"
onClick={() => setAudienceMode("team_role")} onClick={() => setAudienceMode("team_role")}
className={cn( className={cn(
"rounded-lg px-3 py-2 transition-all", "rounded-[6px] px-3 py-2 transition-all",
audienceMode === "team_role" audienceMode === "team_role"
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700", : "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700",
@ -1066,7 +1066,7 @@ export function CreateNotificationPage() {
setTeamSearchQuery("") setTeamSearchQuery("")
}} }}
className={cn( className={cn(
"rounded-lg px-3 py-2 transition-all", "rounded-[6px] px-3 py-2 transition-all",
audienceMode === "team_selected" audienceMode === "team_selected"
? "bg-brand-500 text-white shadow-sm" ? "bg-brand-500 text-white shadow-sm"
: "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700", : "border border-grayScale-200 bg-white text-grayScale-500 hover:border-grayScale-300 hover:text-grayScale-700",

View File

@ -139,7 +139,7 @@ export function EmailTemplatesPage() {
type="button" type="button"
onClick={() => setStatusFilter(tab)} onClick={() => setStatusFilter(tab)}
className={cn( className={cn(
"h-9 rounded-full px-3 text-xs font-semibold transition-colors", "h-9 rounded-[6px] px-3 text-xs font-semibold transition-colors",
statusFilter === tab statusFilter === tab
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -138,7 +138,7 @@ function NotificationItem({
disabled={toggling} disabled={toggling}
onClick={() => onToggleRead(notification.id, notification.is_read)} onClick={() => onToggleRead(notification.id, notification.is_read)}
className={cn( className={cn(
"grid h-7 w-7 place-items-center rounded-lg transition-colors", "grid h-7 w-7 place-items-center rounded-[6px] transition-colors",
"opacity-0 group-hover:opacity-100 focus:opacity-100", "opacity-0 group-hover:opacity-100 focus:opacity-100",
notification.is_read notification.is_read
? "text-grayScale-400 hover:bg-brand-50 hover:text-brand-600" ? "text-grayScale-400 hover:bg-brand-50 hover:text-brand-600"
@ -628,7 +628,7 @@ export function NotificationsPage() {
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button <Button
variant="outline" variant="outline"
className="h-8 w-[130px] justify-between rounded-lg border-grayScale-200 px-2.5 text-xs font-normal text-grayScale-600" className="h-8 w-[130px] justify-between rounded-[6px] border-grayScale-200 px-2.5 text-xs font-normal text-grayScale-600"
> >
<span className="truncate">{channelFilter === "all" ? "All" : channelFilter.toUpperCase()}</span> <span className="truncate">{channelFilter === "all" ? "All" : channelFilter.toUpperCase()}</span>
<ChevronDown className="ml-2 h-3.5 w-3.5 text-grayScale-400" /> <ChevronDown className="ml-2 h-3.5 w-3.5 text-grayScale-400" />
@ -652,7 +652,7 @@ export function NotificationsPage() {
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button <Button
variant="outline" variant="outline"
className="h-8 w-[150px] justify-between rounded-lg border-grayScale-200 px-2.5 text-xs font-normal text-grayScale-600" className="h-8 w-[150px] justify-between rounded-[6px] border-grayScale-200 px-2.5 text-xs font-normal text-grayScale-600"
> >
<span className="truncate"> <span className="truncate">
{typeFilter === "all" ? "All types" : formatNotificationTypeLabel(typeFilter)} {typeFilter === "all" ? "All types" : formatNotificationTypeLabel(typeFilter)}
@ -678,7 +678,7 @@ export function NotificationsPage() {
<DropdownMenuTrigger asChild> <DropdownMenuTrigger asChild>
<Button <Button
variant="outline" variant="outline"
className="h-8 w-[130px] justify-between rounded-lg border-grayScale-200 px-2.5 text-xs font-normal text-grayScale-600" className="h-8 w-[130px] justify-between rounded-[6px] border-grayScale-200 px-2.5 text-xs font-normal text-grayScale-600"
> >
<span className="truncate">{levelFilter === "all" ? "All levels" : levelFilter}</span> <span className="truncate">{levelFilter === "all" ? "All levels" : levelFilter}</span>
<ChevronDown className="ml-2 h-3.5 w-3.5 text-grayScale-400" /> <ChevronDown className="ml-2 h-3.5 w-3.5 text-grayScale-400" />

View File

@ -76,7 +76,7 @@ export function EmailTemplatePreviewPanel({
key={tab.id} key={tab.id}
type="button" type="button"
className={cn( className={cn(
"rounded-lg px-3 py-1.5 text-sm font-medium transition-colors", "rounded-[6px] px-3 py-1.5 text-sm font-medium transition-colors",
mode === tab.id mode === tab.id
? "bg-brand-100 text-brand-600" ? "bg-brand-100 text-brand-600"
: "text-grayScale-500 hover:bg-grayScale-100", : "text-grayScale-500 hover:bg-grayScale-100",

View File

@ -815,7 +815,7 @@ export function PaymentsPage() {
{/* Actions */} {/* Actions */}
{selected.payment_url && ( {selected.payment_url && (
<div className="mt-5 border-t border-grayScale-100 pt-4"> <div className="mt-5 border-t border-grayScale-100 pt-4">
<Button size="sm" className="h-9 rounded-lg bg-brand-600 px-4 text-xs font-medium text-white hover:bg-brand-500" asChild> <Button size="sm" className="h-9 rounded-[6px] bg-brand-600 px-4 text-xs font-medium text-white hover:bg-brand-500" asChild>
<a href={selected.payment_url} target="_blank" rel="noopener noreferrer"> <a href={selected.payment_url} target="_blank" rel="noopener noreferrer">
<ExternalLink className="mr-1.5 h-3.5 w-3.5" /> <ExternalLink className="mr-1.5 h-3.5 w-3.5" />
Open checkout Open checkout

View File

@ -118,7 +118,7 @@ export function PersonaProfilePictureUploadField({
onDragLeave={handleDragLeave} onDragLeave={handleDragLeave}
onDrop={handleDrop} onDrop={handleDrop}
className={cn( className={cn(
"flex w-full cursor-pointer flex-col items-center justify-center rounded-xl border-2 border-dashed border-brand-200 bg-white p-6 text-center transition-colors", "flex w-full cursor-pointer flex-col items-center justify-center rounded-[6px] border-2 border-dashed border-brand-200 bg-white p-6 text-center transition-colors",
"hover:border-brand-300 hover:bg-grayScale-50/40", "hover:border-brand-300 hover:bg-grayScale-50/40",
dragActive && "border-brand-400 bg-brand-50/40", dragActive && "border-brand-400 bg-brand-50/40",
zoneDisabled && "cursor-not-allowed opacity-60", zoneDisabled && "cursor-not-allowed opacity-60",

View File

@ -363,14 +363,14 @@ export function RolesListPage({ embedded = false }: RolesListPageProps) {
type="button" type="button"
onClick={() => setRoleCategoryFilter(value)} onClick={() => setRoleCategoryFilter(value)}
className={cn( className={cn(
"h-9 rounded-full px-3 text-xs font-semibold transition-colors", "h-9 rounded-[6px] px-3 text-xs font-semibold transition-colors",
roleCategoryFilter === value roleCategoryFilter === value
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",
)} )}
> >
{label} {label}
</button> </button>
))} ))}
</div> </div>

View File

@ -288,7 +288,7 @@ export function AppVersionsTab() {
type="button" type="button"
onClick={() => setPlatformFilter(tab.id)} onClick={() => setPlatformFilter(tab.id)}
className={cn( className={cn(
"rounded-full px-3 py-1.5 text-xs font-semibold transition-colors", "rounded-[6px] px-3 py-1.5 text-xs font-semibold transition-colors",
platformFilter === tab.id platformFilter === tab.id
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",
@ -312,7 +312,7 @@ export function AppVersionsTab() {
type="button" type="button"
onClick={() => setStatusFilter(tab.id)} onClick={() => setStatusFilter(tab.id)}
className={cn( className={cn(
"rounded-full px-3 py-1.5 text-xs font-semibold transition-colors", "rounded-[6px] px-3 py-1.5 text-xs font-semibold transition-colors",
statusFilter === tab.id statusFilter === tab.id
? "bg-grayScale-800 text-white" ? "bg-grayScale-800 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -232,7 +232,7 @@ export function SubscriptionPlansTab() {
type="button" type="button"
onClick={() => setStatusFilter(tab.id)} onClick={() => setStatusFilter(tab.id)}
className={cn( className={cn(
"rounded-full px-3 py-1.5 text-xs font-semibold transition-colors", "rounded-[6px] px-3 py-1.5 text-xs font-semibold transition-colors",
statusFilter === tab.id statusFilter === tab.id
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200", : "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -194,7 +194,7 @@ export function SubscriptionsExportPage() {
<button <button
type="button" type="button"
onClick={clearFilters} onClick={clearFilters}
className="mt-4 flex items-center gap-1.5 rounded-lg border border-grayScale-200 bg-white px-3 py-1.5 text-xs font-medium text-grayScale-600 transition-colors hover:border-grayScale-300 hover:text-grayScale-800" className="mt-4 flex items-center gap-1.5 rounded-[6px] border border-grayScale-200 bg-white px-3 py-1.5 text-xs font-medium text-grayScale-600 transition-colors hover:border-grayScale-300 hover:text-grayScale-800"
> >
<Filter className="h-3.5 w-3.5" /> <Filter className="h-3.5 w-3.5" />
Clear filters Clear filters

View File

@ -67,7 +67,7 @@ export function AddTeamMemberPage() {
<Button <Button
variant="ghost" variant="ghost"
size="icon" size="icon"
className="h-9 w-9 rounded-lg border border-grayScale-200 bg-white shadow-sm hover:bg-grayScale-50" className="h-9 w-9 rounded-[6px] border border-grayScale-200 bg-white shadow-sm hover:bg-grayScale-50"
onClick={() => navigate("/team")} onClick={() => navigate("/team")}
> >
<ArrowLeft className="h-4 w-4 text-grayScale-500" /> <ArrowLeft className="h-4 w-4 text-grayScale-500" />

View File

@ -464,7 +464,7 @@ export function TeamManagementPage() {
onClick={handlePrev} onClick={handlePrev}
disabled={safePage === 1} disabled={safePage === 1}
className={cn( className={cn(
"h-8 w-8 flex items-center justify-center rounded-md border bg-white text-grayScale-500", "h-8 w-8 flex items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === 1 && "opacity-50 cursor-not-allowed" safePage === 1 && "opacity-50 cursor-not-allowed"
)} )}
> >
@ -482,7 +482,7 @@ export function TeamManagementPage() {
type="button" type="button"
onClick={() => setPage(n)} onClick={() => setPage(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === safePage n === safePage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50" : "bg-white text-grayScale-600 hover:bg-grayScale-50"
@ -497,7 +497,7 @@ export function TeamManagementPage() {
onClick={handleNext} onClick={handleNext}
disabled={safePage === pageCount} disabled={safePage === pageCount}
className={cn( className={cn(
"h-8 w-8 flex items-center justify-center rounded-md border bg-white text-grayScale-500", "h-8 w-8 flex items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === pageCount && "opacity-50 cursor-not-allowed" safePage === pageCount && "opacity-50 cursor-not-allowed"
)} )}
> >
@ -523,7 +523,7 @@ export function TeamManagementPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Confirm Status Change</h2> <h2 className="text-lg font-semibold text-grayScale-900">Confirm Status Change</h2>
<button <button
onClick={handleCancelConfirm} onClick={handleCancelConfirm}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -444,7 +444,7 @@ export function TeamMemberDetailPage() {
<button <button
type="button" type="button"
onClick={() => setConfirmDialog(null)} onClick={() => setConfirmDialog(null)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -62,6 +62,7 @@ import { cn } from "../../../lib/utils"
import { EXPORT_PERMISSIONS, EXPORT_ROUTES } from "../../../lib/csv-export" import { EXPORT_PERMISSIONS, EXPORT_ROUTES } from "../../../lib/csv-export"
import { activityLogExportQuery } from "../../../lib/csvExportFilters" import { activityLogExportQuery } from "../../../lib/csvExportFilters"
import { TABLE_PAGE_SIZE_OPTIONS } from "../../../lib/tablePagination" import { TABLE_PAGE_SIZE_OPTIONS } from "../../../lib/tablePagination"
import { fetchAllOffsetPages } from "../../../lib/fetchAllOffsetPages"
import type { ActivityLog, ActivityLogFilters } from "../../../types/activity-log.types" import type { ActivityLog, ActivityLogFilters } from "../../../types/activity-log.types"
import { ActorCell, ActorLabel } from "./ActorLabel" import { ActorCell, ActorLabel } from "./ActorLabel"
import { ActorHoverCard } from "./ActorHoverCard" import { ActorHoverCard } from "./ActorHoverCard"
@ -97,7 +98,6 @@ export function ActivityLogListPanel({
const [logs, setLogs] = useState<ActivityLog[]>([]) const [logs, setLogs] = useState<ActivityLog[]>([])
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const [totalCount, setTotalCount] = useState(0)
const [page, setPage] = useState(1) const [page, setPage] = useState(1)
const [pageSize, setPageSize] = useState(10) const [pageSize, setPageSize] = useState(10)
@ -112,9 +112,8 @@ export function ActivityLogListPanel({
const [detailLoading, setDetailLoading] = useState(false) const [detailLoading, setDetailLoading] = useState(false)
const [dialogOpen, setDialogOpen] = useState(false) const [dialogOpen, setDialogOpen] = useState(false)
const serverFilters = useMemo((): ActivityLogFilters => { const listFilters = useMemo((): ActivityLogFilters => {
const offset = (page - 1) * pageSize const filters: ActivityLogFilters = {}
const filters: ActivityLogFilters = { limit: pageSize, offset }
if (fixedActorId != null) filters.actor_id = fixedActorId if (fixedActorId != null) filters.actor_id = fixedActorId
if (actionFilter) filters.action = actionFilter if (actionFilter) filters.action = actionFilter
if (resourceTypeFilter) filters.resource_type = resourceTypeFilter if (resourceTypeFilter) filters.resource_type = resourceTypeFilter
@ -126,8 +125,6 @@ export function ActivityLogListPanel({
if (dateBefore) filters.before = toRfc3339EndOfDay(dateBefore) if (dateBefore) filters.before = toRfc3339EndOfDay(dateBefore)
return filters return filters
}, [ }, [
page,
pageSize,
fixedActorId, fixedActorId,
actionFilter, actionFilter,
resourceTypeFilter, resourceTypeFilter,
@ -137,28 +134,29 @@ export function ActivityLogListPanel({
]) ])
const exportParams = useMemo( const exportParams = useMemo(
() => activityLogExportQuery(serverFilters), () => activityLogExportQuery(listFilters),
[serverFilters], [listFilters],
) )
const fetchLogs = useCallback(async () => { const fetchLogs = useCallback(async () => {
setLoading(true) setLoading(true)
setError(null) setError(null)
try { try {
const data = await getActivityLogs(serverFilters) const all = await fetchAllOffsetPages(async (offset, limit) => {
setLogs(data.logs) const data = await getActivityLogs({ ...listFilters, limit, offset })
setTotalCount(data.total_count) return { items: data.logs, total_count: data.total_count }
})
setLogs(all)
} catch (e) { } catch (e) {
console.error("Failed to fetch activity logs:", e) console.error("Failed to fetch activity logs:", e)
setLogs([]) setLogs([])
setTotalCount(0)
const msg = getApiErrorMessage(e, "Failed to load activity logs") const msg = getApiErrorMessage(e, "Failed to load activity logs")
setError(msg) setError(msg)
notifyApiError(e, "Failed to load activity logs") notifyApiError(e, "Failed to load activity logs")
} finally { } finally {
setLoading(false) setLoading(false)
} }
}, [serverFilters]) }, [listFilters])
useEffect(() => { useEffect(() => {
void fetchLogs() void fetchLogs()
@ -166,7 +164,7 @@ export function ActivityLogListPanel({
useEffect(() => { useEffect(() => {
setPage(1) setPage(1)
}, [actionFilter, resourceTypeFilter, resourceIdFilter, dateAfter, dateBefore, fixedActorId, pageSize]) }, [actionFilter, resourceTypeFilter, resourceIdFilter, dateAfter, dateBefore, fixedActorId, pageSize, searchQuery])
const handleViewDetail = async (logId: number) => { const handleViewDetail = async (logId: number) => {
setDialogOpen(true) setDialogOpen(true)
@ -225,10 +223,15 @@ export function ActivityLogListPanel({
}) })
}, [logs, searchQuery]) }, [logs, searchQuery])
const totalCount = filteredLogs.length
const pageCount = Math.max(1, Math.ceil(totalCount / pageSize)) const pageCount = Math.max(1, Math.ceil(totalCount / pageSize))
const safePage = Math.min(page, pageCount) const safePage = Math.min(page, pageCount)
const startEntry = totalCount === 0 ? 0 : (safePage - 1) * pageSize + 1 const startEntry = totalCount === 0 ? 0 : (safePage - 1) * pageSize + 1
const endEntry = Math.min(safePage * pageSize, totalCount) const endEntry = Math.min(safePage * pageSize, totalCount)
const paginatedLogs = useMemo(() => {
const start = (safePage - 1) * pageSize
return filteredLogs.slice(start, start + pageSize)
}, [filteredLogs, safePage, pageSize])
const showActorColumn = fixedActorId == null const showActorColumn = fixedActorId == null
const columnCount = showActorColumn ? 6 : 5 const columnCount = showActorColumn ? 6 : 5
@ -284,7 +287,7 @@ export function ActivityLogListPanel({
<p className="text-2xl font-bold text-grayScale-600"> <p className="text-2xl font-bold text-grayScale-600">
{logs[0]?.created_at ? getRelativeActivityTime(logs[0].created_at) : <UnassignedLabel />} {logs[0]?.created_at ? getRelativeActivityTime(logs[0].created_at) : <UnassignedLabel />}
</p> </p>
<p className="text-xs text-grayScale-400">Latest on this page</p> <p className="text-xs text-grayScale-400">Latest loaded</p>
</div> </div>
</div> </div>
<div className="flex items-center gap-4 rounded-xl border bg-white p-4"> <div className="flex items-center gap-4 rounded-xl border bg-white p-4">
@ -293,7 +296,7 @@ export function ActivityLogListPanel({
</div> </div>
<div> <div>
<p className="text-2xl font-bold text-grayScale-600">{filteredLogs.length}</p> <p className="text-2xl font-bold text-grayScale-600">{filteredLogs.length}</p>
<p className="text-xs text-grayScale-400">Rows after search (this page)</p> <p className="text-xs text-grayScale-400">Rows after search</p>
</div> </div>
</div> </div>
</div> </div>
@ -306,7 +309,7 @@ export function ActivityLogListPanel({
<div className="relative w-full"> <div className="relative w-full">
<Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-grayScale-400" /> <Search className="absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-grayScale-400" />
<Input <Input
placeholder="Search message, action, or metadata on this page…" placeholder="Search message, action, or metadata…"
className="pl-9" className="pl-9"
value={searchQuery} value={searchQuery}
onChange={(e) => setSearchQuery(e.target.value)} onChange={(e) => setSearchQuery(e.target.value)}
@ -415,7 +418,7 @@ export function ActivityLogListPanel({
</div> </div>
</TableCell> </TableCell>
</TableRow> </TableRow>
) : filteredLogs.length === 0 ? ( ) : paginatedLogs.length === 0 ? (
<TableRow> <TableRow>
<TableCell colSpan={columnCount} className="py-12 text-center"> <TableCell colSpan={columnCount} className="py-12 text-center">
<div className="flex flex-col items-center gap-3"> <div className="flex flex-col items-center gap-3">
@ -432,7 +435,7 @@ export function ActivityLogListPanel({
</TableCell> </TableCell>
</TableRow> </TableRow>
) : ( ) : (
filteredLogs.map((log) => ( paginatedLogs.map((log) => (
<TableRow key={log.id} className="group"> <TableRow key={log.id} className="group">
<TableCell> <TableCell>
<span <span

View File

@ -284,7 +284,7 @@ export function DeletionRequestsPage() {
<div className="relative" ref={roleMenuRef}> <div className="relative" ref={roleMenuRef}>
<button <button
type="button" type="button"
className="flex h-11 w-full items-center justify-between rounded-xl border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600 shadow-sm transition hover:bg-grayScale-50 focus:outline-none focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-200" className="flex h-11 w-full items-center justify-between rounded-[6px] border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600 shadow-sm transition hover:bg-grayScale-50 focus:outline-none focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-200"
onClick={() => { onClick={() => {
setRoleMenuOpen((prev) => !prev) setRoleMenuOpen((prev) => !prev)
setStatusMenuOpen(false) setStatusMenuOpen(false)
@ -310,7 +310,7 @@ export function DeletionRequestsPage() {
<button <button
type="button" type="button"
className={cn( className={cn(
"w-full rounded-md px-2 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2 py-2 text-left text-sm transition",
role === "" role === ""
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",
@ -328,7 +328,7 @@ export function DeletionRequestsPage() {
key={roleName} key={roleName}
type="button" type="button"
className={cn( className={cn(
"w-full rounded-md px-2 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2 py-2 text-left text-sm transition",
role === roleName role === roleName
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",
@ -352,7 +352,7 @@ export function DeletionRequestsPage() {
<div className="relative" ref={statusMenuRef}> <div className="relative" ref={statusMenuRef}>
<button <button
type="button" type="button"
className="flex h-11 w-full items-center justify-between rounded-xl border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600 shadow-sm transition hover:bg-grayScale-50 focus:outline-none focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-200" className="flex h-11 w-full items-center justify-between rounded-[6px] border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600 shadow-sm transition hover:bg-grayScale-50 focus:outline-none focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-200"
onClick={() => { onClick={() => {
setStatusMenuOpen((prev) => !prev) setStatusMenuOpen((prev) => !prev)
setStateMenuOpen(false) setStateMenuOpen(false)
@ -367,7 +367,7 @@ export function DeletionRequestsPage() {
<button <button
type="button" type="button"
className={cn( className={cn(
"w-full rounded-lg px-2.5 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2.5 py-2 text-left text-sm transition",
status === "" status === ""
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",
@ -385,7 +385,7 @@ export function DeletionRequestsPage() {
key={statusOption} key={statusOption}
type="button" type="button"
className={cn( className={cn(
"w-full rounded-lg px-2.5 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2.5 py-2 text-left text-sm transition",
status === statusOption status === statusOption
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",
@ -408,7 +408,7 @@ export function DeletionRequestsPage() {
<div className="relative" ref={stateMenuRef}> <div className="relative" ref={stateMenuRef}>
<button <button
type="button" type="button"
className="flex h-11 w-full items-center justify-between rounded-xl border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600 shadow-sm transition hover:bg-grayScale-50 focus:outline-none focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-200" className="flex h-11 w-full items-center justify-between rounded-[6px] border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600 shadow-sm transition hover:bg-grayScale-50 focus:outline-none focus-visible:border-brand-400 focus-visible:ring-2 focus-visible:ring-brand-200"
onClick={() => { onClick={() => {
setStateMenuOpen((prev) => !prev) setStateMenuOpen((prev) => !prev)
setStatusMenuOpen(false) setStatusMenuOpen(false)
@ -423,7 +423,7 @@ export function DeletionRequestsPage() {
<button <button
type="button" type="button"
className={cn( className={cn(
"w-full rounded-lg px-2.5 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2.5 py-2 text-left text-sm transition",
state === "" state === ""
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",
@ -441,7 +441,7 @@ export function DeletionRequestsPage() {
key={stateOption} key={stateOption}
type="button" type="button"
className={cn( className={cn(
"w-full rounded-lg px-2.5 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2.5 py-2 text-left text-sm transition",
state === stateOption state === stateOption
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",
@ -612,7 +612,7 @@ export function DeletionRequestsPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)} onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1} disabled={safePage === 1}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === 1 && "cursor-not-allowed opacity-50", safePage === 1 && "cursor-not-allowed opacity-50",
)} )}
> >
@ -629,7 +629,7 @@ export function DeletionRequestsPage() {
type="button" type="button"
onClick={() => setPage(n)} onClick={() => setPage(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === safePage n === safePage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50", : "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -643,7 +643,7 @@ export function DeletionRequestsPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)} onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages} disabled={safePage === totalPages}
className={cn( className={cn(
"flex h-8 w-8 items-center justify-center rounded-md border bg-white text-grayScale-500", "flex h-8 w-8 items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === totalPages && "cursor-not-allowed opacity-50", safePage === totalPages && "cursor-not-allowed opacity-50",
)} )}
> >

View File

@ -569,7 +569,7 @@ export function UserDetailPage() {
<button <button
type="button" type="button"
onClick={() => setConfirmDialog(null)} onClick={() => setConfirmDialog(null)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -82,7 +82,7 @@ function UserListFilterDropdown({
id={id} id={id}
disabled={disabled} disabled={disabled}
className={cn( className={cn(
"flex h-9 w-full items-center justify-between gap-2 rounded-md border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600", "flex h-9 w-full items-center justify-between gap-2 rounded-[6px] border border-grayScale-200 bg-white px-3 text-left text-sm text-grayScale-600",
"outline-none focus-visible:ring-1 focus-visible:ring-brand-500", "outline-none focus-visible:ring-1 focus-visible:ring-brand-500",
disabled && "cursor-not-allowed bg-grayScale-50 text-grayScale-400", disabled && "cursor-not-allowed bg-grayScale-50 text-grayScale-400",
)} )}
@ -726,7 +726,7 @@ export function UsersListPage() {
onClick={handlePrev} onClick={handlePrev}
disabled={safePage === 1} disabled={safePage === 1}
className={cn( className={cn(
"h-8 w-8 flex items-center justify-center rounded-md border bg-white text-grayScale-500", "h-8 w-8 flex items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === 1 && "opacity-50 cursor-not-allowed" safePage === 1 && "opacity-50 cursor-not-allowed"
)} )}
> >
@ -744,7 +744,7 @@ export function UsersListPage() {
type="button" type="button"
onClick={() => setPage(n)} onClick={() => setPage(n)}
className={cn( className={cn(
"h-8 w-8 rounded-md border text-sm font-medium", "h-8 w-8 rounded-[6px] border text-sm font-medium",
n === safePage n === safePage
? "border-brand-500 bg-brand-500 text-white" ? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50" : "bg-white text-grayScale-600 hover:bg-grayScale-50"
@ -759,7 +759,7 @@ export function UsersListPage() {
onClick={handleNext} onClick={handleNext}
disabled={safePage === pageCount} disabled={safePage === pageCount}
className={cn( className={cn(
"h-8 w-8 flex items-center justify-center rounded-md border bg-white text-grayScale-500", "h-8 w-8 flex items-center justify-center rounded-[6px] border bg-white text-grayScale-500",
safePage === pageCount && "opacity-50 cursor-not-allowed" safePage === pageCount && "opacity-50 cursor-not-allowed"
)} )}
> >
@ -776,7 +776,7 @@ export function UsersListPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Confirm Status Change</h2> <h2 className="text-lg font-semibold text-grayScale-900">Confirm Status Change</h2>
<button <button
onClick={() => setConfirmDialog(null)} onClick={() => setConfirmDialog(null)}
className="grid h-8 w-8 place-items-center rounded-lg text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600" className="grid h-8 w-8 place-items-center rounded-[6px] text-grayScale-400 transition-colors hover:bg-grayScale-100 hover:text-grayScale-600"
> >
<X className="h-5 w-5" /> <X className="h-5 w-5" />
</button> </button>

View File

@ -268,7 +268,7 @@ export function GrantSubscriptionDialog({
role="option" role="option"
aria-selected={selected} aria-selected={selected}
className={cn( className={cn(
"w-full rounded-md px-2 py-2 text-left text-sm transition", "w-full rounded-[6px] px-2 py-2 text-left text-sm transition",
selected selected
? "bg-brand-100/50 text-brand-700" ? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100", : "text-grayScale-600 hover:bg-grayScale-100",

View File

@ -290,7 +290,7 @@ export function UserLearningActivitySection({
<button <button
type="button" type="button"
className={cn( className={cn(
"rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "rounded-[6px] px-3 py-1.5 text-xs font-medium transition-colors",
track === "lms" ? "bg-brand-500 text-white" : "text-grayScale-500 hover:text-grayScale-700", track === "lms" ? "bg-brand-500 text-white" : "text-grayScale-500 hover:text-grayScale-700",
)} )}
onClick={() => setTrack("lms")} onClick={() => setTrack("lms")}
@ -300,7 +300,7 @@ export function UserLearningActivitySection({
<button <button
type="button" type="button"
className={cn( className={cn(
"rounded-md px-3 py-1.5 text-xs font-medium transition-colors", "rounded-[6px] px-3 py-1.5 text-xs font-medium transition-colors",
track === "exam_prep" track === "exam_prep"
? "bg-brand-500 text-white" ? "bg-brand-500 text-white"
: "text-grayScale-500 hover:text-grayScale-700", : "text-grayScale-500 hover:text-grayScale-700",

View File

@ -231,7 +231,7 @@ function ActiveSubscriptionsCard({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-8 rounded-lg text-xs text-destructive disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-8 rounded-[6px] text-xs text-destructive disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!cancelEnabled} disabled={!cancelEnabled}
title={ title={
!cancelEnabled !cancelEnabled
@ -254,7 +254,7 @@ function ActiveSubscriptionsCard({
{canExtend ? ( {canExtend ? (
<Button <Button
type="button" type="button"
className="h-10 w-full rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 w-full rounded-[6px] bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!extendEnabled} disabled={!extendEnabled}
title={ title={
!extendEnabled !extendEnabled
@ -271,7 +271,7 @@ function ActiveSubscriptionsCard({
{canGrant ? ( {canGrant ? (
<Button <Button
type="button" type="button"
className="h-10 w-full rounded-xl bg-grayScale-100 text-sm font-semibold text-grayScale-700 hover:bg-grayScale-200 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 w-full rounded-[6px] bg-grayScale-100 text-sm font-semibold text-grayScale-700 hover:bg-grayScale-200 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!grantEnabled} disabled={!grantEnabled}
title={ title={
!grantEnabled !grantEnabled
@ -339,7 +339,7 @@ function EmptySubscriptionCard({
{canExtend ? ( {canExtend ? (
<Button <Button
type="button" type="button"
className="h-10 w-full rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 w-full rounded-[6px] bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled disabled
title="Extend is only available when this learner has an active subscription." title="Extend is only available when this learner has an active subscription."
> >
@ -352,7 +352,7 @@ function EmptySubscriptionCard({
{canGrant ? ( {canGrant ? (
<Button <Button
type="button" type="button"
className="h-10 min-w-0 flex-1 rounded-xl bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 min-w-0 flex-1 rounded-[6px] bg-brand-500 text-sm font-semibold text-white hover:bg-brand-600 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!grantEnabled} disabled={!grantEnabled}
title={ title={
!grantEnabled !grantEnabled
@ -368,7 +368,7 @@ function EmptySubscriptionCard({
<Button <Button
type="button" type="button"
variant="outline" variant="outline"
className="h-10 min-w-0 flex-1 rounded-xl border-grayScale-200 bg-white text-sm font-semibold text-grayScale-700 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-10 min-w-0 flex-1 rounded-[6px] border-grayScale-200 bg-white text-sm font-semibold text-grayScale-700 disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled disabled
title="Cancel is only available when this learner has an active subscription." title="Cancel is only available when this learner has an active subscription."
> >
@ -615,7 +615,7 @@ export function UserSubscriptionsSection({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-8 rounded-lg text-xs disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-8 rounded-[6px] text-xs disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={!subscription.is_currently_active} disabled={!subscription.is_currently_active}
title={ title={
!subscription.is_currently_active !subscription.is_currently_active
@ -632,7 +632,7 @@ export function UserSubscriptionsSection({
type="button" type="button"
variant="outline" variant="outline"
size="sm" size="sm"
className="h-8 rounded-lg text-xs text-destructive disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50" className="h-8 rounded-[6px] text-xs text-destructive disabled:pointer-events-auto disabled:cursor-not-allowed disabled:opacity-50"
disabled={ disabled={
!subscription.is_currently_active || !subscription.is_currently_active ||
subscription.status.toUpperCase() === "CANCELLED" subscription.status.toUpperCase() === "CANCELLED"