Port Turn Watcher from C++/Gtkmm to Electron + React + Redux + Vite (TypeScript)#3
Open
dooglio wants to merge 10 commits into
Open
Port Turn Watcher from C++/Gtkmm to Electron + React + Redux + Vite (TypeScript)#3dooglio wants to merge 10 commits into
dooglio wants to merge 10 commits into
Conversation
Rebuild the initiative tracker from legacy C++ (Gtkmm/Qt) to a modern Electron + React 18 + Redux Toolkit + Vite stack with TypeScript. - Add full Electron app under app/ with React renderer, Redux state management (with undo/redo), and Vite build tooling - Move legacy C++ source from src/ to cpp/src/ for archival - Add README with project overview, structure, and build instructions - Update .gitignore for Node/Electron/IDE artifacts
Collaborator
Author
Migrate from the custom React MenuBar component to a native Electron Menu built in the main process. Menu actions are forwarded to the renderer via IPC (`menu:action` channel), where a unified effect handler dispatches the corresponding Redux actions (file operations, edit, initiative, HUD, etc.). This provides a more native look and feel with proper keyboard accelerators across macOS and other platforms.
Replaces traditional Open/Save/Save As file operations with Import/Export and introduces autosave for crash recovery. State is persisted to a JSON file in the platform's userData directory via new IPC handlers (autosave:write, autosave:read, autosave:clear). Updates preload bridge and menu items accordingly.
- Add `getZoomFactor()` to apply OS display scale factor on Windows/Linux, since Chromium does not handle HiDPI automatically for Electron apps; macOS is excluded as the compositor already manages HiDPI scaling - Set `backgroundColor` on both BrowserWindow instances using `nativeTheme.shouldUseDarkColors` to eliminate the white/black flash during renderer load on light/dark mode transitions - Refactor `index.css` to replace all custom CSS variables with CSS System Color keywords (e.g. `Canvas`, `ButtonFace`, `AccentColor`) so the UI automatically respects OS light/dark mode, accent color, and high-contrast accessibility settings - Retain only app-specific semantic colors (initiative highlight, status row tints, health indicators) with an explicit dark-mode override block - Convert fixed `px` font sizes and icon dimensions to `rem`/`em` units so macOS/Windows accessibility font-size preferences are respected
…e starting rounds
…line round starts
- Add `JumpInDialog` component for characters joining combat mid-round with a specific initiative value, replacing the generic edit dialog - Fix `rounds:delay` and `rounds:ready` to act on the current initiative character instead of selected characters, and auto-advance the turn - Add `resetAllStatuses` dispatch when ending rounds to clear status flags - Import and use `getCharacterAtPosition` utility for current turn lookup - Fix initiative arrow direction from ← to → in `CharacterTable`
- Mirror C++ `NextInitTransaction` behavior: automatically reset Delayed/Readied status to Normal when a character's turn comes up, both in the main turn advance (App.tsx) and the Toolbar prev/next handlers - Rework `JumpInDialog` to mirror C++ `InternalMoveCharacter` + `SetPositions` logic: instead of simply resetting status, the jumped-in character is now spliced into the sorted initiative order immediately after the current-initiative character, and all position values are reassigned sequentially (1..N) to reflect the new order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
This PR replaces the legacy C++/Gtkmm desktop application with a modern
Electron + React + Redux Toolkit + Vite stack written in TypeScript. The
C++ source is preserved in
cpp/for historical reference.What Changed
Repository Restructure
cpp/app/containing the new Electron/React application.xpmicon files to.pngusing ImageMagick.icns, Windows.ico, and Linux.pngapp icons from the original artworkNew Application (
app/)Tech stack: Electron 31 · React 18 · Redux Toolkit · Vite 5 · TypeScript 5
Architecture:
electron/main.ts— Main process: window management (main + player HUD), file open/save dialogs via IPCelectron/preload.ts— Context bridge exposing file I/O to the rendererelectron/fileManager.ts— Load/save JSON files; full backwards compatibility with legacy.turnwatcherXML files viafast-xml-parsersrc/store/— Redux slices mirroring the original C++ singleton managers:charactersSlice— replacesCombatant::CharacterManager(withredux-undofor undo/redo)initiativeSlice— replacesInitiative::InitiativeManagerstatsSlice— replacesAttribute::StatManager(includes all default D&D 3.x stats)settingsSlice— replacesApplication::AppSettingsuiSlice— dialog state, selection, file pathsrc/types/— TypeScript interfaces forCharacter,Effect,StatDefinition,AppSettings, etc.src/utils/— Pure logic functions:dice.ts— Dice rolling (1d20+mod, arbitrary NdX+Y)health.ts— HP/health status (Normal/Disabled/Dying/Dead/Stabilized)initiative.ts— Initiative sorting, duplicate detection, next-turn logicUI Components:
File format:
.json(structured to mirror the original molib property-bag hierarchy).turnwatcherXML (read-only import, auto-converted on open)What's Preserved
TransactionManager).turnwatchersave filesHow to Run