Skip to content

feat: recover project (July 2025)#7

Merged
manuartero merged 15 commits intomainfrom
recover-project
Jul 18, 2025
Merged

feat: recover project (July 2025)#7
manuartero merged 15 commits intomainfrom
recover-project

Conversation

@manuartero
Copy link
Copy Markdown
Owner

@manuartero manuartero commented Jul 18, 2025

This pull request introduces several updates across the codebase, focusing on modernizing dependencies, transitioning from SCSS to CSS modules, improving the board game logic, and enhancing the structure and maintainability of the project. Key changes include dependency upgrades, refactoring of styles, and updates to the board's functionality and visual representation.

Dependency and Configuration Updates:

  • Updated node version requirement to >=20.19 in package.json and updated dependencies and devDependencies to their latest versions, including react, typescript, and jest (package.json, [1] [2].
  • Replaced the vite script alias start with dev in package.json (package.json, package.jsonL32-R70).
  • Updated the Jest moduleNameMapper configuration to remove the regex anchor for.svg files (jest.config.mjs`, jest.config.mjsL90-R90).

Transition from SCSS to CSS Modules:

  • Migrated styles from app.scss to app.module.css, including grid layout definitions for the main app, and removed redundant SCSS code (src/app.scss, [1]; src/app.module.css, [2].
  • Refactored board-related styles from board.scss to board.module.css to utilize CSS modules and improve maintainability (src/components/board/board.scss, [1]; src/components/board/board.module.css, [2].
  • Removed unused SCSS files, such as option-dialog.scss (src/components/board/option-dialog.scss, src/components/board/option-dialog.scssL1-L21).

Board Game Logic and Visual Updates:

  • Introduced a new upgradeBuilding helper function to simplify building upgrades and replaced inline logic with this helper in board-controller.tsx (src/components/board/board-controller.tsx, src/components/board/board-controller.tsxR54-R57).
  • Updated the inferVisualBoardFromGameContext function to remove the idle status and simplify the logic for determining tile statuses (src/components/board/infer-visual-board.ts, [1] [2].
  • Enhanced the Board component to use CSS modules for styling and added ARIA roles and labels for improved accessibility (src/components/board/board.tsx, [1] [2].

Mock and Test Updates:

  • Updated the svg-mock.cjs file to export a React-compatible mock for .svg files (src/__mocks__/svg-mock.cjs, src/mocks/svg-mock.cjsL3-R9).
  • Removed outdated snapshot tests for the Piece and Tile components (src/components/board/__snapshots__/piece.test.tsx.snap, [1]; src/components/board/__snapshots__/tile.test.tsx.snap, [2].

Component and Structural Refactoring:

  • Refactored the BuildDialog component to remove unused SCSS styles and improve its structure by adding a title and simplifying its JSX (src/components/board/build-dialog.tsx, src/components/board/build-dialog.tsxL1-L35).
  • Updated the Board component to use nested directories for pieces and tiles to better organize its structure (src/components/board/board.tsx, src/components/board/board.tsxR1-R7).

These changes collectively improve the project's maintainability, performance, and developer experience while modernizing the codebase.

@manuartero manuartero self-assigned this Jul 18, 2025
@manuartero manuartero requested a review from Copilot July 18, 2025 11:31
@vercel
Copy link
Copy Markdown

vercel bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
storming ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 11:40am

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive project recovery for July 2025, focusing on modernizing the codebase with updated dependencies, improved styling architecture, and enhanced accessibility features.

  • Updates build tooling from Vite plugin React to React SWC and modernizes dependency versions
  • Migrates from SCSS to CSS Modules for better component isolation and maintainability
  • Enhances accessibility with proper ARIA labels, roles, and semantic HTML structure

Reviewed Changes

Copilot reviewed 101 out of 135 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
vite.config.ts Updates Vite configuration with React SWC plugin and HTML plugin
src/styles/*.css Migrates SCSS variables to CSS custom properties and removes deprecated files
src/components/**/*.tsx Converts components to use CSS Modules and adds accessibility improvements
src/models/new-building.ts Adds building upgrade functionality and changes default building type
src/game-logic/*.ts Updates game logic to use new building types and terrain system
package.json Updates dependencies to latest versions and changes start script to dev
Comments suppressed due to low confidence (1)

src/game-logic/pieces.ts:3

  • [nitpick] The property name 'specialTerrain' is ambiguous. Consider renaming to 'restrictedTerrain' or 'terrainPenalties' to better indicate its purpose.
  specialTerrain: TerrainType[];

Comment on lines 7 to +16
commited: boolean;
};

export function ActionLineItem({ card, commited }: Props): JSX.Element {
export function ActionLineItem({ card, commited }: Props) {
return (
<div
className={c(
"line-item",
card.owner === "player" &&
"line-item--player" &&
"player" &&
"expansible",
commited ? "line-item--commited" : "line-item--pending"
styles.lineItem,
card.owner === "player" && styles.expansible,
commited ? styles.committed : styles.pending
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The word 'commited' is misspelled. It should be 'committed' with double 't'.

Copilot uses AI. Check for mistakes.
border: 2px dotted var(--dark-grey);
}

.lineItem.commited {
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSS class name 'commited' is misspelled. It should be 'committed' with double 't'.

Suggested change
.lineItem.commited {
.lineItem.committed {

Copilot uses AI. Check for mistakes.
>
<div
class="line-item line-item--commited"
class="lineItem committed"
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spelling: the snapshot shows 'committed' but the code uses 'commited'. This suggests the CSS class name should be updated to match.

Copilot uses AI. Check for mistakes.
<div className="board__row board__row--2-to-equator">{renderRow(2)}</div>
<div className="board__row board__row--3-to-equator">{renderRow(3)}</div>
</div>
<section className={styles.board} role="board" aria-label="game board">
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The role 'board' is not a valid ARIA role. Consider using 'region' or 'application' instead, or remove the role attribute since semantic HTML

already provides structure.

Suggested change
<section className={styles.board} role="board" aria-label="game board">
<section className={styles.board} aria-label="game board">

Copilot uses AI. Check for mistakes.
<div className="board__row board__row--2-to-equator">{renderRow(2)}</div>
<div className="board__row board__row--3-to-equator">{renderRow(3)}</div>
</div>
<section className={styles.board} role="board" aria-label="game board">
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using role='row' without a parent container with role='grid' or 'table' is invalid. Consider removing these role attributes or restructuring with proper ARIA grid roles.

Suggested change
<section className={styles.board} role="board" aria-label="game board">
<section className={styles.board} role="grid" aria-label="game board">

Copilot uses AI. Check for mistakes.

{building && owner && <Building variant={building} owner={owner} />}
{children && (
<div className={c(styles.piece)} style={pieceStyle}>
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The random positioning logic using useRef may cause inconsistent behavior. Consider using a more predictable positioning system or memoizing the offset calculation.

Copilot uses AI. Check for mistakes.
onClick,
}: Props) {
/* debug: turn on debug ID */
const debugTileID = false;
Copy link

Copilot AI Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug code should be removed from production. Consider using environment variables or a proper debug configuration system.

Suggested change
const debugTileID = false;
const debugTileID = process.env.REACT_APP_DEBUG_TILE_ID === "true";

Copilot uses AI. Check for mistakes.
@manuartero
Copy link
Copy Markdown
Owner Author

@copilot how would you call (title) this PR

@manuartero manuartero merged commit a6a504c into main Jul 18, 2025
3 checks passed
@manuartero manuartero deleted the recover-project branch July 18, 2025 11:41
manuartero pushed a commit that referenced this pull request Jul 21, 2025
# [0.5.0](v0.4.1...v0.5.0) (2025-07-21)

### Bug Fixes

* <Dialog /> ([92687f3](92687f3))
* recover visual status for <Tile /> (available, owned...) ([9b153f6](9b153f6))
* tests ([276e658](276e658))

### Features

* recover project (July 2025) ([#7](#7)) ([a6a504c](a6a504c)), closes [/#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L7-R7](https://github.com///issues/diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L7-R7) [/#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L32-R70](https://github.com///issues/diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L32-R70) [/#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L32-R70](https://github.com///issues/diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L32-R70) [/#diff-d7f25b99ffec31fa85dc8d4b42e64ee59a7654fceb97327fc67a80158ebcfbb6L90-R90](https://github.com///issues/diff-d7f25b99ffec31fa85dc8d4b42e64ee59a7654fceb97327fc67a80158ebcfbb6L90-R90) [/#diff-b606cac853277b85a5aa49de291ccc05ef14651b08b1fd1a751d7749e6c62a27L1-L66](https://github.com///issues/diff-b606cac853277b85a5aa49de291ccc05ef14651b08b1fd1a751d7749e6c62a27L1-L66) [/#diff-d4e452a166be192080b07c76e0b1d6b8eb4fb7e21440354edfcdd41a324baf4eR1-R25](https://github.com///issues/diff-d4e452a166be192080b07c76e0b1d6b8eb4fb7e21440354edfcdd41a324baf4eR1-R25) [/#diff-580dd584cc8e9dd5796583ab3b6925f85decdf3986ff46d2d442cf901ff292a3L1-L38](https://github.com///issues/diff-580dd584cc8e9dd5796583ab3b6925f85decdf3986ff46d2d442cf901ff292a3L1-L38) [/#diff-0d7772935af567cfc4066138acbb53ff6575cbba9801b15b46a61fcbad3c01f9R1-R43](https://github.com///issues/diff-0d7772935af567cfc4066138acbb53ff6575cbba9801b15b46a61fcbad3c01f9R1-R43) [/#diff-8ab26dfe22c0d90d39587ce8b7e4545445f11317f0b4483e1f79ea6f775ec6c0L1-L21](https://github.com///issues/diff-8ab26dfe22c0d90d39587ce8b7e4545445f11317f0b4483e1f79ea6f775ec6c0L1-L21) [/#diff-0b9f0eaba232e2375eb818ecaca50bf9d9d5d1eae7d870db081df76bab4fbd87R54-R57](https://github.com///issues/diff-0b9f0eaba232e2375eb818ecaca50bf9d9d5d1eae7d870db081df76bab4fbd87R54-R57) [/#diff-41b37b8eb359f10d5872e755d71c9e8254ee3a13e7f68e70c90a0470047551cdR4-R21](https://github.com///issues/diff-41b37b8eb359f10d5872e755d71c9e8254ee3a13e7f68e70c90a0470047551cdR4-R21) [/#diff-41b37b8eb359f10d5872e755d71c9e8254ee3a13e7f68e70c90a0470047551cdL44-R40](https://github.com///issues/diff-41b37b8eb359f10d5872e755d71c9e8254ee3a13e7f68e70c90a0470047551cdL44-R40) [/#diff-f42224d836ecad44d9ca2adbf24bb87055b6575dccbdf0b945dd59a7577e1bf8R1-R7](https://github.com///issues/diff-f42224d836ecad44d9ca2adbf24bb87055b6575dccbdf0b945dd59a7577e1bf8R1-R7) [/#diff-f42224d836ecad44d9ca2adbf24bb87055b6575dccbdf0b945dd59a7577e1bf8L37-R84](https://github.com///issues/diff-f42224d836ecad44d9ca2adbf24bb87055b6575dccbdf0b945dd59a7577e1bf8L37-R84) [/#diff-b50abf402a7b9a8b92c8baa8b8f41315c8668370855a400f58db54c27ecffba3L3-R9](https://github.com///issues/diff-b50abf402a7b9a8b92c8baa8b8f41315c8668370855a400f58db54c27ecffba3L3-R9) [/#diff-a0001abae4480f341f4c97b77f6cf05a9118c0c157e7faa312f8ee2fc22a8ac4L1-L9](https://github.com///issues/diff-a0001abae4480f341f4c97b77f6cf05a9118c0c157e7faa312f8ee2fc22a8ac4L1-L9) [/#diff-8539965c139f02185423836360e5c2530ad0d6735453fa31c992644b27d17da9L1-L16](https://github.com///issues/diff-8539965c139f02185423836360e5c2530ad0d6735453fa31c992644b27d17da9L1-L16) [/#diff-a7d39e1ce62f057dcb0b9a496cf7158d020f420cc42c981e857e3c632025b183L1-L35](https://github.com///issues/diff-a7d39e1ce62f057dcb0b9a496cf7158d020f420cc42c981e857e3c632025b183L1-L35) [/#diff-f42224d836ecad44d9ca2adbf24bb87055b6575dccbdf0b945dd59a7577e1bf8R1-R7](https://github.com///issues/diff-f42224d836ecad44d9ca2adbf24bb87055b6575dccbdf0b945dd59a7577e1bf8R1-R7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants