-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
FEAT: Delete Challenge from Dashboard
Type: Feature Request
Context / Problem Statement:
Currently, there is no way for a user to remove a challenge once it has been started or completed from the Dashboard. This leads to a cluttered UI if a user starts a challenge by mistake or wants to clear out old "test" protocols.
User Story:
As a Grit user, I want to be able to delete a challenge directly from my dashboard so that I can keep my active workspace clean and remove any unwanted data.
Proposed Solution:
Add a trash icon to the ChallengeCard component. When clicked, it will trigger a native browser confirmation. Upon confirmation, the challenge and all its associated data will be hard deleted from state/storage.
Acceptance Criteria (AC):
- Add a Trash Can icon (using Lucide-react or similar) to the
ChallengeCard. - Implement a browser-native
window.confirm()dialog asking: "Are you sure you want to delete this challenge? This action is permanent and will remove all progress." - Ensure the deletion is a Hard Delete, removing the challenge object and any filtered logs associated with that specific challenge ID.
- The Dashboard UI must immediately reflect the change (optimistic UI update or state re-fetch).
- If the challenge being deleted is the currently "Active" one, ensure the app handles the state transition gracefully (e.g., redirecting to the setup page or showing an empty state).
Technical Implementation Details:
- Component: Modify
src/components/dashboard/ChallengeCard.tsxto include the delete button. - State/API: Update the global state manager (Zustand/Redux) or API hook (e.g.,
useChallenges) to include adeleteChallenge(id)function. - Cleanup: Ensure that deleting the challenge also clears any
localStoragekeys or database rows tied to thatchallengeIdto prevent data leakage.
Definition of Done (DoD):
- Manual test: Verify that clicking "Cancel" on the alert does nothing.
- Manual test: Verify that clicking "OK" removes the card immediately.
- Persistence check: Refresh the page after deletion to ensure the data does not reappear.
- UI Check: Ensure the trash icon is positioned consistently and doesn't interfere with other card actions (like clicking into the challenge).