Legg til tre nye kalkulatorer: sparing, bolig og arv
Nye interaktive kalkulatorer som utforsker hvordan tilsynelatende små forskjeller vokser eksponentielt over tid: - sparing: rentes rente med ulik avkastning (månedlig compounding) - bolig: belåningseffekt forsterker egenkapitalgap ~6.7× - arv: arvet formue vokser uavhengig av innsats, gapet lukkes aldri Landingsside oppdatert med nye kort. Dokumentasjon oppdatert. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
768acc6577
commit
3ffb404250
13 changed files with 2194 additions and 37 deletions
34
CLAUDE.md
34
CLAUDE.md
|
|
@ -4,33 +4,41 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
|
|||
|
||||
## Project Overview
|
||||
|
||||
Interactive web application that visualizes how percentage-based salary increases amplify absolute salary differences over time. Norwegian-language UI ("Lønnsforskjellen vokser" = "The salary gap grows").
|
||||
Collection of interactive calculators visualizing how seemingly small differences grow exponentially over time. Norwegian-language UI. Hosted at `forskjeller.naiv.no`.
|
||||
|
||||
## Architecture
|
||||
|
||||
Hosted at `forskjeller.naiv.no`. Static site in `public/` — no build system, no package manager. Serve `public/` as the site root. Each topic gets its own subdirectory (e.g. `public/lonn/`).
|
||||
Static site in `public/` — no build system, no package manager. Serve `public/` as the site root. Each topic gets its own subdirectory with `index.html`, `style.css`, `app.js`.
|
||||
|
||||
- `public/lonn/index.html` — Page structure: header, 4 range-slider controls, 4 stat cards, 4 chart canvases, explainer section
|
||||
- `public/lonn/style.css` — CSS custom properties in `:root`, CSS Grid layouts, responsive breakpoints at 560px/480px/360px
|
||||
- `public/lonn/app.js` — All logic:
|
||||
- `fmtKr(n)` / `fmtShort(n)` — Norwegian locale number formatting (nb-NO)
|
||||
- `getData()` — Computes compound growth arrays from slider values
|
||||
- `baseOpts()` — Shared Chart.js config factory for all 4 charts
|
||||
- `update()` — Reads sliders, recalculates, updates DOM and charts (called on every `input` event)
|
||||
### Shared pattern (all calculators)
|
||||
|
||||
Each calculator directory contains three files following the same pattern:
|
||||
- `index.html` — Header, range-slider controls, stat cards, chart canvases, explainer section
|
||||
- `style.css` — Identical copy across all calculators. CSS custom properties in `:root`, CSS Grid layouts, responsive breakpoints at 560px/480px/360px
|
||||
- `app.js` — Self-contained logic with `fmtKr()`, `fmtShort()`, `getData()`, `baseOpts()`, `update()`. Charts update with `'none'` animation mode.
|
||||
|
||||
### Calculators
|
||||
|
||||
- **`public/lonn/`** — Salary gap: percentage raises amplify absolute differences. Model: `gap = (B₀ − A₀) × (1 + r)ⁿ`
|
||||
- **`public/sparing/`** — Compound interest: same savings, different returns. Model: `FV = P × ((1+r)^n - 1) / r` (monthly compounding). Stacked bar chart for deposits vs interest.
|
||||
- **`public/bolig/`** — Housing leverage: same price growth, different starting prices. 85% LTV amplifies equity gap ~6.67×. Model: `Equity = Price × (1+g)^n - Loan`
|
||||
- **`public/arv/`** — Inheritance gap: lump sum + equal savings, gap never closes. Model: `Gap = Arv × (1+r)^n`. Has percentage y-axis chart.
|
||||
|
||||
**External dependencies** (loaded via CDN, no install needed): Chart.js 4.4.1, Google Fonts (Fraunces + DM Sans).
|
||||
|
||||
### Key Design Decisions
|
||||
|
||||
- All 4 charts share `baseOpts()` — modify this for consistent chart styling changes
|
||||
- Charts update with `'none'` animation mode for responsive slider interaction
|
||||
- Mathematical model: gap = `(B₀ − A₀) × (1 + r)ⁿ`
|
||||
- Color palette: Blue (#1a4a8a) = A, Red (#c0392b) = B, Purple (#4a3a8a) = gap
|
||||
- All charts share `baseOpts()` — modify this for consistent chart styling changes
|
||||
- Label pattern: "I dag" at year 0, show every 5th year, always show last year
|
||||
- DOM updates use `textContent` or DOM methods (not innerHTML) for security
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
python3 -m http.server 8000 -d public
|
||||
# open http://localhost:8000/lonn/
|
||||
# open http://localhost:8000/ for landing page
|
||||
# open http://localhost:8000/{lonn,sparing,bolig,arv}/ for individual calculators
|
||||
```
|
||||
|
||||
## Language
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue