diff --git a/CLAUDE.md b/CLAUDE.md index 38f2c0a..14ad93d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -19,6 +19,7 @@ Svelte 5 + TypeScript + Vite. Public repository. | Base UI kit (panel, meter, button...), preview | `src/components/ui/`, `#/kit` in dev (dec. 009) | | Resync values; business bars (Sold, Raided) | `ui/EditableValue`, `ui/BusinessBars` (dec. 010) | | Game data with sources | `src/data/` (decision 004) | +| Owned properties and upgrades | `data/properties.ts`, `lib/properties.ts` (011) | | Theme tokens | `src/app.css` (decision 009) | | CI, templates | `.github/` | | Skills: `handoff`, `finish-pr`; agent: `scout` | `.claude/` | diff --git a/docs/decisions/011-owned-properties.md b/docs/decisions/011-owned-properties.md new file mode 100644 index 0000000..6395eba --- /dev/null +++ b/docs/decisions/011-owned-properties.md @@ -0,0 +1,28 @@ +# 011: Owned properties and upgrades + +2026-10-14, issue #5. Builds on decisions 004 and 006. + +## Decision + +- **Catalog:** `src/data/properties.ts` lists the properties LSOS supports, each with a stable + `id` (saved in user data, never changed or reused), a label, its upgrades and a source. It + starts empty: each tracker issue adds its own property with sourced upgrades. +- **Two kinds of upgrade:** `toggle` (bought or not, e.g. an equipment or staff upgrade) and + `choice` (one of several options, the first being the default, e.g. what a nightclub + technician is assigned to, with "not hired" first). Several technicians are several choices. +- **Saved state** (version 3): `properties` maps a property id to `{ owned, upgrades }`, where an + upgrade is saved as `true`/`false` or the chosen option id. A missing entry means not owned, + no upgrades. Unchecking "owned" keeps the upgrades, so owning it again restores them. Entries + for ids the catalog does not list are kept; a saved value that no longer fits its upgrade + reads as the default. Logic: `src/lib/properties.ts`. +- **UI:** Settings has a Properties panel with every catalog entry (owned checkbox; upgrades + appear once owned). The Businesses tab shows only owned properties, each panel with a gear + button that opens the same settings in place; closed, it summarises the bought upgrades. + Both components take the catalog as a prop, so `#/kit` previews them with sample entries. + +## Why + +Production rates depend on ownership and upgrades, so trackers need them, and users must be +able to change them where they look at a business as well as in Settings. Two kinds cover every +upgrade named in the issue without a separate shape per business. Keeping upgrades on sale and +unknown ids on load avoids throwing away user input over a misclick or a catalog change. diff --git a/docs/decisions/README.md b/docs/decisions/README.md index 8a0c1c8..32df460 100644 --- a/docs/decisions/README.md +++ b/docs/decisions/README.md @@ -21,3 +21,4 @@ free number, add one line below. **Replacing one:** write a new decision, then m - [008](008-clock-details.md) Clock details: session play time, opens paused (setting), throttled ticks counted, long gaps asked about - [009](009-terminal-design.md) Terminal look: tokens in `app.css`, self-hosted Oswald (OFL), browser-style tabs, base components in `src/components/ui/` - [010](010-resync.md) Resync: `EditableValue` for every tracked value, `BusinessBars` with Sold/Raided/Full and supply deliveries, undo keeps progress since +- [011](011-owned-properties.md) Owned properties and upgrades: catalog in `src/data/properties.ts`, toggle/choice upgrades, Settings panel and Businesses gear diff --git a/src/App.svelte b/src/App.svelte index f74ce17..205d2fb 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -1,9 +1,12 @@ + +{#if shown.length === 0} +

+ {#if catalog.length === 0} + No businesses are tracked yet. + {:else} + You do not own any business yet. Mark what you own in + Settings. + {/if} +

+{:else} +
+ {#each shown as property (property.id)} + + {#if open === property.id} + + {:else} +

{summary(property)}

+ {/if} + {#snippet footer()} + + {/snippet} +
+ {/each} +
+{/if} + + diff --git a/src/components/PropertyList.svelte b/src/components/PropertyList.svelte new file mode 100644 index 0000000..2f00589 --- /dev/null +++ b/src/components/PropertyList.svelte @@ -0,0 +1,35 @@ + + + + {#each catalog as property (property.id)} + + {:else} +

No properties yet. They appear here as their trackers are built.

+ {/each} +

Trackers show only what you own. Upgrades change how fast they count.

+
+ + diff --git a/src/components/PropertySettings.svelte b/src/components/PropertySettings.svelte new file mode 100644 index 0000000..249015a --- /dev/null +++ b/src/components/PropertySettings.svelte @@ -0,0 +1,122 @@ + + +
+ + + {#if isOwned(owned, property.id) && property.upgrades.length > 0} +
+ {#each property.upgrades as upgrade (upgrade.id)} + {#if upgrade.kind === 'toggle'} + + {:else} +
+ + +
+ {/if} + {/each} +
+ {/if} +
+ + diff --git a/src/components/Settings.svelte b/src/components/Settings.svelte index 15e667e..48feea3 100644 --- a/src/components/Settings.svelte +++ b/src/components/Settings.svelte @@ -1,6 +1,8 @@
+ (store.state.properties = owned)} + /> +