Files
gridpilot.gg/apps/website/lib/view-models/RecordPageViewInputViewModel.ts
2026-01-23 15:30:23 +01:00

28 lines
770 B
TypeScript

/**
* Record page view input view model
* Represents input data for recording a page view
*/
import { ViewModel } from "../contracts/view-models/ViewModel";
import type { RecordPageViewInputViewData } from "../view-data/RecordPageViewInputViewData";
export class RecordPageViewInputViewModel extends ViewModel {
path: string;
userId?: string;
constructor(data: RecordPageViewInputViewData) {
super();
this.path = data.path;
this.userId = data.userId;
}
/** UI-specific: Formatted path for display */
get displayPath(): string {
return this.path.startsWith('/') ? this.path : `/${this.path}`;
}
/** UI-specific: Has user context */
get hasUserContext(): boolean {
return this.userId !== undefined && this.userId !== '';
}
}