diff --git a/README.md b/README.md index e18e6209..83c3b5fb 100644 --- a/README.md +++ b/README.md @@ -18,9 +18,9 @@ Be kind. Be clear. Assume good intent. Keep feedback constructive. - 👤 **Creator:** [Gilles Romer](https://romerg.de/) - ✉️ **Contact:** [info@romerg.de](mailto:info@romerg.de) -![Version](https://img.shields.io/badge/version-v1.27.3-e3000b?style=flat-square) ![Dark Theme](https://img.shields.io/badge/theme-dark-1a1a2e?style=flat-square) ![TCGdex](https://img.shields.io/badge/card%20data-TCGdex-e3000b?style=flat-square) ![Docker](https://img.shields.io/badge/deploy-Docker-2496ed?style=flat-square) ![FastAPI](https://img.shields.io/badge/backend-FastAPI-009688?style=flat-square) ![React](https://img.shields.io/badge/frontend-React%2018-61dafb?style=flat-square) [![Ko-fi](https://img.shields.io/badge/support-Ko--fi-ff5e5b?style=flat-square&logo=ko-fi&logoColor=white)](https://ko-fi.com/gillesromer) +![Version](https://img.shields.io/badge/version-v1.27.4-e3000b?style=flat-square) ![Dark Theme](https://img.shields.io/badge/theme-dark-1a1a2e?style=flat-square) ![TCGdex](https://img.shields.io/badge/card%20data-TCGdex-e3000b?style=flat-square) ![Docker](https://img.shields.io/badge/deploy-Docker-2496ed?style=flat-square) ![FastAPI](https://img.shields.io/badge/backend-FastAPI-009688?style=flat-square) ![React](https://img.shields.io/badge/frontend-React%2018-61dafb?style=flat-square) [![Ko-fi](https://img.shields.io/badge/support-Ko--fi-ff5e5b?style=flat-square&logo=ko-fi&logoColor=white)](https://ko-fi.com/gillesromer) -**Current version:** `v1.27.3` · Releases are tracked on the [GitHub Releases page](https://github.com/Git-Romer/pokecollector/releases). +**Current version:** `v1.27.4` · Releases are tracked on the [GitHub Releases page](https://github.com/Git-Romer/pokecollector/releases). ![WebApp Preview](preview-homescreen.png) diff --git a/VERSION b/VERSION index 3bae5204..d6201580 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.27.3 +1.27.4 diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 08fc5f53..ae58e99d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "pokemon-tcg-collection", - "version": "1.27.3", + "version": "1.27.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pokemon-tcg-collection", - "version": "1.27.3", + "version": "1.27.4", "dependencies": { "@tanstack/react-query": "^5.18.0", "axios": "^1.18.0", diff --git a/frontend/package.json b/frontend/package.json index b9406ece..80720a41 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,7 +1,7 @@ { "name": "pokemon-tcg-collection", "private": true, - "version": "1.27.3", + "version": "1.27.4", "type": "module", "scripts": { "dev": "vite", diff --git a/frontend/src/components/PokedexGenerationFilter.jsx b/frontend/src/components/PokedexGenerationFilter.jsx new file mode 100644 index 00000000..2db66654 --- /dev/null +++ b/frontend/src/components/PokedexGenerationFilter.jsx @@ -0,0 +1,76 @@ +import clsx from 'clsx' + +export const POKEDEX_GENERATIONS = [ + { id: 1, region: 'Kanto', range: '#001–151' }, + { id: 2, region: 'Johto', range: '#152–251' }, + { id: 3, region: 'Hoenn', range: '#252–386' }, + { id: 4, region: 'Sinnoh', range: '#387–493' }, + { id: 5, region: 'Unova', range: '#494–649' }, + { id: 6, region: 'Kalos', range: '#650–721' }, + { id: 7, region: 'Alola', range: '#722–809' }, + { id: 8, region: 'Galar', range: '#810–905' }, + { id: 9, region: 'Paldea', range: '#906–1025' }, +] + +export default function PokedexGenerationFilter({ generation, onSelectGeneration, t }) { + const label = t('pokedex.generationFilter') + + return ( + <> + + +
+ + {POKEDEX_GENERATIONS.map((item) => ( + + ))} +
+ + ) +} diff --git a/frontend/src/components/PokedexGenerationFilter.test.js b/frontend/src/components/PokedexGenerationFilter.test.js new file mode 100644 index 00000000..d223ed6e --- /dev/null +++ b/frontend/src/components/PokedexGenerationFilter.test.js @@ -0,0 +1,53 @@ +import { createElement } from 'react' +import { renderToStaticMarkup } from 'react-dom/server' +import { describe, expect, it, vi } from 'vitest' +import PokedexGenerationFilter from './PokedexGenerationFilter' + +const translations = { + 'pokedex.generationFilter': 'Pokédex region', + 'pokedex.national': 'National', +} +const t = key => translations[key] || key + +describe('PokedexGenerationFilter', () => { + it('renders a labelled mobile select and a non-shrinking desktop control', () => { + const markup = renderToStaticMarkup(createElement(PokedexGenerationFilter, { + generation: 3, + onSelectGeneration: vi.fn(), + t, + })) + + expect(markup).toContain('