Render missing-value unassigned labels in italic.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
ab8d487016
commit
e1d262cdf5
|
|
@ -3,6 +3,7 @@ import { Plus, Trash2 } from "lucide-react"
|
|||
import { Button } from "../ui/button"
|
||||
import { Input } from "../ui/input"
|
||||
import { cn } from "../../lib/utils"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import {
|
||||
createEmptyTable,
|
||||
parseTableSlotValue,
|
||||
|
|
@ -236,7 +237,7 @@ export function DynamicTableBuilder({
|
|||
key={`preview-c-${ri}-${ci}`}
|
||||
className="border border-grayScale-100 px-3 py-2 text-sm"
|
||||
>
|
||||
{cell || <span className="text-grayScale-300">unassigned</span>}
|
||||
{cell || <span className="text-grayScale-300"><UnassignedLabel /></span>}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import {
|
|||
type Notification,
|
||||
} from "../../types/notification.types";
|
||||
import { cn } from "../../lib/utils";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type NotificationDetailDialogProps = {
|
||||
open: boolean;
|
||||
|
|
@ -187,9 +188,9 @@ function DetailsTab({
|
|||
<div className="space-y-0 divide-y divide-grayScale-100">
|
||||
{[
|
||||
{ k: "Type", v: formatNotificationTypeLabel(notification.type) },
|
||||
{ k: "Channel", v: notification.delivery_channel || "unassigned" },
|
||||
{ k: "Channel", v: notification.delivery_channel || <UnassignedLabel /> },
|
||||
{ k: "Status", v: notification.is_read ? "Read" : "Unread" },
|
||||
{ k: "Delivery", v: notification.delivery_status || "unassigned" },
|
||||
{ k: "Delivery", v: notification.delivery_status || <UnassignedLabel /> },
|
||||
...(notification.receiver_type
|
||||
? [{ k: "Receiver", v: notification.receiver_type }]
|
||||
: []),
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
export const UNASSIGNED_LABEL = "unassigned"
|
||||
|
||||
/** @deprecated Prefer UNASSIGNED_LABEL */
|
||||
export const NOT_ASSIGNED_LABEL = UNASSIGNED_LABEL
|
||||
|
||||
const LEGACY_EMPTY_LABELS = new Set(["—", "-", "Not assigned", "not assigned"])
|
||||
|
||||
export function displayValue(value: string | null | undefined): string {
|
||||
const trimmed = value?.trim()
|
||||
if (!trimmed || LEGACY_EMPTY_LABELS.has(trimmed) || trimmed === UNASSIGNED_LABEL) {
|
||||
return UNASSIGNED_LABEL
|
||||
}
|
||||
return trimmed
|
||||
}
|
||||
|
||||
export function isUnassignedLabel(value: string | null | undefined): boolean {
|
||||
const trimmed = value?.trim()
|
||||
return !trimmed || trimmed === UNASSIGNED_LABEL || LEGACY_EMPTY_LABELS.has(trimmed)
|
||||
}
|
||||
50
src/lib/displayValue.tsx
Normal file
50
src/lib/displayValue.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import type { ReactNode } from "react"
|
||||
import { cn } from "./utils"
|
||||
|
||||
export const UNASSIGNED_LABEL = "unassigned"
|
||||
|
||||
/** @deprecated Prefer UNASSIGNED_LABEL */
|
||||
export const NOT_ASSIGNED_LABEL = UNASSIGNED_LABEL
|
||||
|
||||
const LEGACY_EMPTY_LABELS = new Set(["—", "-", "Not assigned", "not assigned"])
|
||||
|
||||
export function isUnassignedLabel(value: string | null | undefined): boolean {
|
||||
const trimmed = value?.trim()
|
||||
return !trimmed || trimmed === UNASSIGNED_LABEL || LEGACY_EMPTY_LABELS.has(trimmed)
|
||||
}
|
||||
|
||||
export function displayValue(value: string | null | undefined): string {
|
||||
const trimmed = value?.trim()
|
||||
if (!trimmed || LEGACY_EMPTY_LABELS.has(trimmed) || trimmed === UNASSIGNED_LABEL) {
|
||||
return UNASSIGNED_LABEL
|
||||
}
|
||||
return trimmed
|
||||
}
|
||||
|
||||
export function UnassignedLabel({ className }: { className?: string }) {
|
||||
return (
|
||||
<span className={cn("italic text-grayScale-400", className)}>{UNASSIGNED_LABEL}</span>
|
||||
)
|
||||
}
|
||||
|
||||
/** Renders a value, or an italic "unassigned" label when empty/missing. */
|
||||
export function DisplayValue({
|
||||
value,
|
||||
className,
|
||||
unassignedClassName,
|
||||
}: {
|
||||
value: string | number | null | undefined
|
||||
className?: string
|
||||
unassignedClassName?: string
|
||||
}): ReactNode {
|
||||
if (typeof value === "number") {
|
||||
if (!Number.isFinite(value)) {
|
||||
return <UnassignedLabel className={unassignedClassName} />
|
||||
}
|
||||
return <span className={className}>{value}</span>
|
||||
}
|
||||
if (isUnassignedLabel(value)) {
|
||||
return <UnassignedLabel className={unassignedClassName} />
|
||||
}
|
||||
return <span className={className}>{value!.trim()}</span>
|
||||
}
|
||||
|
|
@ -24,6 +24,7 @@ import { cn } from "../lib/utils";
|
|||
import type { TeamMeProfile } from "../types/team.types";
|
||||
import { ProfileAvatarUpload } from "../components/profile/ProfileAvatarUpload";
|
||||
import { PersonaProfilePictureUploadField } from "./personas/components/PersonaProfilePictureUploadField";
|
||||
import { UnassignedLabel, isUnassignedLabel, DisplayValue } from "../lib/displayValue"
|
||||
|
||||
function formatDate(dateStr: string | null | undefined): string {
|
||||
if (!dateStr) return "unassigned";
|
||||
|
|
@ -69,7 +70,7 @@ function FieldGroup({
|
|||
mono,
|
||||
}: {
|
||||
label: string;
|
||||
value: string;
|
||||
value: React.ReactNode;
|
||||
mono?: boolean;
|
||||
}) {
|
||||
return (
|
||||
|
|
@ -81,7 +82,11 @@ function FieldGroup({
|
|||
mono && "font-mono text-xs",
|
||||
)}
|
||||
>
|
||||
{value}
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? (
|
||||
<UnassignedLabel />
|
||||
) : (
|
||||
value
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -329,7 +334,7 @@ export function ProfilePage() {
|
|||
<FieldGroup label="Email address" value={profile.email} />
|
||||
<FieldGroup label="Phone" value={profile.phone_number} />
|
||||
<div className="sm:col-span-2">
|
||||
<FieldGroup label="Bio" value={displayValue(profile.bio)} />
|
||||
<FieldGroup label="Bio" value={<DisplayValue value={profile.bio} />} />
|
||||
</div>
|
||||
</div>
|
||||
</SectionCard>
|
||||
|
|
@ -339,15 +344,15 @@ export function ProfilePage() {
|
|||
<div className="grid gap-x-8 gap-y-5 sm:grid-cols-2">
|
||||
<FieldGroup
|
||||
label="Department"
|
||||
value={displayValue(profile.department)}
|
||||
value={<DisplayValue value={profile.department} />}
|
||||
/>
|
||||
<FieldGroup
|
||||
label="Job Title"
|
||||
value={displayValue(profile.job_title)}
|
||||
value={<DisplayValue value={profile.job_title} />}
|
||||
/>
|
||||
<FieldGroup
|
||||
label="Work Phone"
|
||||
value={displayValue(profile.work_phone)}
|
||||
value={<DisplayValue value={profile.work_phone} />}
|
||||
/>
|
||||
<FieldGroup label="Member ID" value={String(profile.id)} mono />
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { Card } from "../../components/ui/card"
|
|||
import { Input } from "../../components/ui/input"
|
||||
import { SpinnerIcon } from "../../components/ui/spinner-icon"
|
||||
import type { QuestionOption } from "../../types/course.types"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type Step = 1 | 2 | 3 | 4
|
||||
type QuestionType = "MCQ" | "TRUE_FALSE" | "SHORT" | "AUDIO" | "DYNAMIC"
|
||||
|
|
@ -606,16 +607,16 @@ export function AddNewLessonPage() {
|
|||
<div className="flex items-center justify-between px-4 py-3 text-sm">
|
||||
<span className="text-grayScale-500">Description</span>
|
||||
<span className="max-w-[55%] truncate text-right font-medium text-grayScale-800">
|
||||
{lessonDescription || "unassigned"}
|
||||
{lessonDescription || <UnassignedLabel />}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between px-4 py-3 text-sm">
|
||||
<span className="text-grayScale-500">Intro video URL</span>
|
||||
<span className="max-w-[55%] truncate text-right font-medium text-grayScale-800">{introVideoUrl || "unassigned"}</span>
|
||||
<span className="max-w-[55%] truncate text-right font-medium text-grayScale-800">{introVideoUrl || <UnassignedLabel />}</span>
|
||||
</div>
|
||||
<div className="flex items-center justify-between px-4 py-3 text-sm">
|
||||
<span className="text-grayScale-500">Sub-module</span>
|
||||
<span className="font-medium text-grayScale-800">{subModuleId ?? "unassigned"}</span>
|
||||
<span className="font-medium text-grayScale-800">{subModuleId ?? <UnassignedLabel />}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ import { AddModuleModal } from "./components/AddModuleModal";
|
|||
import { ModuleIconUploadField } from "./components/ModuleIconUploadField";
|
||||
import { ModulePracticeCard } from "./components/ModulePracticeCard";
|
||||
import { PublishPracticeButton } from "./components/PublishPracticeButton";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
const MODULE_CARD_GRADIENT = "from-[#8E44AD] to-[#C39BD3]" as const;
|
||||
|
||||
|
|
@ -787,7 +788,7 @@ export function CourseDetailPage() {
|
|||
<p className="text-[12px] font-medium leading-snug text-grayScale-400 line-clamp-3">
|
||||
{module.description?.trim()
|
||||
? module.description
|
||||
: "unassigned"}
|
||||
: <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import { ContentAccessTierChip } from "./components/ContentAccessTierChip";
|
|||
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
|
||||
import { ContentPageDescription } from "./components/ContentPageDescription";
|
||||
import type { ContentAccessTier, PracticePublishStatus } from "../../types/course.types";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import {
|
||||
filterBySearchAndPublishStatus,
|
||||
type PublishStatusFilter,
|
||||
|
|
@ -166,7 +167,7 @@ export function CourseManagementPage() {
|
|||
list.map((row, index) => ({
|
||||
id: Number(row.id),
|
||||
name: row.name?.trim() || `Unit ${row.id}`,
|
||||
description: row.description?.trim() || "unassigned",
|
||||
description: row.description?.trim() || <UnassignedLabel />,
|
||||
thumbnail: row.thumbnail?.trim() || "",
|
||||
sortOrder: Number(row.sort_order ?? 0),
|
||||
publishStatus: row.publish_status ?? null,
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import type {
|
|||
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
|
||||
import { ContentPageDescription } from "./components/ContentPageDescription";
|
||||
import { ContentPublishStatusChip } from "./components/ContentPublishStatusChip";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import {
|
||||
filterBySearchAndPublishStatus,
|
||||
type PublishStatusFilter,
|
||||
|
|
@ -173,7 +174,7 @@ export function CourseModuleDetailPage() {
|
|||
const row = list.find((m) => Number(m.id) === parsedModuleId);
|
||||
if (row) {
|
||||
setModuleTitle(row.name?.trim() || `Module ${parsedModuleId}`);
|
||||
setModuleDescription(row.description?.trim() || "unassigned");
|
||||
setModuleDescription(row.description?.trim() || <UnassignedLabel />);
|
||||
setModulePublishStatus(row.publish_status ?? null);
|
||||
} else {
|
||||
setModuleTitle(`Module ${parsedModuleId}`);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import {
|
|||
import type { CategorySubCategoryListItem, CourseCategory } from "../../types/course.types"
|
||||
import { cn } from "../../lib/utils"
|
||||
import { TABLE_PAGE_SIZE_OPTIONS } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
export function CoursesPage() {
|
||||
const { categoryId } = useParams<{ categoryId: string }>()
|
||||
|
|
@ -415,7 +416,7 @@ export function CoursesPage() {
|
|||
</TableCell>
|
||||
<TableCell>
|
||||
<p className="max-w-md truncate text-sm text-grayScale-600" title={sub.description || undefined}>
|
||||
{sub.description?.trim() ? sub.description : "unassigned"}
|
||||
{sub.description?.trim() ? sub.description : <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="hidden xl:table-cell tabular-nums text-sm text-grayScale-600">
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import {
|
|||
softDeleteSubModuleLesson,
|
||||
updateSubModuleLesson,
|
||||
} from "../../api/courses.api"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import type {
|
||||
QuestionSet,
|
||||
QuestionSetStatus,
|
||||
|
|
@ -526,12 +527,12 @@ export function HumanLanguageSubModulePage() {
|
|||
<TableCell>{questionSetStatusBadge(item.status)}</TableCell>
|
||||
<TableCell>
|
||||
<p className="max-w-[280px] truncate text-sm text-grayScale-600">
|
||||
{item.description?.trim() ? item.description : "unassigned"}
|
||||
{item.description?.trim() ? item.description : <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="hidden lg:table-cell">
|
||||
<p className="max-w-[140px] truncate text-sm text-grayScale-600">
|
||||
{item.persona?.trim() ? item.persona : "unassigned"}
|
||||
{item.persona?.trim() ? item.persona : <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="hidden md:table-cell">
|
||||
|
|
@ -673,7 +674,7 @@ export function HumanLanguageSubModulePage() {
|
|||
<TableCell>{lessonStatusBadge(lesson.is_active)}</TableCell>
|
||||
<TableCell>
|
||||
<p className="max-w-[280px] truncate text-sm text-grayScale-600">
|
||||
{lesson.description?.trim() ? lesson.description : "unassigned"}
|
||||
{lesson.description?.trim() ? lesson.description : <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="hidden lg:table-cell">
|
||||
|
|
@ -985,7 +986,7 @@ export function HumanLanguageSubModulePage() {
|
|||
</TableCell>
|
||||
<TableCell>
|
||||
<p className="max-w-[280px] truncate text-sm text-grayScale-600">
|
||||
{v.description?.trim() ? v.description : "unassigned"}
|
||||
{v.description?.trim() ? v.description : <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="hidden sm:table-cell">
|
||||
|
|
@ -1031,7 +1032,7 @@ export function HumanLanguageSubModulePage() {
|
|||
</a>
|
||||
</Button>
|
||||
) : (
|
||||
<span className="text-sm text-grayScale-400">unassigned</span>
|
||||
<span className="text-sm text-grayScale-400"><UnassignedLabel /></span>
|
||||
)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import { Textarea } from "../../components/ui/textarea"
|
|||
import { ToggleSwitch } from "../../components/ui/toggle-switch"
|
||||
import { cn } from "../../lib/utils"
|
||||
import type { QuestionSetDetail } from "../../types/course.types"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type TabId = "set" | "questions" | "thresholds"
|
||||
type DraftQuestionType = "MCQ" | "TRUE_FALSE"
|
||||
|
|
@ -817,13 +818,15 @@ export function InitialAssessmentPage() {
|
|||
>
|
||||
{(() => {
|
||||
const value = String(q.difficultyLevel ?? "").trim()
|
||||
if (!value || value === "unassigned" || value === "-") return "unassigned"
|
||||
if (!value || value === "unassigned" || value === "-") {
|
||||
return <UnassignedLabel />
|
||||
}
|
||||
return value.toLowerCase()
|
||||
})()}
|
||||
</span>
|
||||
</TableCell>
|
||||
<TableCell className="hidden text-right font-medium text-grayScale-700 lg:table-cell">
|
||||
{Number.isFinite(q.points) ? q.points : "unassigned"}
|
||||
{Number.isFinite(q.points) ? q.points : <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell onClick={(e) => e.stopPropagation()}>
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import {
|
|||
} from "../../lib/contentListFilters";
|
||||
import { refreshFileUrl, uploadImageFile } from "../../api/files.api";
|
||||
import type { LearningProgramListItem } from "../../types/course.types";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
/** Presigned MinIO/S3 URLs and our storage hosts — safe to send to POST /files/refresh-url. */
|
||||
function looksLikeRefreshableFileUrl(url: string): boolean {
|
||||
|
|
@ -732,7 +733,7 @@ export function LearnEnglishPage() {
|
|||
<p className="mt-2 text-sm leading-relaxed text-grayScale-500 line-clamp-4">
|
||||
{program.description?.trim()
|
||||
? program.description
|
||||
: "unassigned"}
|
||||
: <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
<Link
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import { ModulePracticeCard } from "./components/ModulePracticeCard";
|
|||
import { VideoCard } from "./components/VideoCard";
|
||||
import { ContentListSearchFilterBar } from "./components/ContentListSearchFilterBar";
|
||||
import { ContentPageDescription } from "./components/ContentPageDescription";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import {
|
||||
filterBySearchAndPublishStatus,
|
||||
type PublishStatusFilter,
|
||||
|
|
@ -157,13 +158,13 @@ export function ModuleDetailPage() {
|
|||
|
||||
const displayModuleDescription = (() => {
|
||||
if (hasNavName) {
|
||||
return navState?.moduleDescription?.trim() || "unassigned";
|
||||
return navState?.moduleDescription?.trim() || <UnassignedLabel />;
|
||||
}
|
||||
if (!moduleListResolved) {
|
||||
return "Loading…";
|
||||
}
|
||||
if (loadedModuleDescription !== null) {
|
||||
return loadedModuleDescription.trim() || "unassigned";
|
||||
return loadedModuleDescription.trim() || <UnassignedLabel />;
|
||||
}
|
||||
return "unassigned";
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ import { CreatePracticeWizard } from "./components/CreatePracticeWizard"
|
|||
import type { PracticeParentKind } from "../../types/course.types"
|
||||
import { cn } from "../../lib/utils"
|
||||
import { PageBackLink } from "../../components/navigation/PageBackLink"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type ParentTab = "course" | "module" | "lesson"
|
||||
|
||||
|
|
@ -994,7 +995,7 @@ export function PracticeDetailsPage() {
|
|||
<div>
|
||||
<p className="text-xs font-bold uppercase tracking-wider text-grayScale-500">Story</p>
|
||||
<p className="mt-1.5 whitespace-pre-wrap text-sm leading-relaxed text-grayScale-700">
|
||||
{practice.story_description?.trim() || "unassigned"}
|
||||
{practice.story_description?.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
{quickTipParts.length > 0 && (
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import { Select } from "../../components/ui/select"
|
|||
import { Textarea } from "../../components/ui/textarea"
|
||||
import type { PracticeQuestion, QuestionSetQuestion, QuestionDetail } from "../../types/course.types"
|
||||
import { DEFAULT_TABLE_PAGE_SIZE, TABLE_PAGE_SIZE_OPTIONS } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type QuestionType = "MCQ" | "TRUE_FALSE" | "SHORT" | "AUDIO"
|
||||
type DifficultyLevel = "EASY" | "MEDIUM" | "HARD"
|
||||
|
|
@ -647,7 +648,7 @@ export function PracticeQuestionsPage() {
|
|||
Points: {question.points ?? 0}
|
||||
</span>
|
||||
<span className="rounded-md bg-grayScale-100 px-2 py-1">
|
||||
Difficulty: {question.difficulty_level || "unassigned"}
|
||||
Difficulty: {question.difficulty_level || <UnassignedLabel />}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import type {
|
|||
ProgramCourseListItem,
|
||||
} from "../../types/course.types";
|
||||
import { PublishPracticeButton } from "./components/PublishPracticeButton";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
export function ProgramCoursesPage() {
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -759,7 +760,7 @@ export function ProgramCoursesPage() {
|
|||
{course.name}
|
||||
</h3>
|
||||
<p className="mt-2 text-[13px] leading-relaxed text-grayScale-500 line-clamp-2">
|
||||
{course.description?.trim() ? course.description : "unassigned"}
|
||||
{course.description?.trim() ? course.description : <UnassignedLabel />}
|
||||
</p>
|
||||
|
||||
<div className="my-6 grid grid-cols-3 gap-4 border-y border-grayScale-50 py-4">
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import {
|
|||
} from "../../lib/contentListFilters";
|
||||
import { uploadImageFile } from "../../api/files.api";
|
||||
import uploadIcon from "../../assets/icons/upload.png";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
export function ProgramDetailPage() {
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -116,7 +117,7 @@ export function ProgramDetailPage() {
|
|||
list.map((row) => ({
|
||||
id: Number(row.id),
|
||||
name: row.name?.trim() || `Course ${row.id}`,
|
||||
description: row.description?.trim() || "unassigned",
|
||||
description: row.description?.trim() || <UnassignedLabel />,
|
||||
thumbnail: row.thumbnail?.trim() || null,
|
||||
sortOrder: Number(row.sort_order ?? 0),
|
||||
publishStatus: row.publish_status ?? null,
|
||||
|
|
@ -310,7 +311,7 @@ export function ProgramDetailPage() {
|
|||
{
|
||||
id: row.id,
|
||||
name: row.name ?? name,
|
||||
description: row.description?.trim() || "unassigned",
|
||||
description: row.description?.trim() || <UnassignedLabel />,
|
||||
thumbnail: row.thumbnail?.trim() || null,
|
||||
sortOrder: Number(row.sort_order ?? 0),
|
||||
unitsCount: Number(row.units_count ?? 0),
|
||||
|
|
@ -409,7 +410,7 @@ export function ProgramDetailPage() {
|
|||
? {
|
||||
...course,
|
||||
name: row?.name ?? name,
|
||||
description: row?.description?.trim() || preservedDescription || "unassigned",
|
||||
description: row?.description?.trim() || preservedDescription || <UnassignedLabel />,
|
||||
thumbnail: row?.thumbnail?.trim() || null,
|
||||
sortOrder: Number(row?.sort_order ?? sortOrderNum),
|
||||
unitsCount: Number(row?.units_count ?? course.unitsCount ?? 0),
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import type { QuestionDetail } from "../../types/course.types"
|
|||
import { cn } from "../../lib/utils"
|
||||
import { PageBackLink } from "../../components/navigation/PageBackLink"
|
||||
import { TABLE_PAGE_SIZE_OPTIONS } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type QuestionTypeFilter = "all" | "MCQ" | "TRUE_FALSE" | "SHORT_ANSWER" | "AUDIO"
|
||||
type DifficultyFilter = "all" | "EASY" | "MEDIUM" | "HARD"
|
||||
|
|
@ -523,7 +524,7 @@ export function QuestionsPage() {
|
|||
)}
|
||||
</TableCell>
|
||||
<TableCell className="hidden py-3.5 text-sm text-grayScale-500 md:table-cell">
|
||||
{question.status || "unassigned"}
|
||||
{question.status || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="py-3.5 text-sm font-semibold text-grayScale-600">
|
||||
{question.points ?? 0}
|
||||
|
|
@ -696,10 +697,10 @@ export function QuestionsPage() {
|
|||
<div className="grid grid-cols-1 gap-3 text-sm sm:grid-cols-2">
|
||||
<p><span className="font-medium">ID:</span> {detailData.id}</p>
|
||||
<p><span className="font-medium">Type:</span> {typeLabels[detailData.question_type] || detailData.question_type}</p>
|
||||
<p><span className="font-medium">Difficulty:</span> {detailData.difficulty_level || "unassigned"}</p>
|
||||
<p><span className="font-medium">Difficulty:</span> {detailData.difficulty_level || <UnassignedLabel />}</p>
|
||||
<p><span className="font-medium">Points:</span> {detailData.points ?? 0}</p>
|
||||
<p><span className="font-medium">Status:</span> {detailData.status || "unassigned"}</p>
|
||||
<p><span className="font-medium">Created:</span> {detailData.created_at || "unassigned"}</p>
|
||||
<p><span className="font-medium">Status:</span> {detailData.status || <UnassignedLabel />}</p>
|
||||
<p><span className="font-medium">Created:</span> {detailData.created_at || <UnassignedLabel />}</p>
|
||||
</div>
|
||||
{detailData.explanation ? (
|
||||
<div>
|
||||
|
|
@ -755,7 +756,7 @@ export function QuestionsPage() {
|
|||
: (answer as { acceptable_answer?: string }).acceptable_answer || ""
|
||||
return (
|
||||
<p key={`${value}-${index}`} className="rounded-md border border-grayScale-200 bg-grayScale-50 px-2 py-1">
|
||||
{value || "unassigned"}
|
||||
{value || <UnassignedLabel />}
|
||||
</p>
|
||||
)
|
||||
})}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import { toast } from "sonner"
|
|||
import { countActiveFilters } from "../../lib/adminFilterUtils"
|
||||
import { fetchAllOffsetPages } from "../../lib/fetchAllOffsetPages"
|
||||
import { DEFAULT_TABLE_PAGE_SIZE, TABLE_PAGE_SIZE_OPTIONS } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
const MAX_AUDIO_SIZE_BYTES = 50 * 1024 * 1024
|
||||
const ALLOWED_AUDIO_EXTENSIONS = new Set(["mp3", "wav", "ogg", "m4a", "aac", "webm", "flac"])
|
||||
|
|
@ -1275,7 +1276,7 @@ export function SpeakingPage() {
|
|||
const groupedAudioQuestions = useMemo(() => {
|
||||
const groups = new Map<string, { practiceId: number | null; practiceTitle: string; questions: AudioListQuestion[] }>()
|
||||
for (const q of audioQuestions) {
|
||||
const key = q.practice_id ? String(q.practice_id) : "unassigned"
|
||||
const key = q.practice_id ? String(q.practice_id) : <UnassignedLabel />
|
||||
const title = q.practice_title || "Unknown practice"
|
||||
if (!groups.has(key)) {
|
||||
groups.set(key, { practiceId: q.practice_id, practiceTitle: title, questions: [] })
|
||||
|
|
@ -1498,13 +1499,13 @@ export function SpeakingPage() {
|
|||
<div className="mt-2 flex flex-wrap items-center gap-2 text-xs">
|
||||
<span className="rounded-md bg-brand-100 px-2 py-0.5 font-medium text-brand-800">AUDIO</span>
|
||||
<span className="rounded-md bg-grayScale-100 px-2 py-1 text-grayScale-600">
|
||||
Difficulty: {question.difficulty_level || "unassigned"}
|
||||
Difficulty: {question.difficulty_level || <UnassignedLabel />}
|
||||
</span>
|
||||
<span className="rounded-md bg-grayScale-100 px-2 py-1 text-grayScale-600">
|
||||
Points: {question.points ?? 0}
|
||||
</span>
|
||||
<span className="rounded-md bg-grayScale-100 px-2 py-1 text-grayScale-600">
|
||||
Status: {question.status || "unassigned"}
|
||||
Status: {question.status || <UnassignedLabel />}
|
||||
</span>
|
||||
</div>
|
||||
{question.image_url && imagePreviewByQuestionId[question.id] ? (
|
||||
|
|
@ -1788,19 +1789,19 @@ export function SpeakingPage() {
|
|||
<div className="grid grid-cols-1 gap-3 text-sm sm:grid-cols-2">
|
||||
<div>
|
||||
<p className="text-xs font-medium text-grayScale-500">Status</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.status || "unassigned"}</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.status || <UnassignedLabel />}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs font-medium text-grayScale-500">Points</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.points ?? "unassigned"}</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.points ?? <UnassignedLabel />}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs font-medium text-grayScale-500">Difficulty</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.difficulty_level || "unassigned"}</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.difficulty_level || <UnassignedLabel />}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-xs font-medium text-grayScale-500">Type</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.question_type || "unassigned"}</p>
|
||||
<p className="mt-1 text-grayScale-700">{selectedQuestionDetail.question_type || <UnassignedLabel />}</p>
|
||||
</div>
|
||||
</div>
|
||||
{selectedQuestionDetail.audio_correct_answer_text ? (
|
||||
|
|
@ -2440,11 +2441,11 @@ export function SpeakingPage() {
|
|||
<div className="rounded-xl border border-grayScale-200 bg-white p-5 shadow-sm">
|
||||
<h3 className="mb-3 text-sm font-semibold uppercase tracking-wide text-grayScale-500">Practice</h3>
|
||||
<div className="grid grid-cols-1 gap-3 text-sm text-grayScale-600 sm:grid-cols-2">
|
||||
<p><span className="font-medium">Title:</span> {setTitle || "unassigned"}</p>
|
||||
<p><span className="font-medium">Course ID:</span> {subCourseId || "unassigned"}</p>
|
||||
<p className="sm:col-span-2"><span className="font-medium">Description:</span> {setDescription || "unassigned"}</p>
|
||||
<p><span className="font-medium">Title:</span> {setTitle || <UnassignedLabel />}</p>
|
||||
<p><span className="font-medium">Course ID:</span> {subCourseId || <UnassignedLabel />}</p>
|
||||
<p className="sm:col-span-2"><span className="font-medium">Description:</span> {setDescription || <UnassignedLabel />}</p>
|
||||
<p className="sm:col-span-2 break-all">
|
||||
<span className="font-medium">Intro video URL:</span> {introVideoUrl.trim() || "unassigned"}
|
||||
<span className="font-medium">Intro video URL:</span> {introVideoUrl.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
<p><span className="font-medium">Status:</span> {setStatus}</p>
|
||||
</div>
|
||||
|
|
@ -2467,27 +2468,27 @@ export function SpeakingPage() {
|
|||
<p><span className="font-medium text-grayScale-700">Status:</span> {setStatus}</p>
|
||||
<p className="sm:col-span-2">
|
||||
<span className="font-medium text-grayScale-700">Voice Prompt:</span>{" "}
|
||||
{draft.voicePrompt.trim() || "unassigned"}
|
||||
{draft.voicePrompt.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="sm:col-span-2">
|
||||
<span className="font-medium text-grayScale-700">Sample Answer Voice Prompt:</span>{" "}
|
||||
{draft.sampleAnswerVoicePrompt.trim() || "unassigned"}
|
||||
{draft.sampleAnswerVoicePrompt.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="sm:col-span-2">
|
||||
<span className="font-medium text-grayScale-700">Image URL:</span>{" "}
|
||||
{draft.imageUrl.trim() || "unassigned"}
|
||||
{draft.imageUrl.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="sm:col-span-2">
|
||||
<span className="font-medium text-grayScale-700">Audio Correct Answer Text:</span>{" "}
|
||||
{draft.audioCorrectAnswerText.trim() || "unassigned"}
|
||||
{draft.audioCorrectAnswerText.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="sm:col-span-2">
|
||||
<span className="font-medium text-grayScale-700">Tips:</span>{" "}
|
||||
{draft.tips.trim() || "unassigned"}
|
||||
{draft.tips.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="sm:col-span-2">
|
||||
<span className="font-medium text-grayScale-700">Explanation:</span>{" "}
|
||||
{draft.explanation.trim() || "unassigned"}
|
||||
{draft.explanation.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap gap-3">
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import type {
|
|||
} from "../../types/course.types"
|
||||
import type { Rating } from "../../types/ratings.types"
|
||||
import { SpinnerIcon } from "../../components/ui/spinner-icon"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type TabType = "video" | "practice" | "ratings"
|
||||
type StatusFilter = "all" | "published" | "draft" | "archived"
|
||||
|
|
@ -625,7 +626,7 @@ export function SubModuleContentPage() {
|
|||
day: "numeric",
|
||||
year: "numeric",
|
||||
})
|
||||
: "unassigned"}
|
||||
: <UnassignedLabel />}
|
||||
</span>
|
||||
<div className="flex gap-0.5" onClick={(e) => e.stopPropagation()}>
|
||||
<button
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ import {
|
|||
import { PracticeActionButton } from "./components/PracticeActionButton";
|
||||
import { UnitPracticesPanel } from "./components/UnitPracticesPanel";
|
||||
import { cn } from "../../lib/utils";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
export function UnitManagementPage() {
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -209,7 +210,7 @@ export function UnitManagementPage() {
|
|||
list.map((row, index) => ({
|
||||
id: Number(row.id),
|
||||
name: row.name?.trim() || `Module ${row.id}`,
|
||||
description: row.description?.trim() || "unassigned",
|
||||
description: row.description?.trim() || <UnassignedLabel />,
|
||||
thumbnail: row.thumbnail?.trim() || "",
|
||||
icon: row.icon?.trim() || "",
|
||||
sortOrder: Number(row.sort_order ?? 0),
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { Badge } from "../../../components/ui/badge"
|
|||
import { Card } from "../../../components/ui/card"
|
||||
import { Button } from "../../../components/ui/button"
|
||||
import { cn } from "../../../lib/utils"
|
||||
import { UnassignedLabel, isUnassignedLabel } from "../../../lib/displayValue"
|
||||
|
||||
export interface QuestionTypeDefinitionCardModel {
|
||||
id: number
|
||||
|
|
@ -70,7 +71,7 @@ export function QuestionTypeCard({
|
|||
isActive ? "bg-[#F0FDF4] text-[#16A34A]" : "bg-grayScale-50 text-grayScale-600",
|
||||
)}
|
||||
>
|
||||
{statusLabel}
|
||||
{isUnassignedLabel(statusLabel) ? <UnassignedLabel /> : statusLabel}
|
||||
</Badge>
|
||||
<div className="flex items-center gap-1">
|
||||
{onCreatePractice ? (
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import {
|
|||
isQuestionTypeDefinitionPracticeUnlinked,
|
||||
} from "../../../lib/questionTypeDefinitionPractices"
|
||||
import { DEFAULT_TABLE_PAGE_SIZE, TABLE_PAGE_SIZE_OPTIONS } from "../../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../../lib/displayValue"
|
||||
import type {
|
||||
QuestionTypeDefinition,
|
||||
QuestionTypeDefinitionPractice,
|
||||
|
|
@ -234,7 +235,7 @@ export function QuestionTypeDefinitionPracticesDialog({
|
|||
publishStatusClass(practice.publish_status),
|
||||
)}
|
||||
>
|
||||
{practice.publish_status || "unassigned"}
|
||||
{practice.publish_status || <UnassignedLabel />}
|
||||
</Badge>
|
||||
<Badge variant="secondary" className="font-mono text-[10px] uppercase tracking-wider">
|
||||
{practice.matching_question_count} matching question
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import { PersonaAvatar } from "../../../../components/personas/PersonaAvatar";
|
|||
import { Button } from "../../../../components/ui/button";
|
||||
import { Card } from "../../../../components/ui/card";
|
||||
import { cn } from "../../../../lib/utils";
|
||||
import { UnassignedLabel, isUnassignedLabel } from "../../../../lib/displayValue"
|
||||
|
||||
export type PracticeReviewQuestion = {
|
||||
id: string;
|
||||
|
|
@ -278,7 +279,7 @@ export function PracticeSequentialReview({
|
|||
</div>
|
||||
<div className="rounded-xl border border-grayScale-200 bg-white px-5 py-4 shadow-sm">
|
||||
<p className="text-sm leading-relaxed text-grayScale-600">
|
||||
{guidanceText.trim() || "unassigned"}
|
||||
{isUnassignedLabel(guidanceText) ? <UnassignedLabel /> : guidanceText}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -303,7 +304,7 @@ export function PracticeSequentialReview({
|
|||
Text prompt
|
||||
</p>
|
||||
<p className="text-sm leading-relaxed text-grayScale-800">
|
||||
{question.questionText.trim() || "unassigned"}
|
||||
{question.questionText.trim() || <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
{question.voicePrompt.trim() ? (
|
||||
|
|
@ -358,7 +359,7 @@ export function PracticeSequentialReview({
|
|||
/>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-xs text-grayScale-400">unassigned</p>
|
||||
<p className="text-xs text-grayScale-400"><UnassignedLabel /></p>
|
||||
)}
|
||||
</div>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import { DEFAULT_TABLE_PAGE_SIZE, TABLE_PAGE_SIZE_OPTIONS } from "../../../../li
|
|||
import type { ParentContextPractice, PracticeParent } from "../../../../types/course.types"
|
||||
import { cn } from "../../../../lib/utils"
|
||||
import { SearchHighlight, getSearchTokens } from "../../../../components/SearchHighlight"
|
||||
import { UnassignedLabel } from "../../../../lib/displayValue"
|
||||
|
||||
interface SelectPracticeToAttachStepProps {
|
||||
targetParent: PracticeParent
|
||||
|
|
@ -254,7 +255,11 @@ export function SelectPracticeToAttachStep({
|
|||
publishStatusClass(practice.publish_status),
|
||||
)}
|
||||
>
|
||||
{(practice.publish_status || "unassigned").toString()}
|
||||
{practice.publish_status?.trim() ? (
|
||||
practice.publish_status
|
||||
) : (
|
||||
<UnassignedLabel />
|
||||
)}
|
||||
</span>
|
||||
{alreadyLinked ? (
|
||||
<span className="text-[11px] font-semibold text-brand-600">
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {
|
|||
} from "../../lib/questionTypeDefinitionValidation"
|
||||
import { slotLabel } from "./componentKindUi"
|
||||
import { questionTypeGroupLabels } from "../../../../lib/questionTypeGroupIds"
|
||||
import { UnassignedLabel } from "../../../../lib/displayValue"
|
||||
|
||||
interface QuestionTypeReviewPublishStepProps {
|
||||
draft: QuestionTypeDefinitionCreatePayload
|
||||
|
|
@ -131,11 +132,11 @@ export function QuestionTypeReviewPublishStep({
|
|||
</div>
|
||||
<div className="sm:col-span-2">
|
||||
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Description</dt>
|
||||
<dd className="font-medium text-grayScale-800 dark:text-grayScale-500 mt-1">{payload.description || "unassigned"}</dd>
|
||||
<dd className="font-medium text-grayScale-800 dark:text-grayScale-500 mt-1">{payload.description || <UnassignedLabel />}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Groups</dt>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{groupName || "unassigned"}</dd>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{groupName || <UnassignedLabel />}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Status</dt>
|
||||
|
|
@ -143,15 +144,15 @@ export function QuestionTypeReviewPublishStep({
|
|||
</div>
|
||||
<div>
|
||||
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Runtime type</dt>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{runtime ?? "unassigned"}</dd>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{runtime ?? <UnassignedLabel />}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Stimulus kinds</dt>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.stimulus_component_kinds.join(", ") || "unassigned"}</dd>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.stimulus_component_kinds.join(", ") || <UnassignedLabel />}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-grayScale-400 font-semibold uppercase text-[11px] tracking-wide">Response kinds</dt>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.response_component_kinds.join(", ") || "unassigned"}</dd>
|
||||
<dd className="font-medium text-grayScale-900 dark:text-grayScale-600 mt-1">{payload.response_component_kinds.join(", ") || <UnassignedLabel />}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
} from "../../lib/questionTypeDefinitionValidation"
|
||||
import { DefinitionRuntimeHint } from "./DefinitionRuntimeHint"
|
||||
import { QuestionTypeStepFooter } from "./QuestionTypeStepFooter"
|
||||
import { UnassignedLabel } from "../../../../lib/displayValue"
|
||||
|
||||
interface QuestionTypeValidatePreviewStepProps {
|
||||
draft: QuestionTypeDefinitionCreatePayload
|
||||
|
|
@ -118,13 +119,13 @@ export function QuestionTypeValidatePreviewStep({
|
|||
<div>
|
||||
<dt className="text-[11px] font-bold uppercase text-grayScale-400">Stimulus kinds</dt>
|
||||
<dd className="mt-1 font-medium text-grayScale-800">
|
||||
{payload.stimulus_component_kinds.join(", ") || "unassigned"}
|
||||
{payload.stimulus_component_kinds.join(", ") || <UnassignedLabel />}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt className="text-[11px] font-bold uppercase text-grayScale-400">Response kinds</dt>
|
||||
<dd className="mt-1 font-medium text-grayScale-800">
|
||||
{payload.response_component_kinds.join(", ") || "unassigned"}
|
||||
{payload.response_component_kinds.join(", ") || <UnassignedLabel />}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -132,7 +133,7 @@ export function QuestionTypeValidatePreviewStep({
|
|||
<dd className="mt-1 font-medium text-grayScale-800">
|
||||
{payload.stimulus_schema.length
|
||||
? payload.stimulus_schema.map((r) => r.label).join(" · ")
|
||||
: "unassigned"}
|
||||
: <UnassignedLabel />}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
|
|
@ -140,7 +141,7 @@ export function QuestionTypeValidatePreviewStep({
|
|||
<dd className="mt-1 font-medium text-grayScale-800">
|
||||
{payload.response_schema.length
|
||||
? payload.response_schema.map((r) => r.label).join(" · ")
|
||||
: "unassigned"}
|
||||
: <UnassignedLabel />}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {
|
|||
resolveThumbnailForPreview,
|
||||
} from "../../../../lib/videoPreview";
|
||||
import { PreviewLimitedFileVideo } from "../PreviewLimitedFileVideo";
|
||||
import { UnassignedLabel } from "../../../../lib/displayValue"
|
||||
|
||||
interface ReviewPublishStepProps {
|
||||
formData: AddLessonFormData;
|
||||
|
|
@ -115,7 +116,7 @@ export function ReviewPublishStep({
|
|||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-grayScale-400 text-sm">unassigned</p>
|
||||
<p className="text-grayScale-400 text-sm"><UnassignedLabel /></p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
|
|
@ -148,7 +149,7 @@ export function ReviewPublishStep({
|
|||
</p>
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-grayScale-400 text-sm">unassigned</p>
|
||||
<p className="text-grayScale-400 text-sm"><UnassignedLabel /></p>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -176,7 +177,7 @@ export function ReviewPublishStep({
|
|||
Title
|
||||
</span>
|
||||
<p className="text-[15px] font-medium text-grayScale-900">
|
||||
{formData.title || "unassigned"}
|
||||
{formData.title || <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -187,7 +188,7 @@ export function ReviewPublishStep({
|
|||
<p className="text-[15px] font-medium text-grayScale-900">
|
||||
{formData.sortOrder.trim() !== ""
|
||||
? formData.sortOrder.trim()
|
||||
: "unassigned"}
|
||||
: <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
|
@ -199,7 +200,8 @@ export function ReviewPublishStep({
|
|||
className="text-[14px] text-grayScale-600 leading-relaxed max-w-4xl"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html:
|
||||
formData.description || "<p class='text-grayScale-400'>unassigned</p>",
|
||||
formData.description ||
|
||||
"<p class='text-grayScale-400 italic'>unassigned</p>",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import { CreateFaqDialog } from "./components/CreateFaqDialog"
|
|||
import { FaqDeleteDialog } from "./components/FaqDeleteDialog"
|
||||
import { FaqAccessDenied } from "./components/FaqAccessDenied"
|
||||
import { FaqPublicPreviewDialog } from "./components/FaqPublicPreviewDialog"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
type StatusFilter = "all" | FAQStatus
|
||||
|
||||
|
|
@ -339,7 +340,7 @@ export function FaqsPage() {
|
|||
{faq.category ? (
|
||||
<Badge variant="secondary">{faq.category}</Badge>
|
||||
) : (
|
||||
<span className="text-xs text-grayScale-400">unassigned</span>
|
||||
<span className="text-xs text-grayScale-400"><UnassignedLabel /></span>
|
||||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-center text-sm text-grayScale-600">
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import { Button } from "../../../components/ui/button"
|
|||
import { Input } from "../../../components/ui/input"
|
||||
import { Textarea } from "../../../components/ui/textarea"
|
||||
import type { FAQStatus } from "../../../types/faq.types"
|
||||
import { UnassignedLabel } from "../../../lib/displayValue"
|
||||
|
||||
export type FaqFormDraft = {
|
||||
question: string
|
||||
|
|
@ -127,10 +128,10 @@ export function FaqForm({
|
|||
Preview
|
||||
</p>
|
||||
<p className="mt-2 text-sm font-medium text-grayScale-900">
|
||||
{draft.question || "unassigned"}
|
||||
{draft.question || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="mt-1 whitespace-pre-wrap text-xs leading-relaxed text-grayScale-600">
|
||||
{draft.answer || "unassigned"}
|
||||
{draft.answer || <UnassignedLabel />}
|
||||
</p>
|
||||
{(draft.category || draft.display_order) && (
|
||||
<div className="mt-2.5 flex items-center gap-2 text-[11px] text-grayScale-400">
|
||||
|
|
@ -149,10 +150,10 @@ export function FaqForm({
|
|||
Preview
|
||||
</p>
|
||||
<p className="mt-2 text-sm font-medium text-grayScale-900">
|
||||
{draft.question || "unassigned"}
|
||||
{draft.question || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="mt-1 whitespace-pre-wrap text-xs leading-relaxed text-grayScale-600">
|
||||
{draft.answer || "unassigned"}
|
||||
{draft.answer || <UnassignedLabel />}
|
||||
</p>
|
||||
{(draft.category || draft.display_order) && (
|
||||
<div className="mt-2.5 flex items-center gap-2 text-[11px] text-grayScale-400">
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ import {
|
|||
createIssue,
|
||||
} from "../../api/issues.api";
|
||||
import type { Issue } from "../../types/issue.types";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
// ── Status configuration ───────────────────────────────────────────
|
||||
const STATUSES = ["pending", "in_progress", "resolved", "rejected"] as const;
|
||||
|
|
@ -532,7 +533,7 @@ export function IssuesPage() {
|
|||
</div>
|
||||
<div className="min-w-0">
|
||||
<p className="text-sm font-medium text-grayScale-600 truncate">
|
||||
{issue.subject?.trim() ? issue.subject : "unassigned"}
|
||||
{issue.subject?.trim() ? issue.subject : <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="text-xs text-grayScale-400 truncate mt-0.5">
|
||||
{issue.description?.trim() ? issue.description : "No description"}
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import { cn } from "../../lib/utils"
|
|||
import {
|
||||
DEFAULT_TABLE_PAGE_SIZE,
|
||||
} from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import {
|
||||
getNotificationMessage,
|
||||
getNotificationTitle,
|
||||
|
|
@ -72,7 +73,7 @@ function recipientLabel(notification: Notification): string {
|
|||
if (notification.reciever) {
|
||||
parts.push(notification.reciever)
|
||||
}
|
||||
return parts.length > 0 ? parts.join(" · ") : "unassigned"
|
||||
return parts.length > 0 ? parts.join(" · ") : <UnassignedLabel />
|
||||
}
|
||||
|
||||
export function AllNotificationsPage() {
|
||||
|
|
@ -355,14 +356,14 @@ export function AllNotificationsPage() {
|
|||
</TableCell>
|
||||
<TableCell className="max-w-[260px]">
|
||||
<p className="truncate text-sm font-medium text-grayScale-700">
|
||||
{getNotificationTitle(notification) || "unassigned"}
|
||||
{getNotificationTitle(notification) || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="truncate text-xs text-grayScale-400">
|
||||
{getNotificationMessage(notification) || "unassigned"}
|
||||
{getNotificationMessage(notification) || <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
<TableCell className="text-xs capitalize text-grayScale-600">
|
||||
{channelLabel(notification.delivery_channel) || "unassigned"}
|
||||
{channelLabel(notification.delivery_channel) || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="hidden text-xs text-grayScale-600 md:table-cell">
|
||||
{formatNotificationTypeLabel(notification.type)}
|
||||
|
|
@ -372,7 +373,7 @@ export function AllNotificationsPage() {
|
|||
variant={getNotificationLevelBadge(notification.level)}
|
||||
className="text-[10px]"
|
||||
>
|
||||
{notification.level || "unassigned"}
|
||||
{notification.level || <UnassignedLabel />}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
|
|
@ -381,7 +382,7 @@ export function AllNotificationsPage() {
|
|||
</Badge>
|
||||
</TableCell>
|
||||
<TableCell className="hidden text-xs capitalize text-grayScale-500 sm:table-cell">
|
||||
{notification.delivery_status || "unassigned"}
|
||||
{notification.delivery_status || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="hidden text-xs text-grayScale-500 sm:table-cell">
|
||||
{formatNotificationTimestamp(notification.timestamp)}
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import { NOTIFICATION_REALTIME_EVENT } from "../../lib/notificationsWebSocket"
|
|||
import { toast } from "sonner"
|
||||
import { TablePagination } from "../../components/admin/TablePagination"
|
||||
import { DEFAULT_TABLE_PAGE_SIZE } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
function NotificationItem({
|
||||
notification,
|
||||
|
|
@ -520,7 +521,7 @@ export function NotificationsPage() {
|
|||
<div>
|
||||
<p className="text-xs font-medium text-grayScale-500">Channels used</p>
|
||||
<p className="mt-1 text-xl font-semibold text-grayScale-700">
|
||||
{Array.from(new Set(notifications.map((n) => n.delivery_channel))).length || "unassigned"}
|
||||
{Array.from(new Set(notifications.map((n) => n.delivery_channel))).length || <UnassignedLabel />}
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid h-11 w-11 shrink-0 place-items-center rounded-xl bg-brand-100/60 text-brand-600">
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import {
|
|||
import { countActiveFilters } from "../../lib/adminFilterUtils"
|
||||
import { cn } from "../../lib/utils"
|
||||
import { DEFAULT_TABLE_PAGE_SIZE } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
import type {
|
||||
NotificationChannel,
|
||||
ScheduledNotification,
|
||||
|
|
@ -261,7 +262,7 @@ export function ScheduledNotificationsPage() {
|
|||
<TableCell>{channelLabel(job.channel)}</TableCell>
|
||||
<TableCell className="max-w-[240px]">
|
||||
<p className="truncate text-sm font-medium text-grayScale-700">
|
||||
{job.title || "unassigned"}
|
||||
{job.title || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="truncate text-xs text-grayScale-400">{job.message}</p>
|
||||
{job.channel === "email" && job.email_template_slug ? (
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { Card, CardContent } from "../../../components/ui/card"
|
|||
import { channelLabel, formatScheduledAtLabel } from "../../../lib/notificationBulk"
|
||||
import { cn } from "../../../lib/utils"
|
||||
import type { NotificationChannel } from "../../../types/notification.types"
|
||||
import { UnassignedLabel } from "../../../lib/displayValue"
|
||||
|
||||
export type BulkSendSummary =
|
||||
| {
|
||||
|
|
@ -177,9 +178,9 @@ export function BulkSendSummaryPanel({ summary, onDismiss }: BulkSendSummaryPane
|
|||
Content
|
||||
</p>
|
||||
<p className="mt-1 truncate text-sm font-medium text-grayScale-800">
|
||||
{summary.titlePreview || "unassigned"}
|
||||
{summary.titlePreview || <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="truncate text-xs text-grayScale-500">{summary.messagePreview || "unassigned"}</p>
|
||||
<p className="truncate text-xs text-grayScale-500">{summary.messagePreview || <UnassignedLabel />}</p>
|
||||
{!isImmediate && summary.emailTemplateSlug ? (
|
||||
<p className="mt-1 text-[10px] text-grayScale-400">
|
||||
Template: {summary.emailTemplateSlug}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ import type {
|
|||
} from "../../types/payment.types"
|
||||
|
||||
import { DEFAULT_TABLE_PAGE_SIZE, TABLE_PAGE_SIZE_OPTIONS } from "../../lib/tablePagination"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
const STATUS_FILTERS: { value: PaymentStatus; label: string }[] = [
|
||||
{ value: "PENDING", label: "Pending" },
|
||||
|
|
@ -518,7 +519,7 @@ export function PaymentsPage() {
|
|||
<td className="whitespace-nowrap px-3 py-2.5 sm:px-4">
|
||||
<p className="font-semibold text-grayScale-900">#{payment.id}</p>
|
||||
<p className="mt-0.5 max-w-[140px] truncate font-mono text-[11px] text-grayScale-500">
|
||||
{payment.transaction_id || payment.session_id || "unassigned"}
|
||||
{payment.transaction_id || payment.session_id || <UnassignedLabel />}
|
||||
</p>
|
||||
</td>
|
||||
<td className="px-3 py-2.5 sm:px-4">
|
||||
|
|
@ -716,11 +717,11 @@ export function PaymentsPage() {
|
|||
<div className="mt-5 space-y-0 divide-y divide-grayScale-100">
|
||||
{[
|
||||
{ k: "Customer", v: paymentCustomerName(selected) },
|
||||
{ k: "Email", v: selected.user_email || "unassigned" },
|
||||
{ k: "Email", v: selected.user_email || <UnassignedLabel /> },
|
||||
{ k: "Plan", v: selected.plan_name || `Plan #${selected.plan_id}` },
|
||||
{ k: "Category", v: formatPaymentPlanCategory(selected.plan_category) },
|
||||
{ k: "Transaction", v: selected.transaction_id || "unassigned", mono: true },
|
||||
{ k: "Session", v: selected.session_id || "unassigned", mono: true },
|
||||
{ k: "Transaction", v: selected.transaction_id || <UnassignedLabel />, mono: true },
|
||||
{ k: "Session", v: selected.session_id || <UnassignedLabel />, mono: true },
|
||||
{ k: "Subscription", v: `#${selected.subscription_id}` },
|
||||
{ k: "Paid", v: formatPaymentDate(selected.paid_at ?? selected.created_at) },
|
||||
...(selected.expires_at ? [{ k: "Expires", v: formatPaymentDate(selected.expires_at) }] : []),
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ import { toast } from "sonner";
|
|||
import { InviteTeamMemberDialog } from "../role-management/components/InviteTeamMemberDialog";
|
||||
import { EXPORT_PERMISSIONS, EXPORT_ROUTES } from "../../lib/csv-export";
|
||||
import { teamMemberExportQuery } from "../../lib/csvExportFilters";
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
function formatDate(dateStr: string): string {
|
||||
return new Date(dateStr).toLocaleDateString("en-US", {
|
||||
|
|
@ -388,10 +389,10 @@ export function TeamManagementPage() {
|
|||
</span>
|
||||
</TableCell>
|
||||
<TableCell className="hidden md:table-cell text-sm text-grayScale-600">
|
||||
{member.department || "unassigned"}
|
||||
{member.department || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="hidden lg:table-cell text-sm text-grayScale-600">
|
||||
{member.job_title || "unassigned"}
|
||||
{member.job_title || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="hidden sm:table-cell">
|
||||
{member.last_login ? (
|
||||
|
|
@ -406,7 +407,7 @@ export function TeamManagementPage() {
|
|||
) : (
|
||||
<div>
|
||||
<div className="text-sm text-grayScale-600">Never</div>
|
||||
<div className="text-xs text-grayScale-400">unassigned</div>
|
||||
<div className="text-xs text-grayScale-400"><UnassignedLabel /></div>
|
||||
</div>
|
||||
)}
|
||||
</TableCell>
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ import { Separator } from "../../components/ui/separator"
|
|||
import { cn } from "../../lib/utils"
|
||||
import { notifyApiError } from "../../lib/apiErrors"
|
||||
import { formatTeamRoleLabel } from "../../lib/teamRoles"
|
||||
import { displayValue, NOT_ASSIGNED_LABEL } from "../../lib/displayValue"
|
||||
import { DisplayValue, NOT_ASSIGNED_LABEL, UnassignedLabel, displayValue, isUnassignedLabel } from "../../lib/displayValue"
|
||||
import { getTeamMemberById, updateTeamMemberStatus } from "../../api/team.api"
|
||||
import type { TeamMemberDetail } from "../../types/team.types"
|
||||
import { ActivityLogListPanel } from "../user-log/components/ActivityLogListPanel"
|
||||
|
|
@ -132,22 +132,26 @@ function LoadingSkeleton() {
|
|||
)
|
||||
}
|
||||
|
||||
function InfoItem({ label, value }: { label: string; value: string }) {
|
||||
function InfoItem({ label, value }: { label: string; value: React.ReactNode }) {
|
||||
return (
|
||||
<div>
|
||||
<p className="mb-1 text-[11px] font-medium uppercase tracking-wider text-grayScale-400">
|
||||
{label}
|
||||
</p>
|
||||
<p className="text-sm text-grayScale-700">{value}</p>
|
||||
<p className="text-sm text-grayScale-700">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function InfoRow({ label, value }: { label: string; value: string }) {
|
||||
function InfoRow({ label, value }: { label: string; value: React.ReactNode }) {
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<span className="text-sm text-grayScale-500">{label}</span>
|
||||
<span className="text-right text-sm font-medium text-grayScale-700">{value}</span>
|
||||
<span className="text-right text-sm font-medium text-grayScale-700">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</span>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
|
@ -159,7 +163,7 @@ function ContactField({
|
|||
}: {
|
||||
icon: React.ComponentType<{ className?: string }>
|
||||
label: string
|
||||
value: string
|
||||
value: React.ReactNode
|
||||
}) {
|
||||
return (
|
||||
<div className="flex items-center gap-3">
|
||||
|
|
@ -170,7 +174,9 @@ function ContactField({
|
|||
<p className="text-[11px] font-medium uppercase tracking-wider text-grayScale-400">
|
||||
{label}
|
||||
</p>
|
||||
<p className="truncate text-sm text-grayScale-700">{value}</p>
|
||||
<p className="truncate text-sm text-grayScale-700">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
|
@ -312,7 +318,7 @@ export function TeamMemberDetailPage() {
|
|||
<div className="min-w-0">
|
||||
<h2 className="truncate text-lg font-semibold text-grayScale-800">{fullName}</h2>
|
||||
<p className="truncate text-sm text-grayScale-500">
|
||||
{displayValue(member.job_title)}
|
||||
<DisplayValue value={member.job_title} />
|
||||
</p>
|
||||
<div className="mt-2 flex flex-wrap gap-2">
|
||||
<span
|
||||
|
|
@ -334,8 +340,8 @@ export function TeamMemberDetailPage() {
|
|||
<Separator />
|
||||
|
||||
<div className="space-y-3">
|
||||
<ContactField icon={Mail} label="Email" value={displayValue(member.email)} />
|
||||
<ContactField icon={Phone} label="Phone" value={displayValue(member.phone_number)} />
|
||||
<ContactField icon={Mail} label="Email" value={<DisplayValue value={member.email} />} />
|
||||
<ContactField icon={Phone} label="Phone" value={<DisplayValue value={member.phone_number} />} />
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
|
@ -383,8 +389,8 @@ export function TeamMemberDetailPage() {
|
|||
<CardContent className="space-y-5">
|
||||
<div className="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<InfoItem label="Team role" value={roleLabel} />
|
||||
<InfoItem label="Department" value={displayValue(member.department)} />
|
||||
<InfoItem label="Job title" value={displayValue(member.job_title)} />
|
||||
<InfoItem label="Department" value={<DisplayValue value={member.department} />} />
|
||||
<InfoItem label="Job title" value={<DisplayValue value={member.job_title} />} />
|
||||
<InfoItem label="Member ID" value={String(member.id)} />
|
||||
<InfoItem label="Joined" value={formatDate(member.created_at)} />
|
||||
<InfoItem
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@ import { TABLE_PAGE_SIZE_OPTIONS } from "../../../lib/tablePagination"
|
|||
import type { ActivityLog, ActivityLogFilters } from "../../../types/activity-log.types"
|
||||
import { ActorCell, ActorLabel } from "./ActorLabel"
|
||||
import { ActorHoverCard } from "./ActorHoverCard"
|
||||
import { UnassignedLabel } from "../../../lib/displayValue"
|
||||
|
||||
export interface ActivityLogListPanelProps {
|
||||
/** When set, locks the list to actions by this actor (user profile audit tab). */
|
||||
|
|
@ -281,7 +282,7 @@ export function ActivityLogListPanel({
|
|||
</div>
|
||||
<div>
|
||||
<p className="text-2xl font-bold text-grayScale-600">
|
||||
{logs[0]?.created_at ? getRelativeActivityTime(logs[0].created_at) : "unassigned"}
|
||||
{logs[0]?.created_at ? getRelativeActivityTime(logs[0].created_at) : <UnassignedLabel />}
|
||||
</p>
|
||||
<p className="text-xs text-grayScale-400">Latest on this page</p>
|
||||
</div>
|
||||
|
|
@ -450,7 +451,7 @@ export function ActivityLogListPanel({
|
|||
scrollable ? "whitespace-nowrap" : "max-w-[280px] truncate",
|
||||
)}
|
||||
>
|
||||
{log.message || "unassigned"}
|
||||
{log.message || <UnassignedLabel />}
|
||||
</p>
|
||||
</TableCell>
|
||||
{showActorColumn ? (
|
||||
|
|
@ -583,7 +584,7 @@ export function ActivityLogListPanel({
|
|||
icon={<Shield className="h-4 w-4" />}
|
||||
label="Role"
|
||||
value={
|
||||
selectedLog.actor_role ? formatRoleLabel(selectedLog.actor_role) : "unassigned"
|
||||
selectedLog.actor_role ? formatRoleLabel(selectedLog.actor_role) : <UnassignedLabel />
|
||||
}
|
||||
/>
|
||||
<DetailItem
|
||||
|
|
@ -601,13 +602,13 @@ export function ActivityLogListPanel({
|
|||
<DetailItem
|
||||
icon={<Globe className="h-4 w-4" />}
|
||||
label="IP address"
|
||||
value={selectedLog.ip_address || "unassigned"}
|
||||
value={selectedLog.ip_address || <UnassignedLabel />}
|
||||
/>
|
||||
<DetailItem
|
||||
icon={<Monitor className="h-4 w-4" />}
|
||||
label="User agent"
|
||||
value={
|
||||
selectedLog.user_agent ? truncateUA(selectedLog.user_agent) : "unassigned"
|
||||
selectedLog.user_agent ? truncateUA(selectedLog.user_agent) : <UnassignedLabel />
|
||||
}
|
||||
title={selectedLog.user_agent ?? undefined}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import type {
|
|||
} from "../../types/user.types"
|
||||
import type { Role } from "../../types/rbac.types"
|
||||
import { mapDeletionRequestApiItem } from "../../types/user.types"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
const stateBadge: Record<string, string> = {
|
||||
PENDING: "bg-amber-100 text-amber-700",
|
||||
|
|
@ -542,21 +543,21 @@ export function DeletionRequestsPage() {
|
|||
{item.first_name} {item.last_name}
|
||||
</p>
|
||||
<p className="text-xs text-grayScale-500">{item.email}</p>
|
||||
<p className="text-xs text-grayScale-500">{item.phone_number || "unassigned"}</p>
|
||||
<p className="text-xs text-grayScale-500">{item.phone_number || <UnassignedLabel />}</p>
|
||||
</TableCell>
|
||||
<TableCell className="py-3.5">
|
||||
<p className="text-sm text-grayScale-700">{item.role || "unassigned"}</p>
|
||||
<p className="text-xs text-grayScale-500">{item.status || "unassigned"}</p>
|
||||
<p className="text-sm text-grayScale-700">{item.role || <UnassignedLabel />}</p>
|
||||
<p className="text-xs text-grayScale-500">{item.status || <UnassignedLabel />}</p>
|
||||
</TableCell>
|
||||
<TableCell className="hidden py-3.5 text-sm text-grayScale-600 md:table-cell">
|
||||
{item.deletion_requested_at || "unassigned"}
|
||||
{item.deletion_requested_at || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="hidden py-3.5 text-sm text-grayScale-600 md:table-cell">
|
||||
{item.deletion_scheduled_at || "unassigned"}
|
||||
{item.deletion_scheduled_at || <UnassignedLabel />}
|
||||
</TableCell>
|
||||
<TableCell className="py-3.5">
|
||||
<Badge className={stateBadge[item.deletion_state] || "bg-grayScale-200 text-grayScale-600"}>
|
||||
{item.deletion_state || "unassigned"}
|
||||
{item.deletion_state || <UnassignedLabel />}
|
||||
</Badge>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import {
|
||||
ArrowLeft,
|
||||
BookOpen,
|
||||
|
|
@ -35,7 +35,7 @@ import type { UserLearningActivityData, UserSubscriptionsData } from "../../type
|
|||
import { UserLearningActivitySection } from "./components/UserLearningActivitySection";
|
||||
import { UserAccountActivitySection } from "./components/UserAccountActivitySection";
|
||||
import { UserSubscriptionsSection } from "./components/UserSubscriptionsSection";
|
||||
import { displayValue, NOT_ASSIGNED_LABEL } from "../../lib/displayValue";
|
||||
import { DisplayValue, NOT_ASSIGNED_LABEL, UnassignedLabel, displayValue, isUnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
const activityIcons = {
|
||||
completed: CheckCircle2,
|
||||
|
|
@ -413,9 +413,9 @@ export function UserDetailPage() {
|
|||
<div className="grid gap-3 text-sm sm:grid-cols-2">
|
||||
<InfoRow label="Joined" value={formatDate(user.created_at)} />
|
||||
<InfoRow label="Last login" value={formatDateTime(user.last_login, "Never")} />
|
||||
<InfoRow label="Gender" value={displayValue(user.gender)} />
|
||||
<InfoRow label="Gender" value={<DisplayValue value={user.gender} />} />
|
||||
<InfoRow label="Birthday" value={formatDate(user.birth_day)} />
|
||||
<InfoRow label="Occupation" value={displayValue(user.occupation)} />
|
||||
<InfoRow label="Occupation" value={<DisplayValue value={user.occupation} />} />
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
@ -439,7 +439,7 @@ export function UserDetailPage() {
|
|||
/>
|
||||
<InfoRow
|
||||
label="Preferred language"
|
||||
value={displayValue(user.preferred_language)}
|
||||
value={<DisplayValue value={user.preferred_language} />}
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
|
@ -467,11 +467,11 @@ export function UserDetailPage() {
|
|||
</CardHeader>
|
||||
<CardContent className="space-y-5">
|
||||
<div className="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2">
|
||||
<InfoItem label="Education level" value={displayValue(user.education_level)} />
|
||||
<InfoItem label="Education level" value={<DisplayValue value={user.education_level} />} />
|
||||
<InfoItem label="Age group" value={formatAgeGroup(user.age_group)} />
|
||||
<InfoItem label="Favorite topic" value={displayValue(user.favoutite_topic)} />
|
||||
<InfoItem label="Language goal" value={displayValue(user.language_goal)} />
|
||||
<InfoItem label="Challenge" value={displayValue(user.language_challange)} />
|
||||
<InfoItem label="Favorite topic" value={<DisplayValue value={user.favoutite_topic} />} />
|
||||
<InfoItem label="Language goal" value={<DisplayValue value={user.language_goal} />} />
|
||||
<InfoItem label="Challenge" value={<DisplayValue value={user.language_challange} />} />
|
||||
<InfoItem label="Role" value={formatRoleLabel(user.role)} />
|
||||
</div>
|
||||
|
||||
|
|
@ -598,20 +598,24 @@ export function UserDetailPage() {
|
|||
);
|
||||
}
|
||||
|
||||
function InfoItem({ label, value }: { label: string; value: string }) {
|
||||
function InfoItem({ label, value }: { label: string; value: ReactNode }) {
|
||||
return (
|
||||
<div>
|
||||
<p className="mb-1 text-[11px] font-medium uppercase tracking-wider text-grayScale-400">{label}</p>
|
||||
<p className="text-sm text-grayScale-700">{value}</p>
|
||||
<p className="text-sm text-grayScale-700">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
function InfoRow({ label, value }: { label: string; value: string }) {
|
||||
function InfoRow({ label, value }: { label: string; value: ReactNode }) {
|
||||
return (
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<span className="text-sm text-grayScale-500">{label}</span>
|
||||
<span className="text-sm font-medium text-grayScale-700">{value}</span>
|
||||
<span className="text-sm font-medium text-grayScale-700">
|
||||
{typeof value === "string" && isUnassignedLabel(value) ? <UnassignedLabel /> : value}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import axios from "axios"
|
|||
import { USER_FILTER_COUNTRIES, USER_FILTER_ETHIOPIA_REGIONS } from "../../data/userFilterLocations"
|
||||
import { EXPORT_PERMISSIONS, EXPORT_ROUTES } from "../../lib/csv-export"
|
||||
import { usersExportQuery } from "../../lib/csvExportFilters"
|
||||
import { UnassignedLabel } from "../../lib/displayValue"
|
||||
|
||||
function formatJoinedAt(iso: string): string {
|
||||
if (!iso?.trim()) return "unassigned"
|
||||
|
|
@ -365,7 +366,7 @@ export function UsersListPage() {
|
|||
const hasPhone = Boolean(phone?.trim())
|
||||
const hasEmail = Boolean(email?.trim())
|
||||
if (!hasPhone && !hasEmail) {
|
||||
return <span className="text-grayScale-400">unassigned</span>
|
||||
return <span className="text-grayScale-400"><UnassignedLabel /></span>
|
||||
}
|
||||
return (
|
||||
<div className="space-y-1 text-sm text-grayScale-600">
|
||||
|
|
@ -665,8 +666,8 @@ export function UsersListPage() {
|
|||
<TableCell className="hidden md:table-cell align-top">
|
||||
{renderContactDetails(u.phoneNumber, u.email)}
|
||||
</TableCell>
|
||||
<TableCell className="hidden md:table-cell text-grayScale-500">{u.country || "unassigned"}</TableCell>
|
||||
<TableCell className="hidden md:table-cell text-grayScale-500">{u.region || "unassigned"}</TableCell>
|
||||
<TableCell className="hidden md:table-cell text-grayScale-500">{u.country || <UnassignedLabel />}</TableCell>
|
||||
<TableCell className="hidden md:table-cell text-grayScale-500">{u.region || <UnassignedLabel />}</TableCell>
|
||||
<TableCell className="hidden md:table-cell text-sm text-grayScale-500 whitespace-nowrap">
|
||||
{formatJoinedAt(u.createdAt)}
|
||||
</TableCell>
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
TableRow,
|
||||
} from "../../../components/ui/table"
|
||||
import { useTeamPermissions } from "../../../hooks/useTeamPermissions"
|
||||
import { displayValue, NOT_ASSIGNED_LABEL } from "../../../lib/displayValue"
|
||||
import { DisplayValue, NOT_ASSIGNED_LABEL, displayValue } from "../../../lib/displayValue"
|
||||
import {
|
||||
formatAdminPaymentMethod,
|
||||
hasSubscriptionAdminPermission,
|
||||
|
|
@ -559,7 +559,7 @@ export function UserSubscriptionsSection({
|
|||
{recentPayments.map((payment) => (
|
||||
<TableRow key={payment.id}>
|
||||
<TableCell className="text-sm text-grayScale-700">
|
||||
{displayValue(payment.plan_name)}
|
||||
<DisplayValue value={payment.plan_name} />
|
||||
</TableCell>
|
||||
<TableCell className="text-sm text-grayScale-700">
|
||||
{formatMoney(payment.amount, payment.currency)}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user