Skip to content

FEAT: Penalty Day Logic & Dashboard Action Suite #24

@Bana0615

Description

@Bana0615

[FEAT]: Penalty Day Logic & Dashboard Action Suite

Type: Feature Request

Context / Problem Statement:
The current "Grit" engine is pass/fail. For the "75 Balanced" protocol or custom "Allow Penalty" challenges, users need a way to recover from a single mistake without a full restart. Additionally, the "Fail Challenge" action is currently buried in the Settings modal, making it inaccessible for a high-frequency action.

User Story:
As a Grit user, I want to be able to add a penalty day or fail my challenge directly from the dashboard so that I can manage my progress and protocol adherence with high visibility.

Proposed Solution:

  1. State Update: Add allowPenaltyDay: boolean and penaltyUsed: boolean to the challenge schema.
  2. Dynamic End Date: Update the challenge completion logic to calculate the end date as: startDate + duration + (penaltyUsed ? 1 : 0).
  3. Dashboard UI Refactor:
    • Move the "Fail Challenge" button from Settings to the Dashboard.
    • If allowPenaltyDay is true AND penaltyUsed is false, display the "Add Penalty Day" button.
    • If a penalty is already used or not allowed, only show the "Fail Challenge" button.

Acceptance Criteria (AC):

  • Add Allow Penalty Day checkbox to the Challenge Setup Wizard (stored in challenge config).
  • Implement Add Penalty Day button on the /app/ Dashboard.
  • Constraint: The "Add Penalty Day" button must only appear once per challenge. After use, it is replaced by the "Fail Challenge" option.
  • End Date Logic: Ensure the progress bar and "Days Remaining" counter update immediately when a penalty day is added.
  • Fail Button: Move the "Fail Challenge" button to the Dashboard (standardized with a high-contrast/danger style).
  • Add a Confirmation Dialog for adding a penalty: "This will add 1 extra day to your total challenge duration. You only get 1 miss!"

Technical Implementation Details:

  • Store: Update useChallengeStore.ts to include a triggerPenalty() action.
  • Components:
    • Refactor src/components/dashboard/DashboardHeader.tsx or ActiveChallenge.tsx to include the new Action Bar.
    • Update the date utility (likely using date-fns or dayjs) that calculates isExpired or completionDate.
  • Logic: Ensure penaltyUsed is persisted in localStorage or the database.

Definition of Done (DoD):

  • Verify that adding a penalty day shifts the "End Date" by exactly 24 hours.
  • Verify that after one penalty is used, the button disappears and "Fail Challenge" remains the only fallback.
  • Test the "Fail" button to ensure it still triggers the hard reset/deletion logic correctly.
  • UI Check: Ensure the buttons are responsive and don't clutter the mobile view of the Dashboard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions