Web: show vitality and today's predicted earnings #5

Merged
alex merged 21 commits from feat/web-rewards into main 2026-10-31 08:59:40 +01:00
Owner
  • Rule vectors: Rewards publishes the day-earnings rule (rewards.day_earnings, 10 cases) in libs/contexts/rewards/rule-vectors. BalancePolicy and a client copy in the web habits domain both run every case, so the two can't drift.
  • Today screen: a strip above the habits shows vitality, today's pending nectar and pollen, and the totals earned so far.
    • Pending earnings are predicted from today's open periods: habits whose period ends today and is met, plus perfect-day pollen when every one of them is met. They update at once on check-in and undo, offline too.
    • A weekly goal earns on the last day of its week, as on the server.
  • Application: a RewardsApi port loaded with the habits. If Rewards fails, habits still load and the last values stay.

The strip lives in the Habits web feature because this page is the today screen; ARCHITECTURE 12.1 lets a feature use several contexts' contracts.

Checked in the browser as the end-to-end test user: vitality 47 and totals 5 nectar / 15 pollen as on the server; a check-in showed +10 nectar, +15 pollen and "Perfect day so far", and undo returned it to +0.

🤖 Generated with Claude Code

- **Rule vectors:** Rewards publishes the day-earnings rule (`rewards.day_earnings`, 10 cases) in `libs/contexts/rewards/rule-vectors`. `BalancePolicy` and a client copy in the web habits domain both run every case, so the two can't drift. - **Today screen:** a strip above the habits shows vitality, today's pending nectar and pollen, and the totals earned so far. - Pending earnings are predicted from today's open periods: habits whose period ends today and is met, plus perfect-day pollen when every one of them is met. They update at once on check-in and undo, offline too. - A weekly goal earns on the last day of its week, as on the server. - **Application:** a `RewardsApi` port loaded with the habits. If Rewards fails, habits still load and the last values stay. The strip lives in the Habits web feature because this page is the today screen; ARCHITECTURE 12.1 lets a feature use several contexts' contracts. Checked in the browser as the end-to-end test user: vitality 47 and totals 5 nectar / 15 pollen as on the server; a check-in showed +10 nectar, +15 pollen and "Perfect day so far", and undo returned it to +0. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Rewards publishes the day-earnings rule as vectors; the balance policy and a
client copy in the web habits domain both run them. The today screen loads
the keeper's vitality and totals, and predicts what tonight's close will
credit from the open periods, updating on check-in and undo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
alex added 20 commits 2026-10-31 08:59:36 +01:00
@habitea/platform/frontend/ui holds atoms, molecules, organisms and templates
over Ionic and the design tokens. Lint keeps each level to lower levels,
keeps the library presentational, and stops features importing Ionic. The
today page is rebuilt from it with two feature organisms, the habit row and
the rewards summary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Archiving stops tracking from the user's today: entries and renames are
refused, days before it are still judged, and the list leaves it out. Entry
handlers read the week start from the tracker instead of assuming Monday.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every Habits command now has a client use case: the domain refuses what the
server would, with the same codes, and the state shows the result at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New habit form (Signal Forms) for check, amount and avoid goals on daily,
weekday and weekly schedules; goal-aware rows (+1, I slipped, undo, period
progress); a habit page to log an amount, rename and archive; a settings page
with the tracker and vacations. ICU plurals through transloco-messageformat.
The design system gains number, date, segment and chip fields that work as
Signal Forms controls, a chip select, a section and a page back button.
Ionic's element resets move to the base layer so utilities apply.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keeper (stores, items, vitality from Rewards) and Hive (queen genome, colony,
honey) aggregates. Hives settle lazily from elapsed time with ColonyPolicy v1,
shared as rule vectors; harvesting takes the gentleness share and a handler
credits the keeper. Rewards' credited days and vitality arrive through an
anti-corruption layer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The apiary page opens the keeper's apiary on first visit and shows the stores,
a Phaser scene of the starter hive in Andalusia (bees by colony strength,
pace by vitality, a jar filling with honey, tap to harvest), the hive's honey
and colony meters, and the queen's traits. Honey rises on screen between
loads through the client copy of the colony rule, checked against the
Apiary's rule vectors. Phaser loads only with the apiary route and is kept
in ui/src/game by lint. The dev proxy now matches /api/ only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Identity context wraps better-auth inside the API: email and password
accounts, external OpenID Connect providers from configuration, cookie
sessions, ULID user ids, tables in the identity schema planned by better-auth
and applied by our migrate step, telemetry off. A session actor resolver
feeds the existing ActorGuard; AUTH_MODE=dev keeps the header for scripts.
The web app gains sign-in, sign-up and account pages, guarded routes, a
session loaded before the first route, and refuses to sign out while changes
wait in the offline queue.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Breeding costs 15 pollen and raises a queen from a mother colony on an open
flight (Andalusia's wild drones) or a controlled one: half of each trait from
each side, seeded mutations, reproducible from the breeding's id. Queens wait
in a reserve and can head the hive; the replaced queen returns to the reserve.
New species are discovered along the way. Each step is its own transaction,
chained by the apiary's own events. The app breeds, installs, waits for the
server to catch up, and tints the bees with their queen's colours.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The hive scene becomes a floating voxel island in Andalusia: grass, dirt and
stone blocks, an olive tree, a lavender crop, and a wooden hive whose workers
beat their wings in their queen's colours. Every texture is painted at start-up
from pixel maps and scaled up without smoothing.

The whole Apiary page wears a new pixel skin from the design system: bevelled
panels, inventory slots, segmented bars, pixel buttons and notes, and the
Pixelify Sans font. A bee codex shows the species found so far. The look takes
after the Minecraft bee mods that inspired the game, with art of our own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The voxel island now fills the page at the largest whole-number scale that
still shows it, under a sky with distant islets. A heads-up display sits over
the scene: the hive and its harvest, the stores, a hotbar of menus, and the
biome. The queen, breeding, reserve and codex open as pixel drawers that slide
in from the left or the right; Escape closes them.

The design system gains hab-game-layout, hab-pixel-drawer and hab-slot-button,
and the pixel panel can go without a heading or with compact padding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/12
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/11
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/10
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/9
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/8
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/7
Reviewed-on: https://git.selene.acl.sh/Habitea/App/pulls/6
alex merged commit da95bee2a3 into main 2026-10-31 08:59:40 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Habitea/App!5
No description provided.