Skip to content

Latest commit

 

History

History
45 lines (29 loc) · 2.23 KB

CONTRIBUTING.md

File metadata and controls

45 lines (29 loc) · 2.23 KB

Contributing to PhotonLab

Thanks for taking the time. Bug reports, physics corrections, translations and code are all welcome.

Reporting a bug

Open an issue with:

  • what you did, what you expected and what happened;
  • your browser and device (the about box in the app shows the grid size and renderer);
  • if possible, a share link (File → Copy share link) or a scene file that shows the problem.

If the simulation gives a physically wrong answer, say what you expected and why. A reference (a textbook formula, a paper, another solver) helps a lot.

Before you write code

For anything bigger than a small fix, open an issue first so we can agree on the approach. It saves both of us time.

Setting up

npm install
npm run dev

Rust is only needed if you change rust-core/. See the build guide.

Pull requests

  • Keep them focused: one change per pull request.
  • Run npm run lint, npm run typecheck and npm test. For solver changes also run cargo fmt, cargo clippy --all-targets -- -D warnings and cargo test --release in rust-core/, then npm run build:wasm and commit the updated rust-core/pkg/.
  • For physics changes, put the validation numbers before and after in the description.
  • For interface changes, add a screenshot, and check the phone layout (narrow the window below 700 px).
  • New user-facing text goes into both web/src/i18n/en.ts and web/src/i18n/tr.ts. A test checks that the two stay in step.

Style

  • TypeScript: the existing Prettier and ESLint settings. Prefer small modules and plain functions.
  • Rust: rustfmt with the repository settings. Hot loops should stay free of bounds checks and branches; there is a benchmark in rust-core/examples/bench.rs.
  • Interface: use the tokens in web/src/styles/tokens.css. One accent colour, hairline borders, no gradients, glows or emoji. Icons go in web/src/ui/icons/Icon.tsx on the 16 px grid.
  • Commit messages: a short summary line in the imperative ("Fix probe drift on resize"), then a blank line and the why, if it is not obvious.

Code of conduct

Be kind and constructive. See CODE_OF_CONDUCT.md.