|
1 | | -/** |
2 | | - * Génère un tableau d'utilisateurs factices pour le mode démo. |
3 | | - */ |
4 | | - |
5 | | -const firstNames = [ |
6 | | - "Emma", "Noah", "Liam", "Olivia", "Ava", "Sophia", "Mia", "Isabella", |
7 | | - "Lucas", "Ethan", "James", "Amelia", "Charlotte", "Benjamin", "Logan", |
8 | | - "Harper", "Daniel", "Chloe", "Jackson", "Evelyn" |
9 | | -] |
10 | | - |
11 | | -const lastNames = [ |
12 | | - "Smith", "Johnson", "Brown", "Taylor", "Anderson", "Thomas", "Jackson", |
13 | | - "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Lee" |
14 | | -] |
15 | | - |
16 | | -const roles = ["Admin", "Editor", "Viewer"] |
17 | | -const statuses = ["Active", "Pending", "Suspended"] |
18 | | - |
19 | | -function random<T>(arr: T[]): T { |
20 | | - return arr[Math.floor(Math.random() * arr.length)] |
| 1 | +export type User = { |
| 2 | + id: number |
| 3 | + name: string |
| 4 | + email: string |
| 5 | + role: string |
| 6 | + status: "Active" | "Disabled" |
21 | 7 | } |
22 | 8 |
|
23 | | -export function generateDemoUsers(count = 25) { |
24 | | - const users = [] |
25 | | - |
26 | | - for (let i = 1; i <= count; i++) { |
27 | | - const first = random(firstNames) |
28 | | - const last = random(lastNames) |
29 | | - const name = `${first} ${last}` |
30 | | - const email = `${first.toLowerCase()}.${last.toLowerCase()}@example.com` |
31 | | - |
32 | | - users.push({ |
33 | | - id: i, |
34 | | - name, |
35 | | - email, |
36 | | - role: random(roles), |
37 | | - status: random(statuses), |
38 | | - }) |
39 | | - } |
40 | | - |
41 | | - return users |
42 | | -} |
| 9 | +export const demoUsers: User[] = [ |
| 10 | + { |
| 11 | + id: 1, |
| 12 | + name: "Emma Smith", |
| 13 | + email: "emma.smith@example.com", |
| 14 | + role: "Admin", |
| 15 | + status: "Active", |
| 16 | + }, |
| 17 | + { |
| 18 | + id: 2, |
| 19 | + name: "Liam Johnson", |
| 20 | + email: "liam.johnson@example.com", |
| 21 | + role: "Editor", |
| 22 | + status: "Disabled", |
| 23 | + }, |
| 24 | + { |
| 25 | + id: 3, |
| 26 | + name: "Olivia Brown", |
| 27 | + email: "olivia.brown@example.com", |
| 28 | + role: "Viewer", |
| 29 | + status: "Active", |
| 30 | + }, |
| 31 | + { |
| 32 | + id: 4, |
| 33 | + name: "Noah Taylor", |
| 34 | + email: "noah.taylor@example.com", |
| 35 | + role: "Editor", |
| 36 | + status: "Active", |
| 37 | + }, |
| 38 | + { |
| 39 | + id: 5, |
| 40 | + name: "Ava Anderson", |
| 41 | + email: "ava.anderson@example.com", |
| 42 | + role: "Viewer", |
| 43 | + status: "Disabled", |
| 44 | + }, |
| 45 | +] |
0 commit comments