@exxatdesignux/ui 0.0.5 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/init.mjs +29 -0
- package/package.json +7 -2
- package/template/.nvmrc +1 -0
- package/template/.prettierignore +7 -0
- package/template/.prettierrc +11 -0
- package/template/AGENTS.md +485 -0
- package/template/Logo/Exxat_Prism.svg +39 -0
- package/template/Logo/Exxat_one.svg +36 -0
- package/template/README.md +58 -0
- package/template/app/(app)/compliance/page.tsx +10 -0
- package/template/app/(app)/dashboard/loading.tsx +18 -0
- package/template/app/(app)/dashboard/page.tsx +36 -0
- package/template/app/(app)/data-list/[id]/page.tsx +28 -0
- package/template/app/(app)/data-list/new/page.tsx +31 -0
- package/template/app/(app)/data-list/page.tsx +10 -0
- package/template/app/(app)/error.tsx +43 -0
- package/template/app/(app)/help/page.tsx +34 -0
- package/template/app/(app)/layout.tsx +54 -0
- package/template/app/(app)/loading.tsx +18 -0
- package/template/app/(app)/question-bank/page.tsx +10 -0
- package/template/app/(app)/rotations/page.tsx +15 -0
- package/template/app/(app)/settings/page.tsx +17 -0
- package/template/app/(app)/sites/all/page.tsx +13 -0
- package/template/app/(app)/team/page.tsx +10 -0
- package/template/app/favicon.ico +0 -0
- package/template/app/globals.css +1811 -0
- package/template/app/layout.tsx +95 -0
- package/template/app/page.tsx +9 -0
- package/template/components/.gitkeep +0 -0
- package/template/components/app-sidebar-dynamic.tsx +15 -0
- package/template/components/app-sidebar.tsx +901 -0
- package/template/components/ask-leo-composer.tsx +216 -0
- package/template/components/ask-leo-sidebar.tsx +509 -0
- package/template/components/chart-area-interactive.tsx +293 -0
- package/template/components/charts-overview.tsx +2321 -0
- package/template/components/command-menu-01.tsx +133 -0
- package/template/components/command-menu-02.tsx +386 -0
- package/template/components/command-menu.tsx +182 -0
- package/template/components/compliance-board-view.tsx +134 -0
- package/template/components/compliance-client.tsx +92 -0
- package/template/components/compliance-list-view.tsx +59 -0
- package/template/components/compliance-page-header.tsx +89 -0
- package/template/components/compliance-table.tsx +525 -0
- package/template/components/dashboard-onboarding-gallery.tsx +13 -0
- package/template/components/dashboard-onboarding.tsx +21 -0
- package/template/components/dashboard-promo-banner.tsx +67 -0
- package/template/components/dashboard-quota-progress-card.tsx +369 -0
- package/template/components/dashboard-report-charts.tsx +69 -0
- package/template/components/dashboard-section-heading.tsx +68 -0
- package/template/components/dashboard-tabs.tsx +598 -0
- package/template/components/data-list-client.tsx +239 -0
- package/template/components/data-list-table-cells.test.tsx +22 -0
- package/template/components/data-list-table-cells.tsx +173 -0
- package/template/components/data-list-table.tsx +879 -0
- package/template/components/data-table/filter-date-calendar.tsx +38 -0
- package/template/components/data-table/filter-text-value-input.tsx +77 -0
- package/template/components/data-table/index.tsx +1612 -0
- package/template/components/data-table/pagination.tsx +256 -0
- package/template/components/data-table/types.ts +91 -0
- package/template/components/data-table/use-table-state.ts +566 -0
- package/template/components/data-view-dashboard-charts-compliance.tsx +960 -0
- package/template/components/data-view-dashboard-charts-team.tsx +968 -0
- package/template/components/data-view-dashboard-charts.tsx +1668 -0
- package/template/components/data-views/board-card-primitives.tsx +93 -0
- package/template/components/data-views/index.ts +41 -0
- package/template/components/data-views/list-page-board-card.tsx +192 -0
- package/template/components/data-views/list-page-board-template.tsx +122 -0
- package/template/components/data-views/placement-board-card.tsx +262 -0
- package/template/components/export-drawer.tsx +375 -0
- package/template/components/exxat-product-logo.tsx +453 -0
- package/template/components/form-layout-01.tsx +131 -0
- package/template/components/getting-started.tsx +625 -0
- package/template/components/key-metrics.tsx +920 -0
- package/template/components/leo-insight-indicator.tsx +364 -0
- package/template/components/leo-typing-dots.tsx +121 -0
- package/template/components/list-hub-status-badge.tsx +51 -0
- package/template/components/list-page-dashboard-charts.tsx +18 -0
- package/template/components/nav-documents.tsx +89 -0
- package/template/components/nav-main.tsx +58 -0
- package/template/components/nav-secondary.tsx +64 -0
- package/template/components/nav-user.tsx +190 -0
- package/template/components/new-placement-back-btn.tsx +28 -0
- package/template/components/new-placement-form.tsx +1066 -0
- package/template/components/onboarding/index.ts +4 -0
- package/template/components/onboarding/onboarding-01.tsx +7 -0
- package/template/components/onboarding/onboarding-02.tsx +7 -0
- package/template/components/onboarding/onboarding-03.tsx +7 -0
- package/template/components/onboarding/onboarding-04.tsx +7 -0
- package/template/components/page-header.tsx +57 -0
- package/template/components/placement-detail.tsx +438 -0
- package/template/components/placements-board-view.tsx +404 -0
- package/template/components/placements-list-view.tsx +285 -0
- package/template/components/placements-page-header.tsx +160 -0
- package/template/components/placements-table-columns.tsx +639 -0
- package/template/components/product-switcher.tsx +116 -0
- package/template/components/question-bank-board-view.tsx +205 -0
- package/template/components/question-bank-client.tsx +77 -0
- package/template/components/question-bank-list-view.tsx +59 -0
- package/template/components/question-bank-page-header.tsx +89 -0
- package/template/components/question-bank-table.tsx +586 -0
- package/template/components/rotations-empty-state.tsx +47 -0
- package/template/components/rotations-panel-activator.tsx +8 -0
- package/template/components/secondary-nav.tsx +394 -0
- package/template/components/secondary-panel.tsx +239 -0
- package/template/components/section-cards.tsx +106 -0
- package/template/components/settings-appearance-card.tsx +424 -0
- package/template/components/settings-client.tsx +537 -0
- package/template/components/settings-form-row.tsx +42 -0
- package/template/components/sidebar-auto-collapse.tsx +23 -0
- package/template/components/sidebar-auto-open.tsx +18 -0
- package/template/components/sidebar-shell.tsx +37 -0
- package/template/components/site-header.tsx +93 -0
- package/template/components/sites-all-client.tsx +154 -0
- package/template/components/sites-board-view.tsx +67 -0
- package/template/components/sites-list-view.tsx +47 -0
- package/template/components/sites-table.tsx +312 -0
- package/template/components/system-banner-slot.tsx +66 -0
- package/template/components/table-properties/column-row.tsx +90 -0
- package/template/components/table-properties/draggable-list.ts +49 -0
- package/template/components/table-properties/drawer-button.tsx +231 -0
- package/template/components/table-properties/drawer.tsx +1102 -0
- package/template/components/table-properties/filter-card.tsx +251 -0
- package/template/components/table-properties/index.ts +22 -0
- package/template/components/table-properties/sort-card.tsx +59 -0
- package/template/components/table-properties/types.ts +124 -0
- package/template/components/task-list-panel.tsx +98 -0
- package/template/components/task-priority-badge.tsx +28 -0
- package/template/components/team-board-view.tsx +114 -0
- package/template/components/team-client.tsx +93 -0
- package/template/components/team-list-view.tsx +62 -0
- package/template/components/team-page-header.tsx +92 -0
- package/template/components/team-table.tsx +525 -0
- package/template/components/templates/list-page.tsx +576 -0
- package/template/components/templates/primary-page-template.tsx +56 -0
- package/template/components/theme-color-sync.tsx +32 -0
- package/template/components/theme-provider.tsx +71 -0
- package/template/components/tinted-icon-disc.tsx +53 -0
- package/template/components/ui/ai-thinking-surface.tsx +121 -0
- package/template/components/ui/avatar.tsx +1 -0
- package/template/components/ui/badge.tsx +1 -0
- package/template/components/ui/banner.tsx +1 -0
- package/template/components/ui/breadcrumb.tsx +1 -0
- package/template/components/ui/button.tsx +1 -0
- package/template/components/ui/calendar.tsx +1 -0
- package/template/components/ui/card.tsx +1 -0
- package/template/components/ui/chart.tsx +1 -0
- package/template/components/ui/checkbox.tsx +1 -0
- package/template/components/ui/coach-mark.tsx +1 -0
- package/template/components/ui/collapsible.tsx +1 -0
- package/template/components/ui/command.tsx +1 -0
- package/template/components/ui/date-picker-field.tsx +1 -0
- package/template/components/ui/dialog.tsx +1 -0
- package/template/components/ui/dot-pattern.tsx +159 -0
- package/template/components/ui/drag-handle-grip.tsx +1 -0
- package/template/components/ui/drawer.tsx +1 -0
- package/template/components/ui/dropdown-menu.tsx +1 -0
- package/template/components/ui/field.tsx +1 -0
- package/template/components/ui/form.tsx +1 -0
- package/template/components/ui/input-group.tsx +1 -0
- package/template/components/ui/input-mask.tsx +1 -0
- package/template/components/ui/input.tsx +1 -0
- package/template/components/ui/kbd.tsx +1 -0
- package/template/components/ui/label.tsx +1 -0
- package/template/components/ui/leo-icon.tsx +726 -0
- package/template/components/ui/payment-card-fields.tsx +1 -0
- package/template/components/ui/popover.tsx +1 -0
- package/template/components/ui/radio-group.tsx +1 -0
- package/template/components/ui/select.tsx +1 -0
- package/template/components/ui/selection-tile-grid.tsx +1 -0
- package/template/components/ui/separator.tsx +1 -0
- package/template/components/ui/sheet.tsx +1 -0
- package/template/components/ui/sidebar.tsx +1 -0
- package/template/components/ui/skeleton.tsx +1 -0
- package/template/components/ui/sonner.tsx +1 -0
- package/template/components/ui/status-badge.tsx +1 -0
- package/template/components/ui/table.tsx +1 -0
- package/template/components/ui/tabs.tsx +1 -0
- package/template/components/ui/textarea.tsx +1 -0
- package/template/components/ui/tip.tsx +1 -0
- package/template/components/ui/toggle-group.tsx +1 -0
- package/template/components/ui/toggle-switch.tsx +1 -0
- package/template/components/ui/toggle.tsx +1 -0
- package/template/components/ui/tooltip.tsx +1 -0
- package/template/components/ui/view-segmented-control.tsx +1 -0
- package/template/components.json +27 -0
- package/template/contexts/chart-variant-context.tsx +35 -0
- package/template/contexts/command-menu-context.tsx +28 -0
- package/template/contexts/dashboard-view-context.tsx +35 -0
- package/template/contexts/product-context.tsx +38 -0
- package/template/contexts/system-banner-context.tsx +127 -0
- package/template/docs/command-menu-pattern.md +45 -0
- package/template/docs/data-views-pattern.md +160 -0
- package/template/ecosystem.config.cjs +20 -0
- package/template/eslint.config.mjs +18 -0
- package/template/fontawesome-subset.manifest.json +190 -0
- package/template/hooks/.gitkeep +0 -0
- package/template/hooks/use-app-theme.ts +1 -0
- package/template/hooks/use-coach-mark.ts +1 -0
- package/template/hooks/use-mobile.ts +1 -0
- package/template/hooks/use-mod-key-label.ts +1 -0
- package/template/lib/.gitkeep +0 -0
- package/template/lib/ask-leo-route-context.ts +133 -0
- package/template/lib/chart-keyboard-selection.test.ts +20 -0
- package/template/lib/chart-keyboard-selection.ts +17 -0
- package/template/lib/chart-line-dash.ts +16 -0
- package/template/lib/coach-mark-registry.ts +68 -0
- package/template/lib/command-menu-config.ts +127 -0
- package/template/lib/command-menu-search-data.ts +44 -0
- package/template/lib/conditional-rule-match.ts +32 -0
- package/template/lib/dashboard-customize-coach-mark.ts +18 -0
- package/template/lib/dashboard-layout-merge.ts +63 -0
- package/template/lib/data-list-display-options.ts +35 -0
- package/template/lib/data-list-persistence.ts +280 -0
- package/template/lib/data-list-view-surface.ts +58 -0
- package/template/lib/data-list-view.ts +29 -0
- package/template/lib/data-view-dashboard-storage.ts +101 -0
- package/template/lib/date-filter.ts +8 -0
- package/template/lib/dev-log.test.ts +28 -0
- package/template/lib/dev-log.ts +8 -0
- package/template/lib/editable-target.ts +10 -0
- package/template/lib/floating-sheet-panel.ts +72 -0
- package/template/lib/initials-from-name.ts +7 -0
- package/template/lib/list-page-table-properties.ts +52 -0
- package/template/lib/list-status-badges.ts +168 -0
- package/template/lib/logo-dev.ts +12 -0
- package/template/lib/mock/compliance-kpi.ts +61 -0
- package/template/lib/mock/compliance.ts +146 -0
- package/template/lib/mock/dashboard.ts +105 -0
- package/template/lib/mock/navigation.tsx +231 -0
- package/template/lib/mock/placements-kpi.ts +134 -0
- package/template/lib/mock/placements.ts +183 -0
- package/template/lib/mock/question-bank-kpi.ts +61 -0
- package/template/lib/mock/question-bank.ts +142 -0
- package/template/lib/mock/sites-directory.ts +16 -0
- package/template/lib/mock/sites-kpi.ts +25 -0
- package/template/lib/mock/team-kpi.ts +60 -0
- package/template/lib/mock/team.ts +118 -0
- package/template/lib/motion-ui.ts +17 -0
- package/template/lib/placement-board-card-layout.ts +79 -0
- package/template/lib/placement-lifecycle.ts +5 -0
- package/template/lib/row-height.ts +10 -0
- package/template/lib/stock-portrait.ts +11 -0
- package/template/lib/utils.test.ts +13 -0
- package/template/lib/utils.ts +1 -0
- package/template/next.config.mjs +15 -0
- package/template/package.json +83 -0
- package/template/postcss.config.mjs +8 -0
- package/template/public/.gitkeep +0 -0
- package/template/public/Illustration/Rotation.svg +74 -0
- package/template/public/avatars/user.svg +11 -0
- package/template/public/favicon/favicon.ico +0 -0
- package/template/public/favicon.ico +0 -0
- package/template/public/logos/exxat-one.svg +36 -0
- package/template/public/logos/exxat-prism.svg +39 -0
- package/template/public/mock-schools/emory.svg +4 -0
- package/template/public/mock-schools/rush.svg +4 -0
- package/template/scripts/fontawesome-subset-audit.mjs +190 -0
- package/template/scripts/pm2-startup-macos.sh +13 -0
- package/template/skills-lock.json +10 -0
- package/template/stores/app-store.ts +33 -0
- package/template/tests/setup.ts +1 -0
- package/template/tsconfig.json +35 -0
- package/template/types/react-payment-inputs.d.ts +19 -0
- package/template/vitest.config.ts +18 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { cn } from "@/lib/utils"
|
|
5
|
+
import {
|
|
6
|
+
DropdownMenu,
|
|
7
|
+
DropdownMenuContent,
|
|
8
|
+
DropdownMenuItem,
|
|
9
|
+
DropdownMenuLabel,
|
|
10
|
+
DropdownMenuSeparator,
|
|
11
|
+
DropdownMenuTrigger,
|
|
12
|
+
} from "@/components/ui/dropdown-menu"
|
|
13
|
+
import {
|
|
14
|
+
SidebarMenu,
|
|
15
|
+
SidebarMenuButton,
|
|
16
|
+
SidebarMenuItem,
|
|
17
|
+
useSidebar,
|
|
18
|
+
} from "@/components/ui/sidebar"
|
|
19
|
+
import { ExxatProductLogo, ExxatProductMark } from "@/components/exxat-product-logo"
|
|
20
|
+
import { useProduct, type Product } from "@/contexts/product-context"
|
|
21
|
+
|
|
22
|
+
const PRODUCTS: { id: Product; label: string }[] = [
|
|
23
|
+
{ id: "exxat-one", label: "Exxat One" },
|
|
24
|
+
{ id: "exxat-prism", label: "Exxat Prism" },
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
export function ProductSwitcher() {
|
|
28
|
+
const { product, setProduct } = useProduct()
|
|
29
|
+
const { state, isMobile } = useSidebar()
|
|
30
|
+
|
|
31
|
+
const current = PRODUCTS.find(p => p.id === product) ?? PRODUCTS[0]
|
|
32
|
+
const iconRail = state === "collapsed" && !isMobile
|
|
33
|
+
const expandedOrMobile = state === "expanded" || isMobile
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<SidebarMenu>
|
|
37
|
+
<SidebarMenuItem>
|
|
38
|
+
<DropdownMenu>
|
|
39
|
+
<DropdownMenuTrigger asChild>
|
|
40
|
+
<SidebarMenuButton
|
|
41
|
+
size="lg"
|
|
42
|
+
className={cn(
|
|
43
|
+
"items-start py-2 text-sidebar-foreground data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
44
|
+
expandedOrMobile &&
|
|
45
|
+
"h-auto min-h-12 overflow-x-clip overflow-y-visible",
|
|
46
|
+
"group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:justify-center",
|
|
47
|
+
iconRail &&
|
|
48
|
+
"group-data-[collapsible=icon]:!size-9 group-data-[collapsible=icon]:!min-h-9 group-data-[collapsible=icon]:!max-h-9 group-data-[collapsible=icon]:!p-0 group-data-[collapsible=icon]:overflow-visible",
|
|
49
|
+
)}
|
|
50
|
+
aria-label={`Current product: ${current.label}. Switch product`}
|
|
51
|
+
suppressHydrationWarning
|
|
52
|
+
>
|
|
53
|
+
{iconRail ? (
|
|
54
|
+
<span className="flex size-8 shrink-0 items-center justify-center">
|
|
55
|
+
<ExxatProductMark
|
|
56
|
+
product={current.id}
|
|
57
|
+
className="size-7 max-h-none"
|
|
58
|
+
/>
|
|
59
|
+
</span>
|
|
60
|
+
) : (
|
|
61
|
+
<>
|
|
62
|
+
<span
|
|
63
|
+
className="mt-0.5 flex min-h-8 min-w-0 flex-1 items-center overflow-x-clip overflow-y-visible"
|
|
64
|
+
aria-hidden="true"
|
|
65
|
+
>
|
|
66
|
+
<ExxatProductLogo
|
|
67
|
+
product={current.id}
|
|
68
|
+
variant="mutedSuffix"
|
|
69
|
+
className="h-7 w-auto max-w-[min(100%,260px)] object-left object-contain"
|
|
70
|
+
/>
|
|
71
|
+
</span>
|
|
72
|
+
<i
|
|
73
|
+
className="fa-light fa-chevron-down ms-auto mt-1 inline-flex size-6 shrink-0 items-center justify-center text-xs text-muted-foreground"
|
|
74
|
+
aria-hidden="true"
|
|
75
|
+
/>
|
|
76
|
+
</>
|
|
77
|
+
)}
|
|
78
|
+
</SidebarMenuButton>
|
|
79
|
+
</DropdownMenuTrigger>
|
|
80
|
+
|
|
81
|
+
<DropdownMenuContent
|
|
82
|
+
className="w-56"
|
|
83
|
+
align="start"
|
|
84
|
+
side="bottom"
|
|
85
|
+
sideOffset={4}
|
|
86
|
+
>
|
|
87
|
+
<DropdownMenuLabel className="text-xs text-muted-foreground">
|
|
88
|
+
Switch product
|
|
89
|
+
</DropdownMenuLabel>
|
|
90
|
+
<DropdownMenuSeparator />
|
|
91
|
+
{PRODUCTS.map(p => (
|
|
92
|
+
<DropdownMenuItem
|
|
93
|
+
key={p.id}
|
|
94
|
+
onClick={() => setProduct(p.id)}
|
|
95
|
+
className="gap-2 py-2"
|
|
96
|
+
aria-current={p.id === product ? "true" : undefined}
|
|
97
|
+
>
|
|
98
|
+
<ExxatProductLogo
|
|
99
|
+
product={p.id}
|
|
100
|
+
variant="mutedSuffix"
|
|
101
|
+
className="h-7 w-auto shrink-0 max-w-[min(100%,200px)]"
|
|
102
|
+
/>
|
|
103
|
+
{p.id === product && (
|
|
104
|
+
<i
|
|
105
|
+
className="fa-solid fa-check ml-auto text-brand text-xs"
|
|
106
|
+
aria-hidden="true"
|
|
107
|
+
/>
|
|
108
|
+
)}
|
|
109
|
+
</DropdownMenuItem>
|
|
110
|
+
))}
|
|
111
|
+
</DropdownMenuContent>
|
|
112
|
+
</DropdownMenu>
|
|
113
|
+
</SidebarMenuItem>
|
|
114
|
+
</SidebarMenu>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { initialsFromDisplayName } from "@/lib/initials-from-name"
|
|
5
|
+
import type {
|
|
6
|
+
QuestionBankDifficulty,
|
|
7
|
+
QuestionBankItem,
|
|
8
|
+
QuestionBankType,
|
|
9
|
+
} from "@/lib/mock/question-bank"
|
|
10
|
+
import {
|
|
11
|
+
LIST_HUB_STATUS_TINT_DANGER,
|
|
12
|
+
LIST_HUB_STATUS_TINT_INFO,
|
|
13
|
+
LIST_HUB_STATUS_TINT_NEUTRAL,
|
|
14
|
+
LIST_HUB_STATUS_TINT_SUCCESS,
|
|
15
|
+
LIST_HUB_STATUS_TINT_WARNING,
|
|
16
|
+
QUESTION_BANK_STATUS_BADGE_CLASS,
|
|
17
|
+
QUESTION_BANK_STATUS_ICON,
|
|
18
|
+
QUESTION_BANK_STATUS_LABEL,
|
|
19
|
+
} from "@/lib/list-status-badges"
|
|
20
|
+
import { BoardCardTwoLineBlock } from "@/components/data-views/board-card-primitives"
|
|
21
|
+
import {
|
|
22
|
+
ListPageBoardCard,
|
|
23
|
+
ListPageBoardCardAvatar,
|
|
24
|
+
ListPageBoardCardBadgeRow,
|
|
25
|
+
ListPageBoardCardBody,
|
|
26
|
+
ListPageBoardCardHeader,
|
|
27
|
+
ListPageBoardCardTitleRow,
|
|
28
|
+
} from "@/components/data-views/list-page-board-card"
|
|
29
|
+
import { ListHubStatusBadge } from "@/components/list-hub-status-badge"
|
|
30
|
+
import {
|
|
31
|
+
ListPageBoardTemplate,
|
|
32
|
+
type ListPageBoardColumnDef,
|
|
33
|
+
} from "@/components/data-views/list-page-board-template"
|
|
34
|
+
|
|
35
|
+
const NEUTRAL_COUNT_BADGE = "bg-muted/90 text-foreground"
|
|
36
|
+
|
|
37
|
+
const TYPE_LABEL: Record<QuestionBankType, string> = {
|
|
38
|
+
multiple_choice: "Multiple choice",
|
|
39
|
+
true_false: "True / false",
|
|
40
|
+
short_answer: "Short answer",
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const DIFF_LABEL: Record<QuestionBankDifficulty, string> = {
|
|
44
|
+
easy: "Easy",
|
|
45
|
+
medium: "Medium",
|
|
46
|
+
hard: "Hard",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const DIFF_BADGE: Record<QuestionBankDifficulty, string> = {
|
|
50
|
+
easy: LIST_HUB_STATUS_TINT_SUCCESS,
|
|
51
|
+
medium: LIST_HUB_STATUS_TINT_WARNING,
|
|
52
|
+
hard: LIST_HUB_STATUS_TINT_DANGER,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const TYPE_BADGE: Record<QuestionBankType, string> = {
|
|
56
|
+
multiple_choice: LIST_HUB_STATUS_TINT_NEUTRAL,
|
|
57
|
+
true_false: LIST_HUB_STATUS_TINT_INFO,
|
|
58
|
+
short_answer: LIST_HUB_STATUS_TINT_WARNING,
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const STATUS_BOARD_COLUMNS: ListPageBoardColumnDef<QuestionBankItem>[] = [
|
|
62
|
+
{
|
|
63
|
+
id: "published",
|
|
64
|
+
label: "Published",
|
|
65
|
+
description: "Live in bank",
|
|
66
|
+
filter: r => r.status === "published",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "draft",
|
|
70
|
+
label: "Draft",
|
|
71
|
+
description: "Work in progress",
|
|
72
|
+
filter: r => r.status === "draft",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "in_review",
|
|
76
|
+
label: "In review",
|
|
77
|
+
description: "Awaiting approval",
|
|
78
|
+
filter: r => r.status === "in_review",
|
|
79
|
+
},
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
const DIFF_ORDER: QuestionBankDifficulty[] = ["easy", "medium", "hard"]
|
|
83
|
+
const TYPE_ORDER: QuestionBankType[] = ["multiple_choice", "true_false", "short_answer"]
|
|
84
|
+
|
|
85
|
+
function topicBoardColumns(rows: QuestionBankItem[]): {
|
|
86
|
+
columns: ListPageBoardColumnDef<QuestionBankItem>[]
|
|
87
|
+
badgeMap: Record<string, string>
|
|
88
|
+
} {
|
|
89
|
+
const topics = [...new Set(rows.map(r => r.topic))].sort((a, b) => a.localeCompare(b))
|
|
90
|
+
const columns: ListPageBoardColumnDef<QuestionBankItem>[] = topics.map(topic => ({
|
|
91
|
+
id: `topic:${topic}`,
|
|
92
|
+
label: topic,
|
|
93
|
+
filter: (r: QuestionBankItem) => r.topic === topic,
|
|
94
|
+
}))
|
|
95
|
+
const badgeMap = Object.fromEntries(topics.map(t => [`topic:${t}`, NEUTRAL_COUNT_BADGE]))
|
|
96
|
+
return { columns, badgeMap }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function difficultyBoardColumns(): {
|
|
100
|
+
columns: ListPageBoardColumnDef<QuestionBankItem>[]
|
|
101
|
+
badgeMap: Record<string, string>
|
|
102
|
+
} {
|
|
103
|
+
const columns: ListPageBoardColumnDef<QuestionBankItem>[] = DIFF_ORDER.map(d => ({
|
|
104
|
+
id: d,
|
|
105
|
+
label: DIFF_LABEL[d],
|
|
106
|
+
filter: (r: QuestionBankItem) => r.difficulty === d,
|
|
107
|
+
}))
|
|
108
|
+
const badgeMap = Object.fromEntries(DIFF_ORDER.map(d => [d, DIFF_BADGE[d]]))
|
|
109
|
+
return { columns, badgeMap }
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function typeBoardColumns(): {
|
|
113
|
+
columns: ListPageBoardColumnDef<QuestionBankItem>[]
|
|
114
|
+
badgeMap: Record<string, string>
|
|
115
|
+
} {
|
|
116
|
+
const columns: ListPageBoardColumnDef<QuestionBankItem>[] = TYPE_ORDER.map(t => ({
|
|
117
|
+
id: t,
|
|
118
|
+
label: TYPE_LABEL[t],
|
|
119
|
+
filter: (r: QuestionBankItem) => r.type === t,
|
|
120
|
+
}))
|
|
121
|
+
const badgeMap = Object.fromEntries(TYPE_ORDER.map(t => [t, TYPE_BADGE[t]]))
|
|
122
|
+
return { columns, badgeMap }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function useQuestionBankBoardModel(rows: QuestionBankItem[], groupByColumnKey: string) {
|
|
126
|
+
return React.useMemo(() => {
|
|
127
|
+
if (groupByColumnKey === "topic") {
|
|
128
|
+
const { columns, badgeMap } = topicBoardColumns(rows)
|
|
129
|
+
return { columns, badgeMap }
|
|
130
|
+
}
|
|
131
|
+
if (groupByColumnKey === "difficulty") {
|
|
132
|
+
const { columns, badgeMap } = difficultyBoardColumns()
|
|
133
|
+
return { columns, badgeMap }
|
|
134
|
+
}
|
|
135
|
+
if (groupByColumnKey === "type") {
|
|
136
|
+
const { columns, badgeMap } = typeBoardColumns()
|
|
137
|
+
return { columns, badgeMap }
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
columns: STATUS_BOARD_COLUMNS,
|
|
141
|
+
badgeMap: QUESTION_BANK_STATUS_BADGE_CLASS as Record<string, string>,
|
|
142
|
+
}
|
|
143
|
+
}, [rows, groupByColumnKey])
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function QuestionBankBoardCard({ row }: { row: QuestionBankItem }) {
|
|
147
|
+
const initials = initialsFromDisplayName(row.author)
|
|
148
|
+
return (
|
|
149
|
+
<ListPageBoardCard className="w-full">
|
|
150
|
+
<ListPageBoardCardHeader>
|
|
151
|
+
<ListPageBoardCardTitleRow
|
|
152
|
+
title={row.stem}
|
|
153
|
+
titleClassName="line-clamp-2"
|
|
154
|
+
trailing={<ListPageBoardCardAvatar initials={initials} />}
|
|
155
|
+
/>
|
|
156
|
+
<ListPageBoardCardBadgeRow>
|
|
157
|
+
<ListHubStatusBadge
|
|
158
|
+
surface="board"
|
|
159
|
+
label={QUESTION_BANK_STATUS_LABEL[row.status]}
|
|
160
|
+
tintClassName={QUESTION_BANK_STATUS_BADGE_CLASS[row.status]}
|
|
161
|
+
icon={QUESTION_BANK_STATUS_ICON[row.status]}
|
|
162
|
+
/>
|
|
163
|
+
</ListPageBoardCardBadgeRow>
|
|
164
|
+
<ListPageBoardCardBody>
|
|
165
|
+
<BoardCardTwoLineBlock
|
|
166
|
+
iconClass="fa-tag"
|
|
167
|
+
line1={row.topic}
|
|
168
|
+
line2={row.type.replace(/_/g, " ")}
|
|
169
|
+
/>
|
|
170
|
+
<BoardCardTwoLineBlock iconClass="fa-calendar-days" line1={row.updatedAt} line2="Updated" />
|
|
171
|
+
</ListPageBoardCardBody>
|
|
172
|
+
</ListPageBoardCardHeader>
|
|
173
|
+
</ListPageBoardCard>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export const QUESTION_BANK_BOARD_GROUP_OPTIONS = [
|
|
178
|
+
{ key: "status", label: "Status" },
|
|
179
|
+
{ key: "topic", label: "Topic" },
|
|
180
|
+
{ key: "difficulty", label: "Difficulty" },
|
|
181
|
+
{ key: "type", label: "Type" },
|
|
182
|
+
] as const
|
|
183
|
+
|
|
184
|
+
export function QuestionBankBoardView({
|
|
185
|
+
rows,
|
|
186
|
+
groupByColumnKey,
|
|
187
|
+
}: {
|
|
188
|
+
rows: QuestionBankItem[]
|
|
189
|
+
groupByColumnKey: string
|
|
190
|
+
}) {
|
|
191
|
+
const allowed = QUESTION_BANK_BOARD_GROUP_OPTIONS.some(o => o.key === groupByColumnKey)
|
|
192
|
+
const key = allowed ? groupByColumnKey : "status"
|
|
193
|
+
const { columns, badgeMap } = useQuestionBankBoardModel(rows, key)
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<ListPageBoardTemplate
|
|
197
|
+
columns={columns}
|
|
198
|
+
rows={rows}
|
|
199
|
+
getRowKey={r => r.id}
|
|
200
|
+
columnCountBadgeClassName={badgeMap}
|
|
201
|
+
emptyColumnLabel="No questions"
|
|
202
|
+
renderCard={row => <QuestionBankBoardCard row={row} />}
|
|
203
|
+
/>
|
|
204
|
+
)
|
|
205
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Question bank hub — ListPageTemplate + KeyMetrics + QuestionBankTable (Team / Compliance pattern).
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as React from "react"
|
|
8
|
+
import {
|
|
9
|
+
ListPageTemplate,
|
|
10
|
+
type ViewTab,
|
|
11
|
+
dataListViewIcon,
|
|
12
|
+
type DataListViewType,
|
|
13
|
+
} from "@/components/data-views"
|
|
14
|
+
import { QuestionBankPageHeader } from "@/components/question-bank-page-header"
|
|
15
|
+
import { QuestionBankTable, type QuestionBankTableHandle } from "@/components/question-bank-table"
|
|
16
|
+
import { KeyMetrics } from "@/components/key-metrics"
|
|
17
|
+
import { QUESTION_BANK_ITEMS } from "@/lib/mock/question-bank"
|
|
18
|
+
import { questionBankKpiInsight, questionBankKpiMetrics } from "@/lib/mock/question-bank-kpi"
|
|
19
|
+
|
|
20
|
+
const DEFAULT_TABS: ViewTab[] = [
|
|
21
|
+
{
|
|
22
|
+
id: "questions",
|
|
23
|
+
label: "Questions",
|
|
24
|
+
viewType: "table",
|
|
25
|
+
icon: "fa-table",
|
|
26
|
+
filterId: "all",
|
|
27
|
+
},
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
export function QuestionBankClient() {
|
|
31
|
+
const [exportOpen, setExportOpen] = React.useState(false)
|
|
32
|
+
const [showMetrics, setShowMetrics] = React.useState(true)
|
|
33
|
+
const tableRef = React.useRef<QuestionBankTableHandle>(null)
|
|
34
|
+
const count = QUESTION_BANK_ITEMS.length
|
|
35
|
+
|
|
36
|
+
const metrics = React.useMemo(() => questionBankKpiMetrics(QUESTION_BANK_ITEMS), [])
|
|
37
|
+
const insight = React.useMemo(() => questionBankKpiInsight(QUESTION_BANK_ITEMS), [])
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<ListPageTemplate
|
|
41
|
+
defaultTabs={DEFAULT_TABS}
|
|
42
|
+
getTabCount={() => count}
|
|
43
|
+
tablePropertiesRef={tableRef}
|
|
44
|
+
header={(
|
|
45
|
+
<QuestionBankPageHeader
|
|
46
|
+
questionCount={count}
|
|
47
|
+
onNewQuestion={() => {}}
|
|
48
|
+
onExport={() => setExportOpen(true)}
|
|
49
|
+
showMetrics={showMetrics}
|
|
50
|
+
onToggleMetrics={() => setShowMetrics(v => !v)}
|
|
51
|
+
/>
|
|
52
|
+
)}
|
|
53
|
+
metrics={(
|
|
54
|
+
<KeyMetrics
|
|
55
|
+
variant="flat"
|
|
56
|
+
metrics={metrics}
|
|
57
|
+
insight={insight}
|
|
58
|
+
showHeader={false}
|
|
59
|
+
metricsSingleRow
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
showMetrics={showMetrics}
|
|
63
|
+
exportOpen={exportOpen}
|
|
64
|
+
onExportOpenChange={setExportOpen}
|
|
65
|
+
exportTotalRows={count}
|
|
66
|
+
renderContent={(tab, updateTab) => (
|
|
67
|
+
<QuestionBankTable
|
|
68
|
+
key={tab.id}
|
|
69
|
+
ref={tableRef}
|
|
70
|
+
items={QUESTION_BANK_ITEMS}
|
|
71
|
+
view={tab.viewType}
|
|
72
|
+
onViewChange={(v: DataListViewType) => updateTab({ viewType: v, icon: dataListViewIcon(v) })}
|
|
73
|
+
/>
|
|
74
|
+
)}
|
|
75
|
+
/>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import type { QuestionBankItem } from "@/lib/mock/question-bank"
|
|
5
|
+
import { ListHubStatusBadge } from "@/components/list-hub-status-badge"
|
|
6
|
+
import { ListPageBoardCard } from "@/components/data-views/list-page-board-card"
|
|
7
|
+
import {
|
|
8
|
+
QUESTION_BANK_STATUS_BADGE_CLASS,
|
|
9
|
+
QUESTION_BANK_STATUS_ICON,
|
|
10
|
+
QUESTION_BANK_STATUS_LABEL,
|
|
11
|
+
} from "@/lib/list-status-badges"
|
|
12
|
+
|
|
13
|
+
function QuestionBankListRow({ row }: { row: QuestionBankItem }) {
|
|
14
|
+
return (
|
|
15
|
+
<li>
|
|
16
|
+
<ListPageBoardCard
|
|
17
|
+
layout="row"
|
|
18
|
+
rowContainerClassName="flex w-full flex-col gap-1 sm:flex-row sm:items-center sm:gap-4"
|
|
19
|
+
rowEnd={
|
|
20
|
+
<div className="flex shrink-0 items-center gap-2">
|
|
21
|
+
<ListHubStatusBadge
|
|
22
|
+
surface="board"
|
|
23
|
+
label={QUESTION_BANK_STATUS_LABEL[row.status]}
|
|
24
|
+
tintClassName={QUESTION_BANK_STATUS_BADGE_CLASS[row.status]}
|
|
25
|
+
icon={QUESTION_BANK_STATUS_ICON[row.status]}
|
|
26
|
+
/>
|
|
27
|
+
<i className="fa-light fa-chevron-right text-xs text-muted-foreground" aria-hidden="true" />
|
|
28
|
+
</div>
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
<div className="space-y-0.5">
|
|
32
|
+
<p className="line-clamp-2 text-sm font-semibold text-foreground">{row.stem}</p>
|
|
33
|
+
<p className="text-xs text-muted-foreground">
|
|
34
|
+
{row.topic} · Updated {row.updatedAt}
|
|
35
|
+
</p>
|
|
36
|
+
<p className="text-xs text-muted-foreground">{row.author}</p>
|
|
37
|
+
</div>
|
|
38
|
+
</ListPageBoardCard>
|
|
39
|
+
</li>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function QuestionBankListView({ rows }: { rows: QuestionBankItem[] }) {
|
|
44
|
+
if (rows.length === 0) {
|
|
45
|
+
return (
|
|
46
|
+
<div className="px-4 py-16 text-center lg:px-6">
|
|
47
|
+
<p className="text-sm text-muted-foreground">No questions match your filters.</p>
|
|
48
|
+
</div>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<ul className="flex list-none flex-col gap-2 px-4 pb-8 pt-2 lg:px-6">
|
|
54
|
+
{rows.map(row => (
|
|
55
|
+
<QuestionBankListRow key={row.id} row={row} />
|
|
56
|
+
))}
|
|
57
|
+
</ul>
|
|
58
|
+
)
|
|
59
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { Button } from "@/components/ui/button"
|
|
5
|
+
import { PageHeader } from "@/components/page-header"
|
|
6
|
+
import {
|
|
7
|
+
DropdownMenu,
|
|
8
|
+
DropdownMenuContent,
|
|
9
|
+
DropdownMenuItem,
|
|
10
|
+
DropdownMenuSeparator,
|
|
11
|
+
DropdownMenuTrigger,
|
|
12
|
+
} from "@/components/ui/dropdown-menu"
|
|
13
|
+
import { Tip } from "@/components/ui/tip"
|
|
14
|
+
|
|
15
|
+
export interface QuestionBankPageHeaderProps {
|
|
16
|
+
questionCount: number
|
|
17
|
+
onNewQuestion: () => void
|
|
18
|
+
onExport: () => void
|
|
19
|
+
showMetrics: boolean
|
|
20
|
+
onToggleMetrics: () => void
|
|
21
|
+
showTitleBlock?: boolean
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function QuestionBankPageHeader({
|
|
25
|
+
questionCount,
|
|
26
|
+
onNewQuestion,
|
|
27
|
+
onExport,
|
|
28
|
+
showMetrics,
|
|
29
|
+
onToggleMetrics,
|
|
30
|
+
showTitleBlock = true,
|
|
31
|
+
}: QuestionBankPageHeaderProps) {
|
|
32
|
+
const [moreOpen, setMoreOpen] = React.useState(false)
|
|
33
|
+
const countLine = `${questionCount} ${questionCount === 1 ? "question" : "questions"} · Last updated now`
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<PageHeader
|
|
37
|
+
title="Question bank"
|
|
38
|
+
subtitle={countLine}
|
|
39
|
+
showTitleBlock={showTitleBlock}
|
|
40
|
+
actions={(
|
|
41
|
+
<div className="flex items-center gap-2" role="group" aria-label="Question bank actions">
|
|
42
|
+
<Tip side="bottom" label="Create a new question (demo)">
|
|
43
|
+
<Button type="button" size="lg" onClick={onNewQuestion}>
|
|
44
|
+
<i className="fa-light fa-plus" aria-hidden="true" />
|
|
45
|
+
New question
|
|
46
|
+
</Button>
|
|
47
|
+
</Tip>
|
|
48
|
+
<DropdownMenu open={moreOpen} onOpenChange={setMoreOpen}>
|
|
49
|
+
<Tip side="bottom" label="More actions">
|
|
50
|
+
<DropdownMenuTrigger asChild>
|
|
51
|
+
<Button
|
|
52
|
+
type="button"
|
|
53
|
+
size="lg"
|
|
54
|
+
variant="outline"
|
|
55
|
+
className="aspect-square px-0"
|
|
56
|
+
aria-label="More actions"
|
|
57
|
+
>
|
|
58
|
+
<i className="fa-light fa-ellipsis text-base" aria-hidden="true" />
|
|
59
|
+
</Button>
|
|
60
|
+
</DropdownMenuTrigger>
|
|
61
|
+
</Tip>
|
|
62
|
+
<DropdownMenuContent align="end" className="w-52">
|
|
63
|
+
<DropdownMenuItem
|
|
64
|
+
onSelect={() => {
|
|
65
|
+
window.setTimeout(() => onExport(), 0)
|
|
66
|
+
}}
|
|
67
|
+
>
|
|
68
|
+
<i className="fa-light fa-arrow-down-to-line" aria-hidden="true" />
|
|
69
|
+
Export
|
|
70
|
+
</DropdownMenuItem>
|
|
71
|
+
<DropdownMenuSeparator />
|
|
72
|
+
<DropdownMenuItem
|
|
73
|
+
onSelect={() => {
|
|
74
|
+
window.setTimeout(() => onToggleMetrics(), 0)
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<i
|
|
78
|
+
className={`fa-light ${showMetrics ? "fa-eye-slash" : "fa-eye"}`}
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
/>
|
|
81
|
+
{showMetrics ? "Hide metric section" : "Show metric section"}
|
|
82
|
+
</DropdownMenuItem>
|
|
83
|
+
</DropdownMenuContent>
|
|
84
|
+
</DropdownMenu>
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
/>
|
|
88
|
+
)
|
|
89
|
+
}
|