website refactor
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
import type { ProfileLeaguesPageDto } from '@/lib/page-queries/page-queries/ProfileLeaguesPageQuery';
|
||||
import type { ProfileLeaguesViewData } from '@/lib/view-data/ProfileLeaguesViewData';
|
||||
|
||||
/**
|
||||
* Presenter for Profile Leagues page
|
||||
* Pure mapping from Page DTO to ViewData
|
||||
*/
|
||||
export class ProfileLeaguesPresenter {
|
||||
static toViewData(pageDto: ProfileLeaguesPageDto): ProfileLeaguesViewData {
|
||||
return {
|
||||
ownedLeagues: pageDto.ownedLeagues.map(league => ({
|
||||
leagueId: league.leagueId,
|
||||
name: league.name,
|
||||
description: league.description,
|
||||
membershipRole: league.membershipRole,
|
||||
})),
|
||||
memberLeagues: pageDto.memberLeagues.map(league => ({
|
||||
leagueId: league.leagueId,
|
||||
name: league.name,
|
||||
description: league.description,
|
||||
membershipRole: league.membershipRole,
|
||||
})),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import type { TeamsPageDto } from '@/lib/page-queries/page-queries/TeamsPageQuery';
|
||||
import type { TeamsViewData, TeamSummaryData } from '@/templates/TeamsViewData';
|
||||
|
||||
/**
|
||||
* TeamsPresenter - Client-side presenter for teams page
|
||||
* Transforms PageQuery DTO into ViewData for the template
|
||||
* Deterministic; no hooks; no side effects
|
||||
*/
|
||||
export class TeamsPresenter {
|
||||
static createViewData(pageDto: TeamsPageDto): TeamsViewData {
|
||||
const teams = pageDto.teams.map((team): TeamSummaryData => ({
|
||||
teamId: team.id,
|
||||
teamName: team.name,
|
||||
leagueName: team.leagues[0] || '',
|
||||
memberCount: team.memberCount,
|
||||
logoUrl: team.logoUrl,
|
||||
}));
|
||||
|
||||
return { teams };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user