website cleanup
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import Card from '@/components/ui/Card';
|
||||
import Button from '@/components/ui/Button';
|
||||
import Image from 'next/image';
|
||||
import type { FeedItemDTO } from '@core/social/application/dto/FeedItemDTO';
|
||||
import type { DashboardFeedItemSummaryViewModel } from '@/lib/view-models/DashboardOverviewViewModel';
|
||||
|
||||
function timeAgo(timestamp: Date | string): string {
|
||||
const date = typeof timestamp === 'string' ? new Date(timestamp) : timestamp;
|
||||
@@ -16,32 +16,14 @@ function timeAgo(timestamp: Date | string): string {
|
||||
return `${diffDays} d ago`;
|
||||
}
|
||||
|
||||
async function resolveActor(item: FeedItemDTO) {
|
||||
const driverRepo = getDriverRepository();
|
||||
const imageService = getImageService();
|
||||
|
||||
const actorId = item.actorFriendId ?? item.actorDriverId;
|
||||
if (!actorId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const driver = await driverRepo.findById(actorId);
|
||||
if (driver) {
|
||||
return {
|
||||
name: driver.name,
|
||||
avatarUrl: imageService.getDriverAvatar(driver.id),
|
||||
};
|
||||
}
|
||||
} catch {
|
||||
// ignore and fall through to generic rendering
|
||||
}
|
||||
|
||||
async function resolveActor(_item: DashboardFeedItemSummaryViewModel) {
|
||||
// Actor resolution is not wired through the API in this build.
|
||||
// Keep rendering deterministic and decoupled (no core repos).
|
||||
return null;
|
||||
}
|
||||
|
||||
interface FeedItemCardProps {
|
||||
item: FeedItemDTO;
|
||||
item: DashboardFeedItemSummaryViewModel;
|
||||
}
|
||||
|
||||
export default function FeedItemCard({ item }: FeedItemCardProps) {
|
||||
@@ -110,4 +92,4 @@ export default function FeedItemCard({ item }: FeedItemCardProps) {
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
import Card from '@/components/ui/Card';
|
||||
import type { FeedItemDTO } from '@core/social/application/dto/FeedItemDTO';
|
||||
import type { Race } from '@core/racing/domain/entities/Race';
|
||||
import type { RaceWithResultsDTO } from '@core/testing-support';
|
||||
import type { DashboardFeedItemSummaryViewModel } from '@/lib/view-models/DashboardOverviewViewModel';
|
||||
import FeedList from '@/components/feed/FeedList';
|
||||
import UpcomingRacesSidebar from '@/components/races/UpcomingRacesSidebar';
|
||||
import LatestResultsSidebar from '@/components/races/LatestResultsSidebar';
|
||||
|
||||
type FeedUpcomingRace = {
|
||||
id: string;
|
||||
track: string;
|
||||
car: string;
|
||||
scheduledAt: string | Date;
|
||||
};
|
||||
|
||||
type FeedLatestResult = {
|
||||
raceId: string;
|
||||
track: string;
|
||||
car: string;
|
||||
winnerName: string;
|
||||
scheduledAt: string | Date;
|
||||
};
|
||||
|
||||
interface FeedLayoutProps {
|
||||
feedItems: FeedItemDTO[];
|
||||
upcomingRaces: Race[];
|
||||
latestResults: RaceWithResultsDTO[];
|
||||
feedItems: DashboardFeedItemSummaryViewModel[];
|
||||
upcomingRaces: FeedUpcomingRace[];
|
||||
latestResults: FeedLatestResult[];
|
||||
}
|
||||
|
||||
export default function FeedLayout({
|
||||
@@ -40,4 +53,4 @@ export default function FeedLayout({
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import FeedEmptyState from '@/components/feed/FeedEmptyState';
|
||||
import FeedItemCard from '@/components/feed/FeedItemCard';
|
||||
import type { FeedItemDTO } from '@core/social/application/dto/FeedItemDTO';
|
||||
import type { DashboardFeedItemSummaryViewModel } from '@/lib/view-models/DashboardOverviewViewModel';
|
||||
|
||||
interface FeedListProps {
|
||||
items: FeedItemDTO[];
|
||||
items: DashboardFeedItemSummaryViewModel[];
|
||||
}
|
||||
|
||||
export default function FeedList({ items }: FeedListProps) {
|
||||
@@ -18,4 +18,4 @@ export default function FeedList({ items }: FeedListProps) {
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user