Refactor BSC Score to Astro, TypeScript, and modular architecture
This commit is contained in:
46
src/components/screens/GameDetailScreen.tsx
Normal file
46
src/components/screens/GameDetailScreen.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import { h } from 'preact';
|
||||
import { Screen } from '../ui/Layout';
|
||||
import GameDetail from '../GameDetail';
|
||||
import type { Game, EndlosGame } from '../../types/game';
|
||||
|
||||
interface GameDetailScreenProps {
|
||||
game?: Game;
|
||||
onUpdateScore: (player: number, change: number) => void;
|
||||
onFinishGame: () => void;
|
||||
onUpdateGame: (game: EndlosGame) => void;
|
||||
onUndo: () => void;
|
||||
onForfeit: () => void;
|
||||
onBack: () => void;
|
||||
}
|
||||
|
||||
export default function GameDetailScreen({
|
||||
game,
|
||||
onUpdateScore,
|
||||
onFinishGame,
|
||||
onUpdateGame,
|
||||
onUndo,
|
||||
onForfeit,
|
||||
onBack,
|
||||
}: GameDetailScreenProps) {
|
||||
if (!game) {
|
||||
return (
|
||||
<Screen>
|
||||
<div>Game not found</div>
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<Screen>
|
||||
<GameDetail
|
||||
game={game}
|
||||
onUpdateScore={onUpdateScore}
|
||||
onFinishGame={onFinishGame}
|
||||
onUpdateGame={onUpdateGame}
|
||||
onUndo={onUndo}
|
||||
onForfeit={onForfeit}
|
||||
onBack={onBack}
|
||||
/>
|
||||
</Screen>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user