Skip to content

#118 ✨ Create market app with stock and price overview - #128

Merged
Grisu118 merged 2 commits into
mainfrom
118-create-stock-overview
Aug 25, 2026
Merged

#118 ✨ Create market app with stock and price overview#128
Grisu118 merged 2 commits into
mainfrom
118-create-stock-overview

Conversation

@Grisu118

@Grisu118 Grisu118 commented Aug 25, 2026

Copy link
Copy Markdown
Member

Resolves #118

Summary by CodeRabbit

  • New Features
    • Added a Market app with Stock and Prices views.
    • View commodity prices, buying and selling stations, demand trends, and 12-month price curves.
    • Review farm stock across storage, production, bunkers, bales, pallets, and animal housing.
    • Filter using multi-token search and sort stock by key values.
    • Expand stock entries to see locations, valuations, totals, and seasonal projections.
  • Improvements
    • Standardized tab navigation across market and finance views.
  • Tests
    • Added comprehensive coverage for market aggregation, valuation, filtering, sorting, and price-board behavior.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7dbe9eec-b4d7-4c47-9acf-43df676730fe

📥 Commits

Reviewing files that changed from the base of the PR and between ec1f20e and 1be5aef.

📒 Files selected for processing (14)
  • FUTURE.md
  • VDTerminal/README.md
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/apps/AppRegistry.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/apps/MarketApp.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/components/FilterSelect.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/components/ViewTab.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/FinancePanel.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/MarketModel.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/MarketPanel.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/PriceBoard.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/StockTable.kt
  • VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/state/VdtStore.kt
  • VDTerminal/app/src/commonTest/kotlin/net/vertexdezign/vdt/app/panels/MarketModelTest.kt
  • VDTerminal/app/src/wasmJsMain/kotlin/net/vertexdezign/vdt/app/Main.kt
💤 Files with no reviewable changes (1)
  • FUTURE.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Added a Market application with stock and price-board tabs. The implementation aggregates farm holdings, calculates market valuations, supports filtering and sorting, displays seasonal prices, and connects price data through VdtStore.

Changes

Market overview

Layer / File(s) Summary
Market aggregation and valuation
VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/MarketModel.kt, VDTerminal/app/src/commonTest/kotlin/net/vertexdezign/vdt/app/panels/MarketModelTest.kt
Added stock aggregation from storage, production, bunker, loose-object, and husbandry sources. Added valuations, sale selection, seasonal projections, filters, sorting, totals, and price-board facts.
Shared market controls
VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/components/FilterSelect.kt, VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/components/ViewTab.kt, VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/FinancePanel.kt
Added reusable multi-token filtering and tab components. Updated FinancePanel to use the shared tab component.
Market panel views
VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/MarketPanel.kt, VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/PriceBoard.kt, VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/panels/StockTable.kt
Added the two-tab market interface, price curve, commodity details, responsive stock table, expandable source details, formatting, and totals.
Market app wiring
VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/apps/MarketApp.kt, VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/apps/AppRegistry.kt, VDTerminal/app/src/commonMain/kotlin/net/vertexdezign/vdt/app/state/VdtStore.kt, VDTerminal/app/src/wasmJsMain/kotlin/net/vertexdezign/vdt/app/Main.kt, VDTerminal/README.md
Registered MarketApp, connected PricesData to VdtStore, supplied market state to MarketPanel, and documented the Market app.

Estimated code review effort: 4 (Complex) | ~60 minutes

Merge Risk: ⚪ Minimal · up to 1be5a

This PR adds the market app and stock/price overview without any supplied merge-blocking concerns; it is merge-ready after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant MarketApp
  participant VdtStore
  participant MarketPanel
  participant StockTable
  participant PriceBoard
  MarketApp->>VdtStore: collect market and farm state
  MarketApp->>MarketPanel: pass five state values
  MarketPanel->>StockTable: render stock overview
  MarketPanel->>PriceBoard: render price board when prices load
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.74% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 108 functions across 12 files. (1 skipped… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation satisfies issue #118 [#118]. It adds pricing and stock view modes, yearly price curves, buying and selling locations, sortable and filterable stock data, valuation columns, totals, …
Out of Scope Changes check ✅ Passed The changes are within scope for issue #118 [#118]. The documentation update, shared tab component, price data integration, market model, UI panels, and tests directly support the Market app objective…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a Market app with stock and price overview modes.
Full details: Linked Issues check

Explanation

The implementation satisfies issue #118 [#118]. It adds pricing and stock view modes, yearly price curves, buying and selling locations, sortable and filterable stock data, valuation columns, totals, and storage-source details.

Full details: Out of Scope Changes check

Explanation

The changes are within scope for issue #118 [#118]. The documentation update, shared tab component, price data integration, market model, UI panels, and tests directly support the Market app objectives.

Full details: Docstring Coverage

Explanation

Docstring coverage is 40.74% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 108 functions across 12 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 118-create-stock-overview

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the area:kotlin This issue is related to the kotlin part (app) label Aug 25, 2026
@Grisu118 Grisu118 changed the title 118 create stock overview #118 ✨ Create market app with stock and price overview Aug 25, 2026
@Grisu118
Grisu118 force-pushed the 118-create-stock-overview branch from df0ec80 to 1be5aef Compare August 25, 2026 17:42
Base automatically changed from 112-price-lists to main August 25, 2026 17:53
@Grisu118
Grisu118 marked this pull request as ready for review August 25, 2026 18:39
Grisu118 and others added 2 commits August 25, 2026 20:49
…'s own board

The Market app: two tabs over prices.json, joined with the storage, production
and husbandry channels. Prices is the board itself -- every commodity, the
stations that buy and sell it, and the twelve-month curve behind it. Stock is
the table that reads from it: everything the farm owns, what it would fetch
today and where, and what the year's peak would make of it. Nothing read
TelemetryRepository.prices until now.

ONE LINE PER COMMODITY, however many containers it is spread over. Seed on a
pallet and seed in a big bag is one answer to "how much seed have I got"; the
form moved onto the source, shows as the Type column ("Pallets + Big bags (9)")
and comes apart again in the drill-in, which names every store, how much of the
row is in it and -- where the store states one -- its capacity.

OUTPUTS ONLY. A production point's storage row counts only where a line names
that fill type as an output, and a pen's condition bar only where the game marks
it invertedBar; an input is something you bought and fed in, not stock a trailer
can come and fetch. A type that is both, as flour is to a bakery, is in the set
and counts. The pen half is exact -- PlaceableHusbandryStraw sets the flag false
on the straw it eats and true on the manure it makes. The production half is a
proxy for the loading station's fill types, which are not exported; FUTURE.md
carries what would settle it.

THE BEST MONTH IS PROJECTED, NOT QUOTED. The exported curve is the game's
economy.history, which is the hourly mean across every station accepting the
fill type, so its peak sits below what the best station pays today and printing
it beside that price would show a "maximum" under the current one. What is shown
instead is today's best station carried along the curve's shape,
price x months[peak] / months[now]: the market's shape at this station's level.
A flat curve -- every buy-only fill type has one, because the game never
re-averages what no station accepts -- claims no peak month at all. Expect the
month to sit a period either side of a table built from economy.factors, and see
peakMonth for why that is arithmetic rather than a bug.

Great demand is already inside the price the game reports, so the premium is a
label and never a second multiply. Stock nothing buys -- diesel, fertilizer,
lime -- is unpriced and stays out of the total: the buy price is what a shop
charges to replace it, which is a different question.

Filtering is a multi-token type-ahead rather than a row of chips, because what
this filters on is a defined list that grows with the save: every commodity,
every store, every station on the map. Same kind ORs, different kinds AND, so
two commodities widen and a commodity plus a barn narrows. Nothing is offered
that can only come back empty. Anything the vocabulary does not name becomes a
free-text token, which is what let the separate search box go. Escape leaves the
box: on a tablet in a cab there is often nothing else to tab to.

The whole join keys on the fill type and never on a placeable id, which is what
makes it work unchanged on a multiplayer client.

The amounts are validated -- counted by hand in game, bales included. A
third-party stock mod disagreed and is the one at fault: it ignores bales below
full capacity. The money and the MP client are still unchecked, and are in
FUTURE.md with the rest.

ViewTab moves out of FinancePanel now that it has a second caller.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Grisu118
Grisu118 force-pushed the 118-create-stock-overview branch from 1be5aef to 6793068 Compare August 25, 2026 18:49
@Grisu118
Grisu118 merged commit c9156ca into main Aug 25, 2026
5 checks passed
@Grisu118
Grisu118 deleted the 118-create-stock-overview branch August 25, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:kotlin This issue is related to the kotlin part (app)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create Stock overview

1 participant