From c1eb96dd4a1fc49e0f02098cb4ab98f1668a65df Mon Sep 17 00:00:00 2001 From: cophilot Date: Sat, 28 Sep 2024 11:20:41 +0200 Subject: [PATCH] update: Sat 28 Sep 2024 11:20:41 CEST --- package.json | 2 +- src/api/BoardScorePage/BoardScorePage.tsx | 2 +- src/api/BoardScoreTable/BoardScoreTable.tsx | 5 +++-- src/api/ExtensionButtons/ExtensionButtons.tsx | 9 ++++++--- src/api/types/GameDef.ts | 4 +++- src/components/GameView.tsx | 4 ++-- src/games/calico/definition.ts | 5 ++++- src/games/dorfromatik-duel/definition.ts | 4 ++-- src/games/everdell/definition.ts | 3 ++- src/games/forest-shuffle/definition.ts | 7 ++++++- src/games/harmonies/definition.ts | 6 +++++- src/games/lets-go-to-japan/definition.ts | 6 +++++- src/games/scout/definition.ts | 6 +++++- src/games/sea-salt-paper/definition.ts | 3 +++ src/games/seven-wonders-duel/definition.ts | 6 ++++-- src/games/terraforming-mars/definition.ts | 7 +++++-- src/games/wingspan/definition.ts | 3 ++- src/games/wizard/definition.ts | 3 ++- src/providers/ThemeProvider.tsx | 3 ++- src/views/HomeView.tsx | 2 +- 20 files changed, 64 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index e126b90..357ddcd 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "dev": "vite", "start": "vite --open --host", - "build": "tsc -b && vite build", + "build": "pnpm run lint && tsc -b && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview", "format": "prettier --write . --ignore-path .prettierignore" diff --git a/src/api/BoardScorePage/BoardScorePage.tsx b/src/api/BoardScorePage/BoardScorePage.tsx index 115b8bd..5b25f49 100644 --- a/src/api/BoardScorePage/BoardScorePage.tsx +++ b/src/api/BoardScorePage/BoardScorePage.tsx @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any */ // TODO import './BoardScorePage.scss'; import { useEffect, useState } from 'react'; import PlayerSwitch from '../PlayerSwitch/PlayerSwitch'; diff --git a/src/api/BoardScoreTable/BoardScoreTable.tsx b/src/api/BoardScoreTable/BoardScoreTable.tsx index 3434e58..cc2d1fd 100644 --- a/src/api/BoardScoreTable/BoardScoreTable.tsx +++ b/src/api/BoardScoreTable/BoardScoreTable.tsx @@ -1,12 +1,13 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-explicit-any */ // TODO import { useEffect, useState } from 'react'; import './BoardScoreTable.scss'; import GameStorage from '../utils/GameStorage'; import { getFunctionForWinMode, WinMode } from '../types/WinMode'; import ExtensionButtons from '../ExtensionButtons/ExtensionButtons'; +import { GameDef } from '../types/GameDef'; interface BoardScoreTableProps { - definition: any; + definition: GameDef; playerSize: number; gameSettings: any; onCellChange?: (rowIndex: number, playerIndex: number, value: any) => void; diff --git a/src/api/ExtensionButtons/ExtensionButtons.tsx b/src/api/ExtensionButtons/ExtensionButtons.tsx index 0a99ab7..1610907 100644 --- a/src/api/ExtensionButtons/ExtensionButtons.tsx +++ b/src/api/ExtensionButtons/ExtensionButtons.tsx @@ -1,11 +1,14 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import { useEffect, useState } from 'react'; import './ExtensionButtons.scss'; import GameStorage from '../utils/GameStorage'; +import { ExtensionDef, GameDef } from '../types/GameDef'; interface ExtensionButtonsProps { - definition: any; - onExtensionOn?: (extensionName: string, extensionDefinition: any) => void; + definition: GameDef; + onExtensionOn?: ( + extensionName: string, + extensionDefinition: ExtensionDef, + ) => void; onExtensionOff?: (extensionName: string) => void; } diff --git a/src/api/types/GameDef.ts b/src/api/types/GameDef.ts index e556c9b..0551e58 100644 --- a/src/api/types/GameDef.ts +++ b/src/api/types/GameDef.ts @@ -1,3 +1,5 @@ +import { WinMode } from './WinMode'; + export interface GameDef { title: string; // The name of the game playerSizes: number[]; // An array of all possible player counts @@ -10,7 +12,7 @@ export interface GameDef { fontFamily?: string; // The font family to be used url?: string; // The URL to the game rulesUrl?: string; // The URL to the rules - winMode?: string; // The winnning mode + winMode?: WinMode; // The winnning mode extensions?: { [name: string]: ExtensionDef }; // Specify Extensions roundMapper?: { [playerCount: number]: number }; // A mapping of player count to round count } diff --git a/src/components/GameView.tsx b/src/components/GameView.tsx index 54d10f3..20cf432 100644 --- a/src/components/GameView.tsx +++ b/src/components/GameView.tsx @@ -1,10 +1,10 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import BoardScorePage from '../api/BoardScorePage/BoardScorePage'; +import { GameDef } from '../api/types/GameDef'; import By from './By'; import Logo from './Logo'; interface GameViewProps { - definition: any; + definition: GameDef; afterTabelElement?: JSX.Element; } diff --git a/src/games/calico/definition.ts b/src/games/calico/definition.ts index c34a860..55e0f4d 100644 --- a/src/games/calico/definition.ts +++ b/src/games/calico/definition.ts @@ -5,11 +5,14 @@ import goalTileLeft from './assets/goal-tile-left.png'; import catTokens from './assets/cat-tokens.png'; import buttonTokens from './assets/button-tokens.png'; import FontUtils from '../../api/utils/FontUtils'; +import { GameDef } from '../../api/types/GameDef'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Calico', url: 'https://boardgamegeek.com/boardgame/283155/calico', + rulesUrl: + 'https://www.alderac.com/wp-content/uploads/2020/09/Calico-Rules.pdf', bgColor: '#fbf8f0', fontColor: '#000', primaryColor: '#142688', diff --git a/src/games/dorfromatik-duel/definition.ts b/src/games/dorfromatik-duel/definition.ts index 48b4329..817ca05 100644 --- a/src/games/dorfromatik-duel/definition.ts +++ b/src/games/dorfromatik-duel/definition.ts @@ -17,8 +17,8 @@ export default function getDefinition(): GameDef { return { title: 'Dorfromatik: Duel', url: 'https://boardgamegeek.com/boardgame/395364/dorfromantik-the-duel', - //bgColor: '#859395', - //fontColor: 'white', + rulesUrl: + 'https://pegasus.de/media/pdf/e9/7c/e3/4250231736070_Dorfromantik_Duel_Rules_EN_Web.pdf', primaryColor: '#7ba1d4', secondaryColor: '#ee776c', playerSizes: [2], diff --git a/src/games/everdell/definition.ts b/src/games/everdell/definition.ts index 2f66a09..b86de9a 100644 --- a/src/games/everdell/definition.ts +++ b/src/games/everdell/definition.ts @@ -11,6 +11,8 @@ import { GameDef } from '../../api/types/GameDef'; export default function getDefinition(): GameDef { return { title: 'Everdell', + url: 'https://boardgamegeek.com/boardgame/199792/everdell', + rulesUrl: 'https://cdn.1j1ju.com/medias/c6/cd/89-everdell-rulebook.pdf', bgColor: '#5c652e', fontColor: '#342a28', primaryColor: '#714839', @@ -19,7 +21,6 @@ export default function getDefinition(): GameDef { playerSizes: [1, 2, 3, 4], winMode: WinMode.MOST, stripeColor: '#4b5729', - rulesUrl: 'https://cdn.1j1ju.com/medias/c6/cd/89-everdell-rulebook.pdf', rows: [ { name: 'Cards in Village', diff --git a/src/games/forest-shuffle/definition.ts b/src/games/forest-shuffle/definition.ts index b5cd9af..7366ea4 100644 --- a/src/games/forest-shuffle/definition.ts +++ b/src/games/forest-shuffle/definition.ts @@ -5,9 +5,14 @@ import downIcon from './assets/down.png'; import leftIcon from './assets/left.png'; import rightIcon from './assets/right.png'; import caveIcon from './assets/cave.png'; -export default function getDefinition() { +import { GameDef } from '../../api/types/GameDef'; + +export default function getDefinition(): GameDef { return { title: 'Forest Shuffle', + url: 'https://boardgamegeek.com/boardgame/391163/forest-shuffle', + rulesUrl: + 'https://lookout-spiele.de/upload/en_forrestshuffle.html_Forest_Shuffle_175_Rules_EN_WEB_230516.pdf', bgColor: '#dce2c9', fontColor: '#315a39', primaryColor: '#bbad86', diff --git a/src/games/harmonies/definition.ts b/src/games/harmonies/definition.ts index 3be4c60..f60097d 100644 --- a/src/games/harmonies/definition.ts +++ b/src/games/harmonies/definition.ts @@ -6,10 +6,14 @@ import water from './assets/water.png'; import card from './assets/card.png'; import { WinMode } from '../../api/types/WinMode'; import FontUtils from '../../api/utils/FontUtils'; +import { GameDef } from '../../api/types/GameDef'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Harmonies', + url: 'https://boardgamegeek.com/boardgame/414317/harmonies', + rulesUrl: + 'https://cdn.svc.asmodee.net/production-libellud/uploads/2024/03/LIBELLUD_HARMONIES_RULES_EN-1.pdf', bgColor: '#deceac', fontColor: 'black', primaryColor: '#0094b8', diff --git a/src/games/lets-go-to-japan/definition.ts b/src/games/lets-go-to-japan/definition.ts index e73d596..eaf0a60 100644 --- a/src/games/lets-go-to-japan/definition.ts +++ b/src/games/lets-go-to-japan/definition.ts @@ -3,10 +3,14 @@ import moodIcon from './assets/mood.png'; import experienceIcon from './assets/experience.png'; import researchTokenIcon from './assets/research-tokens.png'; import trainsIcon from './assets/trains.png'; +import { GameDef } from '../../api/types/GameDef'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: "Let's Go! To Japan", + url: 'https://boardgamegeek.com/boardgame/368173/lets-go-to-japan', + rulesUrl: + 'https://www.alderac.com/wp-content/uploads/2023/03/LetsGoToJapan_Influencer_EN_1P_Rulebook_FINAL-copy.pdf', bgColor: '#f6f8f9', fontColor: '#000', primaryColor: '#59c4db', diff --git a/src/games/scout/definition.ts b/src/games/scout/definition.ts index 1bae09d..ec7cf7d 100644 --- a/src/games/scout/definition.ts +++ b/src/games/scout/definition.ts @@ -1,9 +1,13 @@ +import { GameDef } from '../../api/types/GameDef'; import { WinMode } from '../../api/types/WinMode'; import FontUtils from '../../api/utils/FontUtils'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Scout', + url: 'https://boardgamegeek.com/boardgame/291453/scout', + rulesUrl: + 'https://onemoregame.cloud-line.com/files/SCOUT!_v2.1_English_open.pdf', bgColor: '#FBD800', fontColor: '#4B0082', primaryColor: '#F08600', diff --git a/src/games/sea-salt-paper/definition.ts b/src/games/sea-salt-paper/definition.ts index 8a8a57b..bf2b465 100644 --- a/src/games/sea-salt-paper/definition.ts +++ b/src/games/sea-salt-paper/definition.ts @@ -15,6 +15,9 @@ import shell from './assets/shell.png'; export default function getDefinition(): GameDef { return { title: 'Sea Salt & Paper', + url: 'https://boardgamegeek.com/boardgame/367220/sea-salt-and-paper', + rulesUrl: + 'https://cdn.1j1ju.com/medias/a5/4b/bb-sea-salt-paper-rulebook.pdf', bgColor: '#124876', fontColor: '#fff', primaryColor: '#fff', diff --git a/src/games/seven-wonders-duel/definition.ts b/src/games/seven-wonders-duel/definition.ts index a52c296..f764329 100644 --- a/src/games/seven-wonders-duel/definition.ts +++ b/src/games/seven-wonders-duel/definition.ts @@ -8,12 +8,14 @@ import coins from './assets/coins.png'; import military from './assets/military.png'; import { WinMode } from '../../api/types/WinMode'; import FontUtils from '../../api/utils/FontUtils'; +import { GameDef } from '../../api/types/GameDef'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Seven Wonders: Duel', + url: 'https://boardgamegeek.com/boardgame/173346/7-wonders-duel', + rulesUrl: 'https://cdn.1j1ju.com/medias/1a/ba/6b-7-wonders-duel-rules.pdf', bgColor: '#fbdbb3', - //fontColor: '#000', primaryColor: '#c59551', secondaryColor: '#2a7c6d', playerSizes: [2], diff --git a/src/games/terraforming-mars/definition.ts b/src/games/terraforming-mars/definition.ts index cf777aa..e41d578 100644 --- a/src/games/terraforming-mars/definition.ts +++ b/src/games/terraforming-mars/definition.ts @@ -6,12 +6,15 @@ import treeIcon from './assets/tree.png'; import cityIcon from './assets/city.png'; import terraformingRatingIcon from './assets/terraforming-rating.png'; import victoryPointsIcon from './assets/victory-points.png'; +import { GameDef } from '../../api/types/GameDef'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Terraforming Mars', + url: 'https://boardgamegeek.com/boardgame/167791/terraforming-mars', + rulesUrl: + 'https://cdn.1j1ju.com/medias/13/3f/fb-terraforming-mars-rule.pdf', bgColor: '#a36743', - //fontColor: '#000', primaryColor: '#612720', secondaryColor: '#ffe048', fontFamily: FontUtils.FUTURISTIC, diff --git a/src/games/wingspan/definition.ts b/src/games/wingspan/definition.ts index a6212ad..cfbceac 100644 --- a/src/games/wingspan/definition.ts +++ b/src/games/wingspan/definition.ts @@ -7,8 +7,9 @@ import bonusIcon from './assets/bonus.png'; import tuckedCardIcon from './assets/tucked-card.png'; import birdIcon from './assets/bird.png'; import nectarIcon from './assets/nectar.png'; +import { GameDef } from '../../api/types/GameDef'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Wingspan', bgColor: '#f4f5f0', diff --git a/src/games/wizard/definition.ts b/src/games/wizard/definition.ts index 584bc42..4e99862 100644 --- a/src/games/wizard/definition.ts +++ b/src/games/wizard/definition.ts @@ -1,6 +1,7 @@ +import { GameDef } from '../../api/types/GameDef'; import { WinMode } from '../../api/types/WinMode'; -export default function getDefinition() { +export default function getDefinition(): GameDef { return { title: 'Wizard', bgColor: '#1F1F1F', diff --git a/src/providers/ThemeProvider.tsx b/src/providers/ThemeProvider.tsx index b766361..cdf4d46 100644 --- a/src/providers/ThemeProvider.tsx +++ b/src/providers/ThemeProvider.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react-refresh/only-export-components */ import React, { ReactNode, useEffect } from 'react'; import StyleUtils from '../api/utils/StyleUtils'; @@ -56,7 +57,7 @@ export function ThemeProvider({ children }: Props) { useEffect(() => { StyleUtils.setDefaultValues(isDarkMode); - }, []); + }, [isDarkMode]); const isDarkModeEnabled = () => { return isDarkMode; diff --git a/src/views/HomeView.tsx b/src/views/HomeView.tsx index b0343f6..18ea3df 100644 --- a/src/views/HomeView.tsx +++ b/src/views/HomeView.tsx @@ -20,7 +20,7 @@ export default function HomeView() { useEffect(() => { document.title = 'BoardScoreHub'; StyleUtils.setDefaultValues(isDarkModeEnabled()); - }, []); + }, [isDarkModeEnabled]); const games = getSortedGameNames(); return (