Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions domains/games/apps/1d4_web/src/__tests__/GameDetailPanel.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,6 @@ const mockGame: GameRow = {
playedAt: 1700000000,
indexedAt: 1700001000,
numMoves: 4,
hasPin: false,
hasCrossPin: false,
hasFork: true,
hasSkewer: false,
hasDiscoveredAttack: false,
hasDiscoveredCheck: false,
hasCheck: false,
hasCheckmate: false,
hasPromotion: false,
hasPromotionWithCheck: false,
hasPromotionWithCheckmate: false,

hasDoubleCheck: false,
hasBackRankMate: false,
hasSmotheredMate: false,
hasOverloadedPiece: false,
hasZugzwang: false,
pgn: TEST_PGN,
occurrences: { fork: [forkOccurrence] },
};
Expand Down
39 changes: 5 additions & 34 deletions domains/games/apps/1d4_web/src/__tests__/GameTable.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,7 @@ const mockGames: GameRow[] = [
playedAt: 1700000000,
indexedAt: 1700001000,
numMoves: 40,
hasPin: true,
hasCrossPin: false,
hasFork: false,
hasSkewer: false,
hasDiscoveredAttack: false,
hasDiscoveredCheck: false,
hasCheck: false,
hasCheckmate: false,
hasPromotion: false,
hasPromotionWithCheck: false,
hasPromotionWithCheckmate: false,

hasDoubleCheck: false,
hasBackRankMate: false,
hasSmotheredMate: false,
hasOverloadedPiece: false,
hasZugzwang: false,
occurrences: { pin: [{ gameUrl: 'https://chess.com/game/1', motif: 'pin', moveNumber: 15, side: 'white', description: 'Pin' }] },
},
{
gameUrl: 'https://chess.com/game/2',
Expand All @@ -48,23 +32,10 @@ const mockGames: GameRow[] = [
playedAt: 1700100000,
indexedAt: 1700101000,
numMoves: 55,
hasPin: false,
hasCrossPin: false,
hasFork: true,
hasSkewer: false,
hasDiscoveredAttack: false,
hasDiscoveredCheck: false,
hasCheck: false,
hasCheckmate: true,
hasPromotion: false,
hasPromotionWithCheck: false,
hasPromotionWithCheckmate: false,

hasDoubleCheck: false,
hasBackRankMate: false,
hasSmotheredMate: false,
hasOverloadedPiece: false,
hasZugzwang: false,
occurrences: {
fork: [{ gameUrl: 'https://chess.com/game/2', motif: 'fork', moveNumber: 20, side: 'white', description: 'Fork' }],
checkmate: [{ gameUrl: 'https://chess.com/game/2', motif: 'checkmate', moveNumber: 55, side: 'white', description: 'Checkmate' }],
},
},
];

Expand Down
18 changes: 1 addition & 17 deletions domains/games/apps/1d4_web/src/__tests__/GamesView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,7 @@ const mockGame: GameRow = {
playedAt: 1700000000,
indexedAt: 1700001000,
numMoves: 30,
hasPin: false,
hasCrossPin: false,
hasFork: true,
hasSkewer: false,
hasDiscoveredAttack: false,
hasDiscoveredCheck: false,
hasCheck: false,
hasCheckmate: false,
hasPromotion: false,
hasPromotionWithCheck: false,
hasPromotionWithCheckmate: false,

hasDoubleCheck: false,
hasBackRankMate: false,
hasSmotheredMate: false,
hasOverloadedPiece: false,
hasZugzwang: false,
occurrences: { fork: [{ gameUrl: 'https://chess.com/game/99', motif: 'fork', moveNumber: 10, side: 'white', description: 'Fork' }] },
};

function makeWrapper() {
Expand Down
17 changes: 0 additions & 17 deletions domains/games/apps/1d4_web/src/__tests__/QueryView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,6 @@ const mockGame: GameRow = {
playedAt: 1700000000,
indexedAt: 1700001000,
numMoves: 40,
hasPin: false,
hasCrossPin: false,
hasFork: true,
hasSkewer: false,
hasDiscoveredAttack: false,
hasDiscoveredCheck: false,
hasCheck: false,
hasCheckmate: false,
hasPromotion: false,
hasPromotionWithCheck: false,
hasPromotionWithCheckmate: false,

hasDoubleCheck: false,
hasBackRankMate: false,
hasSmotheredMate: false,
hasOverloadedPiece: false,
hasZugzwang: false,
};

function makeWrapper() {
Expand Down
20 changes: 1 addition & 19 deletions domains/games/apps/1d4_web/src/components/GameTable.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
import type { GameRow } from '../types';
import MotifBadge from './MotifBadge';

const MOTIF_KEYS: [keyof GameRow, string][] = [
['hasDiscoveredAttack', 'discovered_attack'],
['hasDiscoveredCheck', 'discovered_check'],
['hasFork', 'fork'],
['hasPin', 'pin'],
['hasCrossPin', 'cross_pin'],
['hasSkewer', 'skewer'],
['hasCheck', 'check'],
['hasCheckmate', 'checkmate'],
['hasDoubleCheck', 'double_check'],
['hasBackRankMate', 'back_rank_mate'],
['hasSmotheredMate', 'smothered_mate'],
['hasPromotion', 'promotion'],
['hasPromotionWithCheck', 'promotion_with_check'],
['hasPromotionWithCheckmate', 'promotion_with_checkmate'],
['hasOverloadedPiece', 'overloaded_piece'],
['hasZugzwang', 'zugzwang'],
];

const COLUMNS = [
{ id: 'gameUrl', label: 'Game', sort: false },
Expand Down Expand Up @@ -68,7 +50,7 @@ function renderCell(
case 'motifs':
return (
<span className="motifs">
{MOTIF_KEYS.filter(([key]) => game[key]).map(([, label]) => (
{Object.keys(game.occurrences ?? {}).map((label) => (
<MotifBadge
key={label}
label={label}
Expand Down
16 changes: 0 additions & 16 deletions domains/games/apps/1d4_web/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@ export interface GameRow {
playedAt: string | number;
indexedAt: string | number;
numMoves: number;
hasPin: boolean;
hasCrossPin: boolean;
hasFork: boolean;
hasSkewer: boolean;
hasDiscoveredAttack: boolean;
hasDiscoveredCheck: boolean;
hasCheck: boolean;
hasCheckmate: boolean;
hasDoubleCheck: boolean;
hasBackRankMate: boolean;
hasSmotheredMate: boolean;
hasPromotion: boolean;
hasPromotionWithCheck: boolean;
hasPromotionWithCheckmate: boolean;
hasOverloadedPiece: boolean;
hasZugzwang: boolean;
pgn?: string;
occurrences?: Record<string, OccurrenceRow[]>;
}
Expand Down
Loading