website cleanup
This commit is contained in:
@@ -16,6 +16,24 @@ export class SessionViewModel {
|
||||
driverId?: string;
|
||||
isAuthenticated: boolean = true;
|
||||
|
||||
/**
|
||||
* Compatibility accessor.
|
||||
* Some legacy components expect `session.user.*`.
|
||||
*/
|
||||
get user(): {
|
||||
userId: string;
|
||||
email: string;
|
||||
displayName: string;
|
||||
primaryDriverId?: string | null;
|
||||
} {
|
||||
return {
|
||||
userId: this.userId,
|
||||
email: this.email,
|
||||
displayName: this.displayName,
|
||||
primaryDriverId: this.driverId ?? null,
|
||||
};
|
||||
}
|
||||
|
||||
/** UI-specific: User greeting */
|
||||
get greeting(): string {
|
||||
return `Hello, ${this.displayName}!`;
|
||||
@@ -26,7 +44,7 @@ export class SessionViewModel {
|
||||
if (this.displayName) {
|
||||
return this.displayName.split(' ').map(n => n[0]).join('').toUpperCase();
|
||||
}
|
||||
return this.email[0].toUpperCase();
|
||||
return (this.email?.[0] ?? '?').toUpperCase();
|
||||
}
|
||||
|
||||
/** UI-specific: Whether has driver profile */
|
||||
@@ -38,4 +56,4 @@ export class SessionViewModel {
|
||||
get authStatusDisplay(): string {
|
||||
return this.isAuthenticated ? 'Logged In' : 'Logged Out';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user