Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/app/grid-lite/grid-lite-data.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,21 @@ export type User = {
export class GridLiteDataService {
private counter = 0;

private firstNames = ['John', 'Jane', 'Bob', 'Alice', 'Charlie', 'Diana', 'Eve', 'Frank', 'Grace', 'Henry',
'Ivy', 'Jack', 'Kate', 'Liam', 'Mia', 'Noah', 'Olivia', 'Peter', 'Quinn', 'Rachel'];
private maleFirstNames = ['John', 'Bob', 'Charlie', 'Frank', 'Henry', 'Jack', 'Liam', 'Noah', 'Peter'];
private femaleFirstNames = ['Jane', 'Alice', 'Diana', 'Eve', 'Grace', 'Ivy', 'Kate', 'Mia', 'Olivia', 'Quinn', 'Rachel'];
private lastNames = ['Smith', 'Johnson', 'Williams', 'Brown', 'Jones', 'Garcia', 'Miller', 'Davis',
'Rodriguez', 'Martinez', 'Wilson', 'Anderson', 'Taylor', 'Thomas', 'Moore', 'Jackson', 'White', 'Harris'];
private productNames = ['Widget', 'Gadget', 'Doohickey', 'Thingamajig', 'Gizmo', 'Contraption',
'Device', 'Tool', 'Apparatus', 'Instrument', 'Machine', 'Equipment'];
private priorities: ('Low' | 'Standard' | 'High')[] = ['Low', 'Standard', 'High'];

private randomFirstName(): { name: string; gender: 'men' | 'women' } {
const isMale = this.randomBoolean();
return isMale
? { name: this.randomElement(this.maleFirstNames), gender: 'men' }
: { name: this.randomElement(this.femaleFirstNames), gender: 'women' };
}

private randomInt(min: number, max: number): number {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
Expand Down Expand Up @@ -86,7 +93,7 @@ export class GridLiteDataService {
}

createUserSimple(): UserSimple {
const firstName = this.randomElement(this.firstNames);
const { name: firstName } = this.randomFirstName();
const lastName = this.randomElement(this.lastNames);
return {
id: this.generateId(),
Expand All @@ -97,7 +104,7 @@ export class GridLiteDataService {
}

createUser(): User {
const firstName = this.randomElement(this.firstNames);
const { name: firstName, gender } = this.randomFirstName();
const lastName = this.randomElement(this.lastNames);
const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@example.com`;

Expand All @@ -107,7 +114,7 @@ export class GridLiteDataService {
lastName,
age: this.randomInt(18, 90),
email,
avatar: `https://i.pravatar.cc/150?img=${this.randomInt(1, 70)}`,
avatar: `assets/images/${gender}/${this.randomInt(1, 70)}.jpg`,
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The avatar path generates random image numbers from 1 to 70, but there's no guarantee that all 70 images exist in the assets for both genders. This could result in broken image references. Consider defining the actual available image ranges for each gender or validating that the images exist.

Copilot uses AI. Check for mistakes.
active: this.randomBoolean(),
priority: this.randomElement(this.priorities),
satisfaction: this.randomInt(0, 5),
Expand Down