31 lines
1.5 KiB
TypeScript
31 lines
1.5 KiB
TypeScript
// Local sample data for the pattern Stories (no network).
|
|
export type SampleUser = {
|
|
id: string
|
|
name: string
|
|
department: string
|
|
status: "active" | "pending" | "inactive"
|
|
createdAt: string // ISO date
|
|
}
|
|
|
|
export const statusLabel: Record<SampleUser["status"], string> = { active: "활성", pending: "대기", inactive: "비활성" }
|
|
|
|
const names = ["김민수", "이서연", "박지훈", "최유진", "정하늘", "강도현", "조수빈", "윤재민", "임나래", "한지우", "오세준", "서하은"]
|
|
const departments = ["설계팀", "시공팀", "안전관리팀", "품질팀", "경영지원팀"]
|
|
const statuses: SampleUser["status"][] = ["active", "active", "pending", "inactive"]
|
|
|
|
// 47 rows: more than two pages at 20 per page, with dates spread over October 2026.
|
|
export const sampleUsers: SampleUser[] = Array.from({ length: 47 }, (_, i) => ({
|
|
id: `U-${String(i + 1).padStart(3, "0")}`,
|
|
name: `${names[i % names.length]}${i >= names.length ? ` ${Math.floor(i / names.length) + 1}` : ""}`,
|
|
department: departments[(i * 3) % departments.length],
|
|
status: statuses[(i * 5) % statuses.length],
|
|
createdAt: new Date(2026, 9, 1 + (i % 28)).toISOString(),
|
|
}))
|
|
|
|
export const formatDate = (iso: string) => new Intl.DateTimeFormat("ko-KR", { year: "numeric", month: "2-digit", day: "2-digit" }).format(new Date(iso))
|
|
|
|
export const sameDay = (iso: string, date: Date) => {
|
|
const d = new Date(iso)
|
|
return d.getFullYear() === date.getFullYear() && d.getMonth() === date.getMonth() && d.getDate() === date.getDate()
|
|
}
|