Skip to content

Implement drink window alerts system #80

@fusion94

Description

@fusion94

Description

Build a system to identify and alert users about wines approaching, within, or past their optimal drink window.

Requirements

Drink Window Logic

Based on drink_from and drink_to fields on wines, calculate status for each bottle:

  • Too Young: Current year < drink_from (wine not yet ready)
  • Entering Window: drink_from = current year (just became ready this year)
  • Ready to Drink: drink_from <= current year <= drink_to (optimal window)
  • Approaching Peak End: drink_to - current year <= 1 (last year of window)
  • Past Peak: current year > drink_to (past optimal window, still in stock)
  • Unknown: drink_from and drink_to are both null (no drink window set)

Backend (covered partially by dashboard stats API)

  • Drink window calculation utility function (reusable)
  • Filter support: wines can be filtered by drink window status in search
  • Alerts API returns wines entering window and past peak

Frontend

  • Dashboard alerts widget: Prominent display of wines entering window and past peak
  • Drink window badge: Visual indicator on wine cards/list (color-coded)
    • Green: Ready to Drink
    • Yellow: Entering Window / Approaching Peak End
    • Red: Past Peak
    • Gray: Too Young / Unknown
  • Wine list filter: Filter by drink window status
  • Wine detail display: Show drink window timeline/bar visualization
  • Notification dot: Badge on dashboard nav showing alert count

Visual Drink Window Bar

On wine detail page, show a timeline bar:

[===Too Young===|===Ready to Drink===|===Past Peak===]
                    ^ You are here (2026)

Acceptance Criteria

  • Drink window status calculated correctly for all scenarios
  • Dashboard shows wines entering window and past peak
  • Wine cards show drink window badges
  • Wine list can be filtered by drink window status
  • Wine detail shows visual drink window timeline
  • Bottles with no drink window show "Unknown" gracefully
  • Alerts count shown on dashboard navigation

References

  • PRD Section 3: US-8 (User Stories — approaching optimal drink window)
  • PRD Section 4: FR-6 (Drink window alerts in Dashboard)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendFastify API, services, middlewarearea:frontendReact SPA, UI componentstype:featureNew feature or capability

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions