website refactor
This commit is contained in:
@@ -64,7 +64,7 @@ type LeagueWizardFormData = {
|
||||
raceTimeUtc?: string;
|
||||
};
|
||||
stewarding: {
|
||||
decisionMode: 'owner_only' | 'admin_vote' | 'steward_panel';
|
||||
decisionMode: 'owner_only' | 'admin_vote' | 'steward_panel' | 'admin_only' | 'single_steward' | 'committee_vote' | 'steward_vote';
|
||||
requiredVotes?: number;
|
||||
requireDefense: boolean;
|
||||
defenseTimeLimit: number;
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/**
|
||||
* RaceScheduleCommandModel
|
||||
*
|
||||
* UX-only model for managing race creation/editing state.
|
||||
*/
|
||||
|
||||
export interface RaceScheduleFormData {
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAtIso: string;
|
||||
}
|
||||
|
||||
export interface RaceScheduleValidationErrors {
|
||||
track?: string;
|
||||
car?: string;
|
||||
scheduledAtIso?: string;
|
||||
}
|
||||
|
||||
export class RaceScheduleCommandModel {
|
||||
private _track: string;
|
||||
private _car: string;
|
||||
private _scheduledAtIso: string;
|
||||
|
||||
constructor(initial: Partial<RaceScheduleFormData> = {}) {
|
||||
this._track = initial.track || '';
|
||||
this._car = initial.car || '';
|
||||
this._scheduledAtIso = initial.scheduledAtIso || '';
|
||||
}
|
||||
|
||||
get track(): string { return this._track; }
|
||||
set track(value: string) { this._track = value; }
|
||||
|
||||
get car(): string { return this._car; }
|
||||
set car(value: string) { this._car = value; }
|
||||
|
||||
get scheduledAtIso(): string { return this._scheduledAtIso; }
|
||||
set scheduledAtIso(value: string) { this._scheduledAtIso = value; }
|
||||
|
||||
validate(): RaceScheduleValidationErrors {
|
||||
const errors: RaceScheduleValidationErrors = {};
|
||||
if (!this._track.trim()) errors.track = 'Track is required';
|
||||
if (!this._car.trim()) errors.car = 'Car is required';
|
||||
if (!this._scheduledAtIso) errors.scheduledAtIso = 'Date and time are required';
|
||||
return errors;
|
||||
}
|
||||
|
||||
toCommand(): { track: string; car: string; scheduledAtIso: string } {
|
||||
return {
|
||||
track: this._track,
|
||||
car: this._car,
|
||||
scheduledAtIso: this._scheduledAtIso,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* SponsorSignupCommandModel
|
||||
*
|
||||
* UX-only model for managing sponsor signup state.
|
||||
*/
|
||||
|
||||
export interface SponsorSignupFormData {
|
||||
companyName: string;
|
||||
contactEmail: string;
|
||||
websiteUrl?: string;
|
||||
industry?: string;
|
||||
}
|
||||
|
||||
export interface SponsorSignupValidationErrors {
|
||||
companyName?: string;
|
||||
contactEmail?: string;
|
||||
websiteUrl?: string;
|
||||
}
|
||||
|
||||
export class SponsorSignupCommandModel {
|
||||
private _companyName: string;
|
||||
private _contactEmail: string;
|
||||
private _websiteUrl: string;
|
||||
private _industry: string;
|
||||
|
||||
constructor(initial: Partial<SponsorSignupFormData> = {}) {
|
||||
this._companyName = initial.companyName || '';
|
||||
this._contactEmail = initial.contactEmail || '';
|
||||
this._websiteUrl = initial.websiteUrl || '';
|
||||
this._industry = initial.industry || '';
|
||||
}
|
||||
|
||||
get companyName(): string { return this._companyName; }
|
||||
set companyName(value: string) { this._companyName = value; }
|
||||
|
||||
get contactEmail(): string { return this._contactEmail; }
|
||||
set contactEmail(value: string) { this._contactEmail = value; }
|
||||
|
||||
get websiteUrl(): string { return this._websiteUrl; }
|
||||
set websiteUrl(value: string) { this._websiteUrl = value; }
|
||||
|
||||
get industry(): string { return this._industry; }
|
||||
set industry(value: string) { this._industry = value; }
|
||||
|
||||
validate(): SponsorSignupValidationErrors {
|
||||
const errors: SponsorSignupValidationErrors = {};
|
||||
if (!this._companyName.trim()) errors.companyName = 'Company name is required';
|
||||
if (!this._contactEmail.trim()) {
|
||||
errors.contactEmail = 'Contact email is required';
|
||||
} else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this._contactEmail)) {
|
||||
errors.contactEmail = 'Invalid email format';
|
||||
}
|
||||
if (this._websiteUrl && !this._websiteUrl.startsWith('http')) {
|
||||
errors.websiteUrl = 'Website URL must start with http:// or https://';
|
||||
}
|
||||
return errors;
|
||||
}
|
||||
|
||||
toCommand(): SponsorSignupFormData {
|
||||
return {
|
||||
companyName: this._companyName,
|
||||
contactEmail: this._contactEmail,
|
||||
websiteUrl: this._websiteUrl,
|
||||
industry: this._industry,
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user