feat: add authenticated settings page.

This commit is contained in:
liqupan
2026-02-02 20:12:19 +08:00
parent cb3e16cd16
commit 6c32d845a7
259 changed files with 24685 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
import { Shield, UserCheck, Users, CreditCard } from 'lucide-react'
import { type UserStatus } from './schema'
export const callTypes = new Map<UserStatus, string>([
['active', 'bg-teal-100/30 text-teal-900 dark:text-teal-200 border-teal-200'],
['inactive', 'bg-neutral-300/40 border-neutral-300'],
['invited', 'bg-sky-200/40 text-sky-900 dark:text-sky-100 border-sky-300'],
[
'suspended',
'bg-destructive/10 dark:bg-destructive/50 text-destructive dark:text-primary border-destructive/10',
],
])
export const roles = [
{
label: 'Superadmin',
value: 'superadmin',
icon: Shield,
},
{
label: 'Admin',
value: 'admin',
icon: UserCheck,
},
{
label: 'Manager',
value: 'manager',
icon: Users,
},
{
label: 'Cashier',
value: 'cashier',
icon: CreditCard,
},
] as const

View File

@@ -0,0 +1,32 @@
import { z } from 'zod'
const userStatusSchema = z.union([
z.literal('active'),
z.literal('inactive'),
z.literal('invited'),
z.literal('suspended'),
])
export type UserStatus = z.infer<typeof userStatusSchema>
const userRoleSchema = z.union([
z.literal('superadmin'),
z.literal('admin'),
z.literal('cashier'),
z.literal('manager'),
])
const userSchema = z.object({
id: z.string(),
firstName: z.string(),
lastName: z.string(),
username: z.string(),
email: z.string(),
phoneNumber: z.string(),
status: userStatusSchema,
role: userRoleSchema,
createdAt: z.coerce.date(),
updatedAt: z.coerce.date(),
})
export type User = z.infer<typeof userSchema>
export const userListSchema = z.array(userSchema)

View File

@@ -0,0 +1,33 @@
import { faker } from '@faker-js/faker'
// Set a fixed seed for consistent data generation
faker.seed(67890)
export const users = Array.from({ length: 500 }, () => {
const firstName = faker.person.firstName()
const lastName = faker.person.lastName()
return {
id: faker.string.uuid(),
firstName,
lastName,
username: faker.internet
.username({ firstName, lastName })
.toLocaleLowerCase(),
email: faker.internet.email({ firstName }).toLocaleLowerCase(),
phoneNumber: faker.phone.number({ style: 'international' }),
status: faker.helpers.arrayElement([
'active',
'inactive',
'invited',
'suspended',
]),
role: faker.helpers.arrayElement([
'superadmin',
'admin',
'cashier',
'manager',
]),
createdAt: faker.date.past(),
updatedAt: faker.date.recent(),
}
})