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))}
disabled={disabled || currentPage <= 1}
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",
)}
aria-label="Previous page"
@ -102,7 +102,7 @@ export function TablePagination({
disabled={disabled}
onClick={() => onPageChange(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -117,7 +117,7 @@ export function TablePagination({
onClick={() => onPageChange(Math.min(totalPages, currentPage + 1))}
disabled={disabled || currentPage >= totalPages}
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",
)}
aria-label="Next page"

View File

@ -165,7 +165,7 @@ export function AnalyticsTimeRangeFilter({ value, onChange, className }: Analyti
<button
type="button"
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
<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"
onClick={() => setContextYear(year)}
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
? "bg-brand-100 text-brand-700"
: "text-grayScale-500 hover:bg-grayScale-100",

View File

@ -58,7 +58,7 @@ export function DynamicMatchingInputsSlot({
variant="outline"
size="sm"
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))}
>
<Plus className="h-3.5 w-3.5" />
@ -153,7 +153,7 @@ export function DynamicMatchingAnswerSlot({
variant="outline"
size="sm"
disabled={disabled}
className="h-8 rounded-lg"
className="h-8 rounded-[6px]"
onClick={() =>
updateValue(defaultMatchingAnswerFromInputs(matchingInputs))
}
@ -166,7 +166,7 @@ export function DynamicMatchingAnswerSlot({
variant="outline"
size="sm"
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))}
>
<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" />
<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("")}
disabled={zoneDisabled}
aria-label="Remove image"
@ -332,7 +332,7 @@ function DynamicImageSlot({
if (file) void processFile(file)
}}
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",
dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60",
@ -546,7 +546,7 @@ function DynamicAudioSlot({
</div>
<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={() => {
audioRef.current?.pause()
setPlaying(false)
@ -596,7 +596,7 @@ function DynamicAudioSlot({
if (file) void processFile(file)
}}
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",
dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60",
@ -673,7 +673,7 @@ function DynamicMultipleChoiceSlot({
variant="outline"
size="sm"
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))}
>
<Plus className="h-3.5 w-3.5" />

View File

@ -51,7 +51,7 @@ export function DynamicSelectMissingWordsStimulusSlot({
variant="outline"
size="sm"
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))}
>
<Plus className="h-3.5 w-3.5" />
@ -62,7 +62,7 @@ export function DynamicSelectMissingWordsStimulusSlot({
variant="outline"
size="sm"
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))}
>
<Plus className="h-3.5 w-3.5" />
@ -128,7 +128,7 @@ export function DynamicSelectMissingWordsStimulusSlot({
variant="outline"
size="sm"
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))}
>
<Plus className="h-3.5 w-3.5" />
@ -219,7 +219,7 @@ export function DynamicSelectMissingWordsAnswerSlot({
variant="outline"
size="sm"
disabled={disabled}
className="h-8 rounded-lg"
className="h-8 rounded-[6px]"
onClick={() =>
updateValue(defaultSelectMissingWordsResponseFromStimulus(stimulus))
}

View File

@ -73,7 +73,7 @@ function SortableSequenceRow({
>
<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}
aria-label={`Drag item ${itemId}`}
{...attributes}
@ -159,7 +159,7 @@ export function DynamicSequenceOrderSlot({
variant="outline"
size="sm"
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))}
>
<Plus className="h-3.5 w-3.5" />

View File

@ -887,7 +887,7 @@ export function PracticeQuestionEditorFields({
<button
type="button"
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" />
</button>
@ -897,7 +897,7 @@ export function PracticeQuestionEditorFields({
<button
type="button"
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" />
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
? "border-green-500 bg-green-50 text-green-700"
: "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300"

View File

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

View File

@ -74,7 +74,7 @@ export function NotificationDetailDialog({
<Button
variant="outline"
size="sm"
className="rounded-lg"
className="rounded-[6px]"
onClick={onRetry}
>
Try again
@ -236,7 +236,7 @@ function DetailsTab({
<div className="border-t border-grayScale-100 pt-4">
<Button
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}
>
Delete notification

View File

@ -53,7 +53,7 @@ export function NotificationSchedulePicker({
type="button"
disabled={disabled}
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",
disabled && "cursor-not-allowed opacity-50",
className,

View File

@ -215,7 +215,7 @@ export function Sidebar({
{isCollapsed && (
<button
type="button"
className="grid h-10 w-10 place-items-center rounded-md border border-grayScale-200 text-grayScale-400 transition-all hover:bg-grayScale-100 hover:text-brand-600 dark:border-grayScale-200/20 dark:hover:bg-white/5 dark:hover:text-brand-400"
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}
aria-label="Expand sidebar"
>
@ -225,7 +225,7 @@ export function Sidebar({
{!isCollapsed && (
<button
type="button"
className="hidden h-10 w-10 rounded-md place-items-center border border-grayScale-200 text-grayScale-400 transition-all hover:bg-grayScale-100 hover:text-brand-600 lg:grid dark:border-grayScale-200/20 dark:hover:bg-white/5 dark:hover:text-brand-400"
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}
aria-label="Collapse sidebar"
>
@ -234,7 +234,7 @@ export function Sidebar({
)}
<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}
aria-label="Close sidebar"
>
@ -424,7 +424,7 @@ export function Sidebar({
window.location.href = "/login";
}}
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",
)}
title={isCollapsed ? "Logout" : undefined}

View File

@ -91,7 +91,7 @@ export function SidebarNavGroup({
aria-controls={panelId}
onClick={() => setExpanded((open) => !open)}
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",
isSectionActive &&
"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"
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: {
variant: {
@ -18,7 +18,7 @@ const buttonVariants = cva(
},
size: {
default: "h-10 px-4 py-2",
sm: "h-9 rounded-md px-3",
sm: "h-9 px-3",
lg: "h-11 px-6",
icon: "h-10 w-10",
},

View File

@ -38,7 +38,7 @@ const DialogContent = React.forwardRef<
{...props}
>
{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" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>

View File

@ -123,7 +123,7 @@ export const FileUpload = React.forwardRef<HTMLInputElement, FileUploadProps>(
type="button"
onClick={() => inputRef.current?.click()}
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",
)}
>

View File

@ -53,7 +53,7 @@ export function SensitiveRevealToggle({
type="button"
onClick={toggle}
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,
)}
aria-label={revealed ? `Hide ${label}` : `Show ${label}`}
@ -115,7 +115,7 @@ export function SensitiveChart({
<button
type="button"
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" />
Show revenue

View File

@ -5,6 +5,24 @@ export type OffsetPageResult<T> = {
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.
*/

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(
res: {
data?: GetPracticesByParentContextResponse & {

View File

@ -115,7 +115,12 @@ export async function executePracticeCreation(
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 primaryParent = linkedParents[0] ?? null

View File

@ -317,7 +317,7 @@ export function ProfilePage() {
type="button"
variant="outline"
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}
>
<Pencil className="h-3.5 w-3.5" />

View File

@ -317,7 +317,7 @@ function AppearanceTab() {
type="button"
onClick={() => setTheme(id)}
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
? "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",

View File

@ -87,7 +87,7 @@ export function ForgotPasswordPage() {
<Button
type="button"
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={() => {
setSubmitted(false)
setError(null)
@ -143,7 +143,7 @@ export function ForgotPasswordPage() {
<Button
type="submit"
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 ? (
<span className="inline-flex items-center gap-2">

View File

@ -306,7 +306,7 @@ export function LoginPage() {
type="button"
onClick={handleGoogleClick}
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 ? (
<SpinnerIcon className="h-5 w-5" />
@ -403,7 +403,7 @@ export function LoginPage() {
<Button
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}
>
{loading ? "Signing in…" : "Sign in"}

View File

@ -309,7 +309,7 @@ export function ResetPasswordPage() {
<Button
type="submit"
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 ? (
<span className="inline-flex items-center gap-2">

View File

@ -852,7 +852,7 @@ export function AddNewPracticePage() {
</div>
<button
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" />
</button>
@ -910,7 +910,7 @@ export function AddNewPracticePage() {
<button
type="button"
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" />
Add another question

View File

@ -156,7 +156,9 @@ export function AddPracticeFlow() {
const backLabel = isFromQuestionType
? "Back to Question Types"
: effectiveBackTo === "module"
: effectiveBackTo === "lesson"
? "Back to Lesson"
: effectiveBackTo === "module"
? "Back to Module"
: effectiveBackTo === "unit"
? "Back to Unit"
@ -186,11 +188,36 @@ export function AddPracticeFlow() {
if (effectiveBackTo === "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) {
return `/new-content/courses/${programType}`;
}
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) {
return `/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}`;
}
@ -205,6 +232,9 @@ export function AddPracticeFlow() {
courseId,
unitId,
moduleId,
lessonId,
lessonTitleRaw,
lessonTitleDisplay,
level,
isFromQuestionType,
]);
@ -342,11 +372,12 @@ export function AddPracticeFlow() {
});
return;
}
const parents = dedupeParents(
isExamPrep && parentContext
const parents = dedupeParents([
...(parentContext
? [{ parent_kind: parentContext.kind, parent_id: parentContext.id }]
: formData.parents,
);
: []),
...(formData.parents ?? []),
]);
const parentsErr = validatePracticeParents(parents, {
required: !isFromQuestionType && !isExamPrep,
});
@ -759,7 +790,7 @@ export function AddPracticeFlow() {
</h1>
<Button
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}
>
Cancel

View File

@ -144,7 +144,7 @@ export function AddPracticePage() {
variant="ghost"
size="icon"
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" />
</Button>

View File

@ -354,7 +354,7 @@ export function AddQuestionPage() {
variant="ghost"
size="icon"
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" />
</Button>

View File

@ -192,7 +192,7 @@ export function AddVideoFlow() {
<PageBackLink fallbackTo={backPath} label="Back to module" className="text-grayScale-500" />
<Button
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}
>
Cancel

View File

@ -35,7 +35,7 @@ export function AddVideoPage() {
variant="ghost"
size="icon"
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" />
</Button>

View File

@ -448,7 +448,7 @@ export function AllCoursesPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1}
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",
)}
>
@ -465,7 +465,7 @@ export function AllCoursesPage() {
type="button"
onClick={() => setPage(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -479,7 +479,7 @@ export function AllCoursesPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages}
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",
)}
>

View File

@ -53,7 +53,7 @@ export function AttachProgramPracticeFlow() {
<div className="flex flex-col gap-4 w-full max-w-[440px]">
<Button
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
</Button>
@ -63,7 +63,7 @@ export function AttachProgramPracticeFlow() {
setIsPublished(false);
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
</Button>

View File

@ -176,7 +176,7 @@ export function ContentOverviewPage() {
<div className="flex items-center gap-3">
<Link
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" />
</Link>

View File

@ -80,7 +80,7 @@ export function CourseCategoryPage() {
</div>
<button
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" />
Retry
@ -178,7 +178,7 @@ export function CourseCategoryPage() {
</span>
<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) => {
e.preventDefault()
e.stopPropagation()
@ -295,7 +295,7 @@ export function CourseCategoryPage() {
<button
key={name}
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={() =>
setPendingSubCategories((prev) =>
prev.filter((subName) => subName !== name),

View File

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

View File

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

View File

@ -41,6 +41,8 @@ import { vimeoResultToStoredUrl } from "../../lib/video-upload/upload-video";
import { resolveThumbnailForPreview } from "../../lib/videoPreview";
import type {
ContentAccessTier,
ExamPrepModuleLessonItem,
ExamPrepUnitModuleItem,
PracticePublishStatus,
} from "../../types/course.types";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
@ -51,6 +53,10 @@ import {
filterBySearchAndPublishStatus,
type PublishStatusFilter,
} from "../../lib/contentListFilters";
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
const LESSON_THUMB_GRADIENTS = [
"from-[#CBD5E1] to-[#94A3B8]",
@ -165,12 +171,12 @@ export function CourseModuleDetailPage() {
return;
}
try {
const response = await getExamPrepUnitModules(parsedUnitId, {
limit: 100,
offset: 0,
});
const rows = response.data?.data?.modules;
const list = Array.isArray(rows) ? rows : [];
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepUnitModuleItem>(
await getExamPrepUnitModules(parsedUnitId, { limit, offset }),
"modules",
),
);
const row = list.find((m) => Number(m.id) === parsedModuleId);
if (row) {
setModuleTitle(row.name?.trim() || `Module ${parsedModuleId}`);
@ -222,12 +228,12 @@ export function CourseModuleDetailPage() {
setLessonsLoading(true);
setLessonsLoadError(null);
try {
const response = await getExamPrepModuleLessons(parsedModuleId, {
limit: 20,
offset: 0,
});
const rows = response.data?.data?.lessons;
const list = Array.isArray(rows) ? rows : [];
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepModuleLessonItem>(
await getExamPrepModuleLessons(parsedModuleId, { limit, offset }),
"lessons",
),
);
setLessons(
list.map((row) => {
const raw = row.duration_seconds ?? row.duration ?? null;
@ -804,7 +810,7 @@ export function CourseModuleDetailPage() {
<Button
type="button"
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}
onClick={clearCreateLessonForm}
>
@ -814,7 +820,7 @@ export function CourseModuleDetailPage() {
<Button
type="button"
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}
onClick={() => void handleCreateLesson("DRAFT")}
>
@ -822,7 +828,7 @@ export function CourseModuleDetailPage() {
</Button>
<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}
onClick={() => void handleCreateLesson("PUBLISHED")}
>
@ -922,7 +928,7 @@ export function CourseModuleDetailPage() {
</p>
<Button
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)}
>
<Video className="h-5 w-5" />
@ -1088,7 +1094,7 @@ export function CourseModuleDetailPage() {
<Button
type="button"
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}
onClick={closeEditLesson}
>
@ -1096,7 +1102,7 @@ export function CourseModuleDetailPage() {
</Button>
<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}
onClick={() => void handleSaveEditLesson()}
>

View File

@ -317,7 +317,7 @@ export function CoursesPage() {
<div className="flex items-center gap-3.5">
<Link
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" />
</Link>
@ -536,7 +536,7 @@ export function CoursesPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1}
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",
)}
>
@ -553,7 +553,7 @@ export function CoursesPage() {
type="button"
onClick={() => setPage(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -568,7 +568,7 @@ export function CoursesPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages}
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",
)}
>
@ -588,7 +588,7 @@ export function CoursesPage() {
<h2 className="text-lg font-bold text-grayScale-700">Add New Sub-category</h2>
<button
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" />
</button>
@ -677,7 +677,7 @@ export function CoursesPage() {
<h2 className="text-lg font-bold text-grayScale-700">Edit Sub-category</h2>
<button
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" />
</button>
@ -761,7 +761,7 @@ export function CoursesPage() {
<h2 className="text-lg font-bold text-grayScale-700">Delete Sub-category</h2>
<button
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" />
</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">
<Button
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}
onClick={() => goBack()}
>
Cancel
</Button>
<Button
className="h-10 w-full rounded-[8px] bg-brand-500 px-6 font-bold text-white shadow-md shadow-brand-500/20 hover:bg-brand-600 disabled:opacity-50 sm:w-auto"
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}
onClick={handleSaveChanges}
>

View File

@ -620,7 +620,7 @@ export function InitialAssessmentPage() {
aria-selected={selected}
onClick={() => setSelectedLevel(level)}
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
? "bg-brand-500 text-white"
: "border border-grayScale-200 bg-white text-grayScale-600 hover:border-grayScale-300",
@ -934,7 +934,7 @@ export function InitialAssessmentPage() {
<button
type="button"
onClick={closeQuestionForm}
className="rounded-lg p-1 hover:bg-grayScale-100"
className="rounded-[6px] p-1 hover:bg-grayScale-100"
disabled={savingQuestion}
>
<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 { DisplayValue } from "../../lib/displayValue"
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. */
function looksLikeRefreshableFileUrl(url: string): boolean {
@ -358,9 +362,12 @@ export function LearnEnglishPage() {
setLoading(true);
setError(null);
try {
const res = await getLearningPrograms({ limit: 100, offset: 0 });
const raw = res.data?.data?.programs;
const list = Array.isArray(raw) ? raw : [];
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<LearningProgramListItem>(
await getLearningPrograms({ limit, offset }),
"programs",
),
);
const sorted = [...list].sort(
(a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0),
);
@ -535,7 +542,7 @@ export function LearnEnglishPage() {
/>
<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}
onClick={() => createThumbnailFileInputRef.current?.click()}
>
@ -675,7 +682,7 @@ export function LearnEnglishPage() {
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
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}`}
onClick={() => openEdit(program)}
>
@ -685,7 +692,7 @@ export function LearnEnglishPage() {
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
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}`}
onClick={() => setDeletingProgram(program)}
>
@ -835,7 +842,7 @@ export function LearnEnglishPage() {
<Button
type="button"
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}
onClick={() => editThumbnailFileInputRef.current?.click()}
>
@ -898,7 +905,7 @@ export function LearnEnglishPage() {
type="button"
onClick={() => !deleting && setDeletingProgram(null)}
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" />
</button>

View File

@ -1,22 +1,11 @@
import { notifyApiError } from "../../lib/apiErrors"
import { useCallback, useEffect, useMemo, useState } from "react";
import {
AlertCircle,
ArrowLeft,
BookOpen,
Calendar,
Clock,
Edit2,
Hash,
Loader2,
RefreshCw,
Sparkles,
Trash2,
} from "lucide-react";
import { ArrowLeft, BookOpen, Calendar, RefreshCw } from "lucide-react";
import { Link, useNavigate, useParams, useSearchParams } from "react-router-dom";
import { toast } from "sonner";
import {
deleteExamPrepPractice,
deleteParentLinkedPractice,
getExamPrepLessonPractices,
getPracticesByParentLesson,
setExamPrepPracticePublishStatus,
@ -25,14 +14,11 @@ import {
import { parentsFromPractice } from "../../lib/practiceParents";
import {
isPracticeParentUnlinkNotLinkedError,
mapPracticeParentUnlinkError,
unlinkPracticeFromParent,
} from "../../lib/practiceParentUnlink";
import { Badge } from "../../components/ui/badge";
import { Button } from "../../components/ui/button";
import { PracticeActionButton } from "./components/PracticeActionButton";
import { ModulePracticeCard } from "./components/ModulePracticeCard";
import { Card, CardContent } from "../../components/ui/card";
import {
Dialog,
DialogContent,
@ -43,27 +29,19 @@ import {
import type {
ExamPrepLessonPractice,
GetExamPrepLessonPracticesResponse,
GetPracticesByParentContextResponse,
ParentContextPractice,
PracticeParent,
PracticePublishStatus,
} from "../../types/course.types";
import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
import { ContentPageDescription } from "./components/ContentPageDescription";
import {
filterBySearchAndPublishStatus,
type PublishStatusFilter,
} from "../../lib/contentListFilters";
import { resolveThumbnailForPreview } from "../../lib/videoPreview";
import { cn } from "../../lib/utils";
function unwrapPracticesEnvelope(
res: { data?: GetPracticesByParentContextResponse & { Data?: GetPracticesByParentContextResponse["data"] } },
): GetPracticesByParentContextResponse["data"] | null {
const b = res.data;
if (!b) return null;
return b.data ?? b.Data ?? null;
}
import { fetchAllOffsetPages } from "../../lib/fetchAllOffsetPages";
import { unwrapPracticesPage } from "../../lib/parentContextPractice";
function unwrapExamPrepPracticesEnvelope(
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() {
const navigate = useNavigate();
const { level, programType, courseId, unitId, moduleId, lessonId } = useParams<{
@ -319,27 +132,27 @@ export function LessonPracticesPage() {
setLoadError(null);
try {
if (isExamPrep) {
const res = await getExamPrepLessonPractices(lid, { limit: 100, offset: 0 });
const envelope = unwrapExamPrepPracticesEnvelope(res);
const list = Array.isArray(envelope?.practices)
? envelope.practices.map(mapExamPrepPracticeToCard)
: [];
const list = await fetchAllOffsetPages(async (offset, limit) => {
const res = await getExamPrepLessonPractices(lid, { limit, offset });
const envelope = unwrapExamPrepPracticesEnvelope(res);
const practices = Array.isArray(envelope?.practices)
? envelope.practices.map(mapExamPrepPracticeToCard)
: [];
return {
items: practices,
total_count: envelope?.total_count,
};
});
setPractices(list);
setTotalCount(
typeof envelope?.total_count === "number"
? envelope.total_count
: list.length,
);
setTotalCount(list.length);
} else {
const res = await getPracticesByParentLesson(lid, { limit: 100, offset: 0 });
const envelope = unwrapPracticesEnvelope(res);
const list = Array.isArray(envelope?.practices) ? envelope.practices : [];
setPractices(list);
setTotalCount(
typeof envelope?.total_count === "number"
? envelope.total_count
: list.length,
const list = await fetchAllOffsetPages(async (offset, limit) =>
unwrapPracticesPage(
await getPracticesByParentLesson(lid, { limit, offset }),
),
);
setPractices(list);
setTotalCount(list.length);
}
} catch (error) {
setPractices([]);
@ -368,7 +181,7 @@ export function LessonPracticesPage() {
moduleId,
lessonId: validLesson ? String(lid) : null,
lessonTitle: lessonTitle || displayTitle,
backTo: isExamPrep ? "lesson" : "module",
backTo: "lesson",
}),
[
isExamPrep,
@ -444,14 +257,14 @@ export function LessonPracticesPage() {
toast.success(`Practice removed from ${displayTitle}`);
setPracticeToUnlink(null);
await load();
} catch (e) {
if (isPracticeParentUnlinkNotLinkedError(e)) {
} catch (error) {
if (isPracticeParentUnlinkNotLinkedError(error)) {
toast.info("This location was already removed.");
setPracticeToUnlink(null);
await load();
return;
}
notifyApiError(err, "Could not remove from lesson");
notifyApiError(error, "Could not remove from lesson");
} finally {
setUnlinking(false);
}
@ -461,7 +274,11 @@ export function LessonPracticesPage() {
if (!practiceToDelete) return;
setDeleting(true);
try {
await deleteExamPrepPractice(practiceToDelete.id);
if (isExamPrep) {
await deleteExamPrepPractice(practiceToDelete.id);
} else {
await deleteParentLinkedPractice(practiceToDelete.id);
}
toast.success("Practice deleted");
setPracticeToDelete(null);
await load();
@ -474,223 +291,136 @@ export function LessonPracticesPage() {
};
return (
<div className="min-h-screen bg-gradient-to-b from-[#F4F6FB] via-white to-[#F8FAFC]">
<div className="pointer-events-none fixed inset-0 -z-10 overflow-hidden">
<div className="absolute -right-24 -top-24 h-72 w-72 rounded-full bg-brand-500/[0.06] blur-3xl" />
<div className="absolute -bottom-32 -left-20 h-80 w-80 rounded-full bg-violet-500/[0.05] blur-3xl" />
<div className="space-y-10 pt-10 pb-20 animate-in fade-in duration-500">
<div className="flex items-center gap-2">
<Link
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
className={cn(
"mx-auto px-4 pb-24 pt-8 sm:px-6 lg:px-8",
isExamPrep ? "max-w-7xl" : "max-w-4xl",
)}
>
<div className="animate-in fade-in slide-in-from-bottom-2 duration-500">
<Link
to={backHref}
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"
<div className="flex flex-col gap-6 md:flex-row md:items-start md:justify-between">
<div className="min-w-0">
<h1 className="text-2xl font-medium tracking-tight text-grayScale-900">
{displayTitle}
</h1>
<ContentPageDescription className="mt-1 text-[14px] text-grayScale-500">
Review speaking practices linked to this lesson.
</ContentPageDescription>
{!loading && !loadError ? (
<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">
<ArrowLeft className="h-4 w-4" />
</span>
Back to module
</Link>
<RefreshCw
className={cn("h-4 w-4", loading && "animate-spin")}
/>
Refresh
</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">
<CardContent className="p-6 sm:p-8">
<div className="flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between">
<div className="flex min-w-0 gap-4">
<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">
<BookOpen className="h-7 w-7" strokeWidth={1.75} />
</div>
<div className="min-w-0">
<p className="text-[11px] font-bold uppercase tracking-[0.2em] text-brand-500/90">
Lesson practices
</p>
<h1 className="mt-1.5 text-2xl font-semibold tracking-tight text-grayScale-900 sm:text-3xl">
{displayTitle}
</h1>
<p className="mt-2 max-w-xl text-[15px] leading-relaxed text-grayScale-500">
Review speaking practices linked to this lesson. Thumbnails
and copy come from your published practice content.
</p>
{!loading && !loadError ? (
<div className="mt-4 flex flex-wrap items-center gap-2">
<Badge variant="default" className="px-3 py-1 text-xs font-semibold">
{practices.length}{" "}
{practices.length === 1 ? "practice" : "practices"}
</Badge>
{totalCount > practices.length ? (
<span className="text-[12px] text-grayScale-500">
Showing {practices.length} of {totalCount}
</span>
) : null}
</div>
) : null}
</div>
</div>
<div className="flex shrink-0 flex-col gap-2 sm:flex-row lg:flex-col">
<PracticeActionButton
type="button"
className="h-11 rounded-xl bg-brand-500 px-6 font-semibold shadow-md shadow-brand-500/20 hover:bg-brand-600"
pathOptions={practicePathOptions}
parentLabel={displayTitle}
>
<Calendar className="mr-2 h-4 w-4" />
Add practice
</PracticeActionButton>
<Button
type="button"
variant="outline"
className="h-11 rounded-xl border-grayScale-200 font-semibold text-grayScale-700 hover:bg-grayScale-50"
disabled={loading}
onClick={() => void load()}
>
<RefreshCw
className={cn("mr-2 h-4 w-4", loading && "animate-spin")}
/>
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>
{loading ? (
<div className="flex flex-col items-center justify-center py-24 text-[15px] font-medium text-grayScale-500">
Loading practices…
</div>
) : loadError ? (
<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">
{loadError}
<div className="mt-4">
<Button
type="button"
variant="outline"
size="sm"
onClick={() => void load()}
>
Try again
</Button>
</div>
</div>
) : practices.length === 0 ? (
<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">
<BookOpen className="mb-3 h-10 w-10 text-grayScale-300" />
<p className="text-sm font-medium text-grayScale-600">
No practices for this lesson yet
</p>
<p className="mt-1 max-w-md text-sm text-grayScale-400">
Add a practice to give learners a structured speaking activity after
the video.
</p>
<PracticeActionButton
variant="outline"
className="mt-6 rounded-[6px] border-brand-500 text-brand-500"
pathOptions={practicePathOptions}
parentLabel={displayTitle}
>
<Calendar className="h-4 w-4" />
Add Practice
</PracticeActionButton>
</div>
) : (
<div className="space-y-8">
<ContentListSearchFilterBar
search={listSearch}
onSearchChange={setListSearch}
publishStatusFilter={publishStatusFilter}
onPublishStatusFilterChange={setPublishStatusFilter}
searchPlaceholder="Search practices by title or description…"
searchAriaLabel="Search practices"
/>
{filteredPractices.length === 0 ? (
<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">
No practices match your search or status filter
</p>
</div>
) : (
<div className="space-y-5">
<ContentListSearchFilterBar
search={listSearch}
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
<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}
index={i}
total={filteredPractices.length}
statusUpdating={publishStatusUpdatingId === p.id}
searchQuery={listSearch}
onEdit={() => void navigate(editPracticeHref(p.id))}
onUnlink={() => setPracticeToUnlink(p)}
onDelete={isExamPrep ? () => setPracticeToDelete(p) : undefined}
publishStatusUpdating={publishStatusUpdatingId === p.id}
onTogglePublishStatus={(nextStatus) =>
void handlePracticePublishStatus(p.id, nextStatus)
onPublish={() =>
void handlePracticePublishStatus(p.id, "PUBLISHED")
}
onSaveAsDraft={() =>
void handlePracticePublishStatus(p.id, "DRAFT")
}
onUnlink={() => setPracticeToUnlink(p)}
onDelete={() => setPracticeToDelete(p)}
/>
))
)}
))}
</div>
)}
</div>
</div>
)}
<Dialog
open={practiceToUnlink !== null}
@ -698,16 +428,16 @@ export function LessonPracticesPage() {
if (!open && !unlinking) setPracticeToUnlink(null);
}}
>
<DialogContent>
<DialogContent className="max-w-md rounded-2xl">
<DialogHeader>
<DialogTitle>Remove from this lesson?</DialogTitle>
</DialogHeader>
<p className="text-sm text-grayScale-600">
<span className="font-semibold text-grayScale-900">
<span className="font-semibold text-grayScale-800">
{practiceToUnlink?.title}
</span>{" "}
will be detached from{" "}
<span className="font-semibold text-grayScale-900">{displayTitle}</span>.
<span className="font-semibold text-grayScale-800">{displayTitle}</span>.
{practiceToUnlink &&
parentsFromPractice(practiceToUnlink).filter(
(p) =>
@ -719,7 +449,7 @@ export function LessonPracticesPage() {
? " The practice will be unlinked until you attach it again. Questions are kept."
: " Other locations are unaffected."}
</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
type="button"
variant="outline"
@ -745,17 +475,17 @@ export function LessonPracticesPage() {
if (!open && !deleting) setPracticeToDelete(null);
}}
>
<DialogContent>
<DialogContent className="max-w-md rounded-2xl">
<DialogHeader>
<DialogTitle>Delete this practice permanently?</DialogTitle>
</DialogHeader>
<p className="text-sm text-grayScale-600">
<span className="font-semibold text-grayScale-900">
<span className="font-semibold text-grayScale-800">
{practiceToDelete?.title}
</span>{" "}
and all of its questions will be deleted. This cannot be undone.
</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
type="button"
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>
<Button
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}
>
Cancel

View File

@ -20,7 +20,11 @@ import type {
PracticePublishStatus,
TopLevelModuleLessonItem,
} 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 {
isPracticeParentUnlinkNotLinkedError,
@ -182,10 +186,14 @@ export function ModuleDetailPage() {
let cancelled = false;
(async () => {
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;
const list = res.data?.data?.modules;
if (Array.isArray(list)) {
if (list.length > 0) {
const m = list.find((mod) => mod.id === id);
if (m) {
setLoadedModuleName(m.name);
@ -229,17 +237,15 @@ export function ModuleDetailPage() {
setLessonsLoadError(null);
}
try {
const res = await getModuleLessons(mid, { limit: 100, offset: 0 });
const list = res.data?.data?.lessons;
if (Array.isArray(list)) {
setLessons(
[...list].sort(
(a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0),
),
);
} else {
setLessons([]);
}
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<TopLevelModuleLessonItem>(
await getModuleLessons(mid, { limit, offset }),
"lessons",
),
);
setLessons(
[...list].sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0)),
);
if (showPageLoading) {
setLessonsLoadError(null);
}
@ -274,11 +280,12 @@ export function ModuleDetailPage() {
setPracticesLoading(true);
setPracticesLoadError(null);
try {
const res = await getPracticesByParentModule(mid, {
limit: 100,
offset: 0,
});
setPractices(unwrapPracticesList(res));
const list = await fetchAllOffsetPages(async (offset, limit) =>
unwrapPracticesPage(
await getPracticesByParentModule(mid, { limit, offset }),
),
);
setPractices(list);
} catch {
setPractices([]);
setPracticesLoadError("Failed to load practices. Please try again.");
@ -633,7 +640,7 @@ export function ModuleDetailPage() {
moduleId,
lessonId: String(lesson.id),
lessonTitle: lesson.title,
backTo: "module",
backTo: "lesson",
})
}
onViewPractices={() =>
@ -671,7 +678,7 @@ export function ModuleDetailPage() {
</p>
<Button
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={() =>
navigate(
`/new-content/learn-english/${level}/courses/${courseId}/modules/${moduleId}/add-video`,
@ -748,7 +755,7 @@ export function ModuleDetailPage() {
{practices.length === 0 ? (
<PracticeActionButton
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}
parentLabel={displayModuleName}
>
@ -877,7 +884,7 @@ export function ModuleDetailPage() {
!deletingLessonInFlight && setDeletingLesson(null)
}
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" />
</button>

View File

@ -682,7 +682,7 @@ export function PracticeDetailsPage() {
aria-selected={flowMode === "view"}
onClick={() => setFlowMode("view")}
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"
? "bg-white text-brand-600 shadow-sm"
: "text-grayScale-500 hover:text-grayScale-800",
@ -697,7 +697,7 @@ export function PracticeDetailsPage() {
aria-selected={flowMode === "create"}
onClick={() => setFlowMode("create")}
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"
? "bg-white text-brand-600 shadow-sm"
: "text-grayScale-500 hover:text-grayScale-800",

View File

@ -678,7 +678,7 @@ export function PracticeQuestionsPage() {
<Button
variant="ghost"
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)}
>
<Edit className="h-4 w-4" />
@ -686,7 +686,7 @@ export function PracticeQuestionsPage() {
<Button
variant="ghost"
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)}
>
<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>
<button
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" />
</button>
@ -831,7 +831,7 @@ export function PracticeQuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Add New Question</h2>
<button
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" />
</button>
@ -919,7 +919,7 @@ export function PracticeQuestionsPage() {
<button
type="button"
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" />
</button>
@ -929,7 +929,7 @@ export function PracticeQuestionsPage() {
<button
type="button"
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" />
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
? "border-green-500 bg-green-50 text-green-700"
: "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>
<button
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" />
</button>
@ -1135,7 +1135,7 @@ export function PracticeQuestionsPage() {
<button
type="button"
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" />
</button>
@ -1145,7 +1145,7 @@ export function PracticeQuestionsPage() {
<button
type="button"
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" />
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
? "border-green-500 bg-green-50 text-green-700"
: "border-grayScale-200 text-grayScale-600 hover:border-grayScale-300"

View File

@ -48,6 +48,10 @@ import type {
import { PublishPracticeButton } from "./components/PublishPracticeButton";
import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
export function ProgramCoursesPage() {
const navigate = useNavigate();
@ -165,18 +169,23 @@ export function ProgramCoursesPage() {
setLoading(true);
setError(null);
try {
const [coursesRes, programsRes] = await Promise.all([
getProgramCourses(programId, { limit: 100, offset: 0 }),
getLearningPrograms({ limit: 100, offset: 0 }),
const [courseList, programRows] = await Promise.all([
fetchAllOffsetPages(async (offset, limit) =>
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 list = Array.isArray(programRows) ? programRows : [];
const found = list.find((p) => p.id === programId) ?? null;
const found = programRows.find((p) => p.id === programId) ?? null;
setProgram(found);
const raw = coursesRes.data?.data?.courses;
const courseList = Array.isArray(raw) ? raw : [];
const sorted = [...courseList].sort(
(a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0),
);
@ -549,7 +558,7 @@ export function ProgramCoursesPage() {
/>
<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}
onClick={() =>
createThumbnailFileInputRef.current?.click()
@ -601,7 +610,7 @@ export function ProgramCoursesPage() {
<Button
type="button"
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}
onClick={() =>
handleCreateCourseDialogOpenChange(false)
@ -611,7 +620,7 @@ export function ProgramCoursesPage() {
</Button>
<Button
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}
>
{createSaving ? "Creating…" : "Create Course"}
@ -705,7 +714,7 @@ export function ProgramCoursesPage() {
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
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}`}
onClick={() => openEditCourse(course)}
>
@ -715,7 +724,7 @@ export function ProgramCoursesPage() {
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
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}`}
onClick={() => setDeletingCourse(course)}
>
@ -898,7 +907,7 @@ export function ProgramCoursesPage() {
<Button
type="button"
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}
onClick={() => editThumbnailFileInputRef.current?.click()}
>
@ -958,7 +967,7 @@ export function ProgramCoursesPage() {
type="button"
onClick={() => !deleting && setDeletingCourse(null)}
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" />
</button>

View File

@ -36,7 +36,11 @@ import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip"
import { ContentAccessTierChip } from "./components/ContentAccessTierChip";
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
import { ContentPageDescription } from "./components/ContentPageDescription";
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types";
import type {
ContentAccessTier,
ExamPrepCatalogCourseItem,
PracticePublishStatus,
} from "../../types/course.types";
import {
filterBySearchAndPublishStatus,
hasActiveContentFilters,
@ -46,6 +50,10 @@ import { uploadImageFile } from "../../api/files.api";
import uploadIcon from "../../assets/icons/upload.png";
import { DisplayValue } from "../../lib/displayValue"
import { SearchHighlight } from "../../components/SearchHighlight"
import {
fetchAllOffsetPages,
offsetPageFromListEnvelope,
} from "../../lib/fetchAllOffsetPages";
export function ProgramDetailPage() {
const navigate = useNavigate();
@ -111,9 +119,12 @@ export function ProgramDetailPage() {
if (programType !== "proficiency") return;
setCatalogLoading(true);
try {
const response = await getExamPrepCatalogCourses({ limit: 20, offset: 0 });
const rows = response.data?.data?.catalog_courses;
const list = Array.isArray(rows) ? rows : [];
const list = await fetchAllOffsetPages(async (offset, limit) =>
offsetPageFromListEnvelope<ExamPrepCatalogCourseItem>(
await getExamPrepCatalogCourses({ limit, offset }),
"catalog_courses",
),
);
setCreatedCourses(
list.map((row) => ({
id: Number(row.id),
@ -551,7 +562,7 @@ export function ProgramDetailPage() {
/>
<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}
onClick={() => createThumbnailFileInputRef.current?.click()}
>
@ -606,14 +617,14 @@ export function ProgramDetailPage() {
<DialogClose asChild>
<Button
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}
>
Cancel
</Button>
</DialogClose>
<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}
onClick={() => void handleCreateCourse()}
>
@ -695,7 +706,7 @@ export function ProgramDetailPage() {
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
className="h-8 w-8 rounded-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
onClick={() => openEditCourse(course)}
aria-label={`Edit ${course.name}`}
>
@ -705,7 +716,7 @@ export function ProgramDetailPage() {
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
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))}
aria-label={`Delete ${course.name}`}
>
@ -784,7 +795,7 @@ export function ProgramDetailPage() {
{/* Action 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={() =>
navigate(`/new-content/courses/${programType}/${course.id}`)
}
@ -847,7 +858,7 @@ export function ProgramDetailPage() {
/>
<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()}
disabled={savingEdit || uploadingEditThumbnail}
>
@ -888,7 +899,7 @@ export function ProgramDetailPage() {
<Button
type="button"
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}
disabled={savingEdit || uploadingEditThumbnail}
>
@ -896,7 +907,7 @@ export function ProgramDetailPage() {
</Button>
<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()}
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.
</p>
<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" />
Create definition
</Button>

View File

@ -197,7 +197,7 @@ export function QuestionTypeLibraryPage() {
</p>
</div>
<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" />
Create definition
</Button>
@ -223,7 +223,7 @@ export function QuestionTypeLibraryPage() {
type="button"
variant="outline"
size="sm"
className="rounded-[8px] border-grayScale-200"
className="rounded-[6px] border-grayScale-200"
disabled={loading}
onClick={() => {
void load()
@ -254,7 +254,7 @@ export function QuestionTypeLibraryPage() {
<button
type="button"
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"
>
<X className="h-4 w-4" />
@ -328,14 +328,14 @@ export function QuestionTypeLibraryPage() {
type="button"
variant="outline"
size="sm"
className="rounded-[8px]"
className="rounded-[6px]"
onClick={clearFilters}
>
Clear filters
</Button>
) : (
<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" />
Create definition
</Button>
@ -414,7 +414,7 @@ export function QuestionTypeLibraryPage() {
type="button"
variant="outline"
size="sm"
className="rounded-[8px] border-grayScale-200"
className="rounded-[6px] border-grayScale-200"
disabled={!canPrev || loading}
onClick={() => setOffset((o) => Math.max(0, o - pageSize))}
>
@ -425,7 +425,7 @@ export function QuestionTypeLibraryPage() {
type="button"
variant="outline"
size="sm"
className="rounded-[8px] border-grayScale-200"
className="rounded-[6px] border-grayScale-200"
disabled={!canNext || loading}
onClick={() => setOffset((o) => o + pageSize)}
>
@ -511,7 +511,7 @@ function FilterChip({
disabled={disabled}
onClick={onClick}
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
? "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",

View File

@ -596,7 +596,7 @@ export function QuestionsPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1}
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",
)}
>
@ -613,7 +613,7 @@ export function QuestionsPage() {
type="button"
onClick={() => setPage(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -627,7 +627,7 @@ export function QuestionsPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages}
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",
)}
>
@ -648,7 +648,7 @@ export function QuestionsPage() {
</h2>
<button
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" />
</button>
@ -681,7 +681,7 @@ export function QuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Question Details</h2>
<button
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" />
</button>
@ -798,7 +798,7 @@ export function QuestionsPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Question</h2>
<button
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" />
</button>

View File

@ -1356,7 +1356,7 @@ export function SpeakingPage() {
<Button
type="button"
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">
{selectedPracticeId
@ -1442,7 +1442,7 @@ export function SpeakingPage() {
<div className="inline-flex items-center gap-2">
<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)}
>
{group.practiceId && collapsedPracticeIds.includes(group.practiceId) ? (
@ -2044,7 +2044,7 @@ export function SpeakingPage() {
<Button
type="button"
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">
{selectedSubCourseOption
@ -2097,7 +2097,7 @@ export function SpeakingPage() {
<Button
type="button"
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>
<ChevronDown className="h-4 w-4 text-grayScale-400" />
@ -2198,7 +2198,7 @@ export function SpeakingPage() {
<Button
type="button"
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>
<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">
<Link
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" />
</Link>
@ -113,7 +113,7 @@ export function SubCategoryCoursesPage() {
navigate(`/content/category/${categoryId}/courses/${c.id}/sub-modules`)
}
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",
)}
>

View File

@ -631,13 +631,13 @@ export function SubModuleContentPage() {
<div className="flex gap-0.5" onClick={(e) => e.stopPropagation()}>
<button
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" />
</button>
<button
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" />
</button>
@ -718,7 +718,7 @@ export function SubModuleContentPage() {
<div className="relative">
<button
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" />
</button>
@ -918,7 +918,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Delete Practice</h2>
<button
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" />
</button>
@ -949,7 +949,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Practice</h2>
<button
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" />
</button>
@ -1007,7 +1007,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Add Video</h2>
<button
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" />
</button>
@ -1150,7 +1150,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Edit Video</h2>
<button
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" />
</button>
@ -1208,7 +1208,7 @@ export function SubModuleContentPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Delete Video</h2>
<button
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" />
</button>
@ -1248,7 +1248,7 @@ export function SubModuleContentPage() {
</div>
<button
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" />
</button>

View File

@ -195,7 +195,7 @@ export function SubModulesPage() {
<div className="flex items-start gap-3 min-w-0">
<Link
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" />
</Link>

View File

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

View File

@ -201,7 +201,7 @@ export function AddModuleModal({
<Button
type="button"
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}
>
Cancel
@ -209,7 +209,7 @@ export function AddModuleModal({
</DialogClose>
<Button
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}
>
{submitting ? "Creating…" : "Create module"}

View File

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

View File

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

View File

@ -197,7 +197,7 @@ export function LessonMediaUploadField({
onDragLeave={handleDragLeave}
onDrop={handleDrop}
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",
dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60",

View File

@ -126,7 +126,7 @@ export function ModuleIconUploadField({
onDragLeave={handleDragLeave}
onDrop={handleDrop}
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",
dragActive && "border-[#9E2891] bg-[#9E289108]",
zoneDisabled && "cursor-not-allowed opacity-60",

View File

@ -117,7 +117,7 @@ export function ModulePracticeCard({
type="button"
variant="ghost"
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}
aria-label={`Practice options: ${practice.title}`}
onClick={(e) => e.stopPropagation()}
@ -177,7 +177,7 @@ export function ModulePracticeCard({
<Button
type="button"
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) => {
e.stopPropagation();
onEdit?.();
@ -190,7 +190,7 @@ export function ModulePracticeCard({
type="button"
disabled={isPublished || statusUpdating}
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
? "cursor-default bg-[#ECD5E9] text-[#9E2891] hover:bg-[#ECD5E9]"
: "bg-brand-500 text-white hover:bg-brand-600",

View File

@ -71,7 +71,7 @@ export function PracticeActionChoiceDialog({
onOpenChange(false)
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">
<Plus className="h-5 w-5" />
@ -87,7 +87,7 @@ export function PracticeActionChoiceDialog({
<button
type="button"
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">
<Link2 className="h-5 w-5" />
@ -105,7 +105,7 @@ export function PracticeActionChoiceDialog({
<Button
type="button"
variant="outline"
className="w-full rounded-[8px]"
className="w-full rounded-[6px]"
onClick={() => onOpenChange(false)}
>
Cancel

View File

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

View File

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

View File

@ -314,7 +314,7 @@ export function VideoCard({
type="button"
variant="secondary"
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}`}
onClick={(e) => {
e.stopPropagation();
@ -329,7 +329,7 @@ export function VideoCard({
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
className="h-8 w-8 rounded-[6px] bg-white/95 text-grayScale-600 shadow-sm transition-colors hover:bg-white"
aria-label={`Edit ${title}`}
onClick={(e) => {
e.stopPropagation();
@ -344,7 +344,7 @@ export function VideoCard({
type="button"
variant="secondary"
size="icon"
className="h-8 w-8 rounded-md bg-white/95 text-red-600 shadow-sm transition-colors hover:bg-red-50"
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}`}
onClick={(e) => {
e.stopPropagation();
@ -548,7 +548,7 @@ export function VideoCard({
{!hoverModuleActions ? (
<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" />
</button>
@ -574,7 +574,7 @@ export function VideoCard({
<Button
type="button"
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) => {
e.stopPropagation();
onAddPractice();
@ -592,7 +592,7 @@ export function VideoCard({
<Button
variant="outline"
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" />
Edit
@ -602,7 +602,7 @@ export function VideoCard({
disabled={status === "Published"}
onClick={onPublish}
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"
? "bg-[#E9D5E5] text-white opacity-100 cursor-default"
: "bg-brand-500 text-white hover:bg-brand-600 shadow-brand-500/10",

View File

@ -153,7 +153,7 @@ export function ContextStep({
<button
type="button"
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>
<p className="text-sm font-semibold text-grayScale-800">Locations (optional)</p>

View File

@ -80,7 +80,7 @@ export function PersonaStep({
type="button"
onClick={() => setSelectedPersona(persona.id)}
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
? "border-brand-500 shadow-md shadow-brand-100/50"
: "border-grayScale-100 hover:border-brand-200",

View File

@ -244,7 +244,7 @@ export function PracticeParentsField({
size="sm"
disabled={disabled || Boolean(unlinkingKey)}
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" />
Add location

View File

@ -84,7 +84,7 @@ export function ReviewAudioPlayer({
>
<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}`}
onClick={() => {
const audio = new Audio(src);
@ -196,7 +196,7 @@ export function PracticeSequentialReview({
<button
type="button"
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
@ -335,7 +335,7 @@ export function PracticeSequentialReview({
<button
type="button"
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

View File

@ -349,7 +349,7 @@ export function QuestionBankAttachDialog({
<Button
type="button"
variant="outline"
className="rounded-lg"
className="rounded-[6px]"
onClick={() => onOpenChange(false)}
disabled={attaching}
>
@ -357,7 +357,7 @@ export function QuestionBankAttachDialog({
</Button>
<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}
disabled={attaching || selectedIds.length === 0}
>

View File

@ -677,7 +677,7 @@ export function QuestionsStep({
type="button"
variant="outline"
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}
>
<ChevronsDownUp className="h-4 w-4" />
@ -687,7 +687,7 @@ export function QuestionsStep({
type="button"
variant="outline"
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}
>
<ChevronsUpDown className="h-4 w-4" />
@ -747,7 +747,7 @@ export function QuestionsStep({
{canReorder ? (
<button
{...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}`}
>
<GripVertical className="h-5 w-5" />
@ -805,7 +805,7 @@ export function QuestionsStep({
variant="ghost"
size="icon"
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={() => {
const newQuestions = formData.questions.filter(
(item: any) => item.id !== q.id,

View File

@ -156,7 +156,7 @@ export function SelectPracticeToAttachStep({
type="button"
onClick={() => setUnlinkedOnly(false)}
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
? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",
@ -168,7 +168,7 @@ export function SelectPracticeToAttachStep({
type="button"
onClick={() => setUnlinkedOnly(true)}
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
? "bg-brand-500 text-white"
: "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"
onClick={onClick}
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
? "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",

View File

@ -228,7 +228,7 @@ export function ReviewPublishStep({
variant="outline"
onClick={prevStep}
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
</Button>

View File

@ -186,21 +186,21 @@ export function VideoDetailStep({
<button
type="button"
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
</button>
<button
type="button"
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
</button>
<button
type="button"
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" />
</button>
@ -210,7 +210,7 @@ export function VideoDetailStep({
const url = prompt("Enter 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" />
</button>

View File

@ -838,7 +838,7 @@ export function CreateNotificationPage() {
type="button"
onClick={() => setAudienceMode("platform_role")}
className={cn(
"rounded-lg px-3 py-2 transition-all",
"rounded-[6px] px-3 py-2 transition-all",
audienceMode === "platform_role"
? "bg-brand-500 text-white shadow-sm"
: "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("")
}}
className={cn(
"rounded-lg px-3 py-2 transition-all",
"rounded-[6px] px-3 py-2 transition-all",
audienceMode === "platform_selected"
? "bg-brand-500 text-white shadow-sm"
: "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"
onClick={() => setAudienceMode("direct")}
className={cn(
"rounded-lg px-3 py-2 transition-all",
"rounded-[6px] px-3 py-2 transition-all",
audienceMode === "direct"
? "bg-brand-500 text-white shadow-sm"
: "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"
onClick={() => setAudienceMode("team_role")}
className={cn(
"rounded-lg px-3 py-2 transition-all",
"rounded-[6px] px-3 py-2 transition-all",
audienceMode === "team_role"
? "bg-brand-500 text-white shadow-sm"
: "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("")
}}
className={cn(
"rounded-lg px-3 py-2 transition-all",
"rounded-[6px] px-3 py-2 transition-all",
audienceMode === "team_selected"
? "bg-brand-500 text-white shadow-sm"
: "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"
onClick={() => setStatusFilter(tab)}
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
? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -138,7 +138,7 @@ function NotificationItem({
disabled={toggling}
onClick={() => onToggleRead(notification.id, notification.is_read)}
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",
notification.is_read
? "text-grayScale-400 hover:bg-brand-50 hover:text-brand-600"
@ -628,7 +628,7 @@ export function NotificationsPage() {
<DropdownMenuTrigger asChild>
<Button
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>
<ChevronDown className="ml-2 h-3.5 w-3.5 text-grayScale-400" />
@ -652,7 +652,7 @@ export function NotificationsPage() {
<DropdownMenuTrigger asChild>
<Button
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">
{typeFilter === "all" ? "All types" : formatNotificationTypeLabel(typeFilter)}
@ -678,7 +678,7 @@ export function NotificationsPage() {
<DropdownMenuTrigger asChild>
<Button
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>
<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}
type="button"
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
? "bg-brand-100 text-brand-600"
: "text-grayScale-500 hover:bg-grayScale-100",

View File

@ -815,7 +815,7 @@ export function PaymentsPage() {
{/* Actions */}
{selected.payment_url && (
<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">
<ExternalLink className="mr-1.5 h-3.5 w-3.5" />
Open checkout

View File

@ -118,7 +118,7 @@ export function PersonaProfilePictureUploadField({
onDragLeave={handleDragLeave}
onDrop={handleDrop}
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",
dragActive && "border-brand-400 bg-brand-50/40",
zoneDisabled && "cursor-not-allowed opacity-60",

View File

@ -363,14 +363,14 @@ export function RolesListPage({ embedded = false }: RolesListPageProps) {
type="button"
onClick={() => setRoleCategoryFilter(value)}
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
? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",
)}
>
{label}
</button>
</button>
))}
</div>

View File

@ -288,7 +288,7 @@ export function AppVersionsTab() {
type="button"
onClick={() => setPlatformFilter(tab.id)}
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
? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",
@ -312,7 +312,7 @@ export function AppVersionsTab() {
type="button"
onClick={() => setStatusFilter(tab.id)}
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
? "bg-grayScale-800 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -232,7 +232,7 @@ export function SubscriptionPlansTab() {
type="button"
onClick={() => setStatusFilter(tab.id)}
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
? "bg-brand-500 text-white"
: "bg-grayScale-100 text-grayScale-600 hover:bg-grayScale-200",

View File

@ -194,7 +194,7 @@ export function SubscriptionsExportPage() {
<button
type="button"
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" />
Clear filters

View File

@ -67,7 +67,7 @@ export function AddTeamMemberPage() {
<Button
variant="ghost"
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")}
>
<ArrowLeft className="h-4 w-4 text-grayScale-500" />

View File

@ -464,7 +464,7 @@ export function TeamManagementPage() {
onClick={handlePrev}
disabled={safePage === 1}
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"
)}
>
@ -482,7 +482,7 @@ export function TeamManagementPage() {
type="button"
onClick={() => setPage(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50"
@ -497,7 +497,7 @@ export function TeamManagementPage() {
onClick={handleNext}
disabled={safePage === pageCount}
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"
)}
>
@ -523,7 +523,7 @@ export function TeamManagementPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Confirm Status Change</h2>
<button
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" />
</button>

View File

@ -444,7 +444,7 @@ export function TeamMemberDetailPage() {
<button
type="button"
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" />
</button>

View File

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

View File

@ -284,7 +284,7 @@ export function DeletionRequestsPage() {
<div className="relative" ref={roleMenuRef}>
<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={() => {
setRoleMenuOpen((prev) => !prev)
setStatusMenuOpen(false)
@ -310,7 +310,7 @@ export function DeletionRequestsPage() {
<button
type="button"
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 === ""
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",
@ -328,7 +328,7 @@ export function DeletionRequestsPage() {
key={roleName}
type="button"
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
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",
@ -352,7 +352,7 @@ export function DeletionRequestsPage() {
<div className="relative" ref={statusMenuRef}>
<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={() => {
setStatusMenuOpen((prev) => !prev)
setStateMenuOpen(false)
@ -367,7 +367,7 @@ export function DeletionRequestsPage() {
<button
type="button"
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 === ""
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",
@ -385,7 +385,7 @@ export function DeletionRequestsPage() {
key={statusOption}
type="button"
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
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",
@ -408,7 +408,7 @@ export function DeletionRequestsPage() {
<div className="relative" ref={stateMenuRef}>
<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={() => {
setStateMenuOpen((prev) => !prev)
setStatusMenuOpen(false)
@ -423,7 +423,7 @@ export function DeletionRequestsPage() {
<button
type="button"
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 === ""
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",
@ -441,7 +441,7 @@ export function DeletionRequestsPage() {
key={stateOption}
type="button"
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
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",
@ -612,7 +612,7 @@ export function DeletionRequestsPage() {
onClick={() => safePage > 1 && setPage(safePage - 1)}
disabled={safePage === 1}
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",
)}
>
@ -629,7 +629,7 @@ export function DeletionRequestsPage() {
type="button"
onClick={() => setPage(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50",
@ -643,7 +643,7 @@ export function DeletionRequestsPage() {
onClick={() => safePage < totalPages && setPage(safePage + 1)}
disabled={safePage === totalPages}
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",
)}
>

View File

@ -569,7 +569,7 @@ export function UserDetailPage() {
<button
type="button"
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" />
</button>

View File

@ -82,7 +82,7 @@ function UserListFilterDropdown({
id={id}
disabled={disabled}
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",
disabled && "cursor-not-allowed bg-grayScale-50 text-grayScale-400",
)}
@ -726,7 +726,7 @@ export function UsersListPage() {
onClick={handlePrev}
disabled={safePage === 1}
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"
)}
>
@ -744,7 +744,7 @@ export function UsersListPage() {
type="button"
onClick={() => setPage(n)}
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
? "border-brand-500 bg-brand-500 text-white"
: "bg-white text-grayScale-600 hover:bg-grayScale-50"
@ -759,7 +759,7 @@ export function UsersListPage() {
onClick={handleNext}
disabled={safePage === pageCount}
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"
)}
>
@ -776,7 +776,7 @@ export function UsersListPage() {
<h2 className="text-lg font-semibold text-grayScale-900">Confirm Status Change</h2>
<button
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" />
</button>

View File

@ -268,7 +268,7 @@ export function GrantSubscriptionDialog({
role="option"
aria-selected={selected}
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
? "bg-brand-100/50 text-brand-700"
: "text-grayScale-600 hover:bg-grayScale-100",

View File

@ -290,7 +290,7 @@ export function UserLearningActivitySection({
<button
type="button"
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",
)}
onClick={() => setTrack("lms")}
@ -300,7 +300,7 @@ export function UserLearningActivitySection({
<button
type="button"
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"
? "bg-brand-500 text-white"
: "text-grayScale-500 hover:text-grayScale-700",

View File

@ -231,7 +231,7 @@ function ActiveSubscriptionsCard({
type="button"
variant="outline"
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}
title={
!cancelEnabled
@ -254,7 +254,7 @@ function ActiveSubscriptionsCard({
{canExtend ? (
<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}
title={
!extendEnabled
@ -271,7 +271,7 @@ function ActiveSubscriptionsCard({
{canGrant ? (
<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}
title={
!grantEnabled
@ -339,7 +339,7 @@ function EmptySubscriptionCard({
{canExtend ? (
<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
title="Extend is only available when this learner has an active subscription."
>
@ -352,7 +352,7 @@ function EmptySubscriptionCard({
{canGrant ? (
<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}
title={
!grantEnabled
@ -368,7 +368,7 @@ function EmptySubscriptionCard({
<Button
type="button"
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
title="Cancel is only available when this learner has an active subscription."
>
@ -615,7 +615,7 @@ export function UserSubscriptionsSection({
type="button"
variant="outline"
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}
title={
!subscription.is_currently_active
@ -632,7 +632,7 @@ export function UserSubscriptionsSection({
type="button"
variant="outline"
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={
!subscription.is_currently_active ||
subscription.status.toUpperCase() === "CANCELLED"