mirror of
https://github.com/Komediruzecki/token-circles.git
synced 2026-10-20 09:46:43 +02:00
Four bugs, all of which only appear once someone types into the panel.
The field lost focus after every character. Each editable list was a <For>, which
is keyed by reference, and every keystroke rebuilt the row's array with a fresh
object for the edited row — so Solid disposed the row and built it again, taking
the focused <input> with it. The four editable lists are <Index> now, which keys
by position and leaves the node alone.
A number field could not be emptied, and could not hold a decimal. Binding
value={n} and writing back Number(e.currentTarget.value) means the model writes
into the box the user is typing in: clearing it gives Number('') === 0, which
puts "0" straight back under the caret, and mid-way through "3.75" the text reads
"3.", which a number input reports as '' — so that keystroke was discarded too.
NumberField renders once untracked and syncs from the model only when the element
does not have focus.
An auto-filled contribution of 7.292500000001382 could not be saved. An average is
a division, and step="0.01" makes a value that is not a multiple of a hundredth
invalid — one invalid field blocks the whole form, so the button did nothing and
the browser put a bubble on a number nobody typed. Numbers are now rounded where
they are produced: in buildFacts, in the difference deriveSettings takes, and in
num() for anything read back out of storage. Percentages carry two decimals, so
their inputs step by 0.01 rather than 0.1; age and portfolio weight round to whole
numbers, matching their step of 1.
Picking a birth month meant clicking back one year at a time. Chromium's month
picker is a day-calendar with the days removed and Firefox has none at all, so
MonthPicker replaces it with a month select and a year select: any year is one
gesture away, type-ahead works, and it emits the same YYYY-MM string as before.
Mobile keeps the two-column desktop layout it had, but below 640px an editable row
gives each control the full width instead of squeezing two months, an amount and a
button onto one line.
Verified in Chromium against a seeded profile: focus survives typing 4500 one
character at a time, an emptied field stays empty, "3.75" arrives intact, 1950 is
directly selectable, no field blocks the form, and there is no horizontal overflow
at 375px. The focus test fails against the old <For> exactly as reported —
document.activeElement falls back to <body> after the first digit.
Documented in .claude/skills/solid-forms/SKILL.md, with the greps that catch each
one in review, and linked from CONTRIBUTING.md — this class of bug has shipped here
more than once.
109 lines
3.1 KiB
Markdown
109 lines
3.1 KiB
Markdown
# Contributing to Finance Manager
|
|
|
|
Thank you for your interest in contributing!
|
|
|
|
## Getting Started
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js 20+
|
|
- pnpm 10+
|
|
- SQLite 3
|
|
|
|
### Setup
|
|
|
|
```bash
|
|
git clone https://github.com/Komediruzecki/finance-manager.git
|
|
cd finance-manager
|
|
pnpm install
|
|
```
|
|
|
|
### Development
|
|
|
|
This is a monorepo with two main workspaces:
|
|
|
|
- **`frontend/`** — SolidJS SPA with Vite
|
|
- **`backend/`** — Node.js/Express API server
|
|
|
|
```bash
|
|
# Start backend (port 3847)
|
|
cd backend && node index.js
|
|
|
|
# Start frontend dev server (port 5173)
|
|
pnpm run dev
|
|
```
|
|
|
|
## Workflow
|
|
|
|
1. **Find an issue** — Pick an open issue from [GitHub Issues](https://github.com/Komediruzecki/finance-manager/issues), or open one to discuss your idea first
|
|
2. **Create a feature branch** — Branch off `main`:
|
|
|
|
```bash
|
|
git checkout -b feat/issue-NUMBER-short-description
|
|
```
|
|
|
|
Use branch prefixes: `feat/`, `fix/`, `refactor/`, `docs/`, `chore/`
|
|
|
|
3. **Make changes** — Follow the code style and write tests
|
|
4. **Commit** — Use [Conventional Commits](https://www.conventionalcommits.org/):
|
|
|
|
```bash
|
|
git commit -m "feat: add transaction search"
|
|
git commit -m "fix: resolve pagination off-by-one"
|
|
```
|
|
|
|
5. **Push and open a PR** — Open a pull request against `main`
|
|
6. **CI must pass** — Lint, typecheck, build, and tests must all pass before review
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
pnpm run test # Run all tests
|
|
pnpm run test -- --watch # Watch mode
|
|
npx jest <path> # Run specific test file
|
|
```
|
|
|
|
Tests require the backend server running on port 3847 with `NODE_ENV=test`.
|
|
The test database (`db/test.db`) is reset automatically between test files.
|
|
Run `pnpm run test` once to initialize the test database before running individual tests.
|
|
|
|
## Code Style
|
|
|
|
- TypeScript for frontend code
|
|
- ESLint + Prettier configured — run `pnpm run lint` before committing
|
|
- Follow existing patterns in the codebase
|
|
|
|
### Editable form controls
|
|
|
|
Read [`.claude/skills/solid-forms/SKILL.md`](.claude/skills/solid-forms/SKILL.md) before
|
|
adding an `<input>` or a list of editable rows. Four bugs have shipped from this area more
|
|
than once, and all four look correct in a diff:
|
|
|
|
- a `<For>` over editable rows rebuilds each row on every keystroke, so the field loses
|
|
focus after one character — use `<Index>`
|
|
- `value={n}` + `onInput={e => set(Number(e.currentTarget.value))}` writes back under the
|
|
caret, so the field cannot be emptied and cannot hold a decimal — use `NumberField`
|
|
- an unrounded derived number fails HTML5 `step` validation and silently blocks the whole
|
|
form from saving — round where the number is produced
|
|
- `<input type="month">` makes users click back one year at a time — use `MonthPicker`
|
|
|
|
## Pull Request Guidelines
|
|
|
|
- Keep PRs focused on a single change
|
|
- Include a clear description of what changed and why
|
|
- Link to the issue being resolved
|
|
- Ensure all checks pass before requesting review
|
|
|
|
## Reporting Bugs
|
|
|
|
Open an issue with:
|
|
|
|
- Steps to reproduce
|
|
- Expected vs actual behavior
|
|
- Browser and OS details
|
|
- Any relevant console errors
|
|
|
|
## Questions?
|
|
|
|
Open a [discussion](https://github.com/Komediruzecki/finance-manager/issues) or ask in an issue.
|