Skip to content

Comments

Feat archive habit implementation#86

Merged
BrayanMQ merged 4 commits intomainfrom
feat-archive-habit-implementation
Jan 18, 2026
Merged

Feat archive habit implementation#86
BrayanMQ merged 4 commits intomainfrom
feat-archive-habit-implementation

Conversation

@BrayanMQ
Copy link
Owner

📝 Description

This PR implements the "Archive Habit" feature and enhances the management of archived habits by adding restore and permanent delete actions. It also includes UI fixes for better menu visibility and avoids hydration errors in modals.

🔗 Related Issue

Closes #85

🏷️ Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Performance improvement
  • Dependency update

🔄 Changes Made

  • Feature (Archive): Added "Archive" option to the HabitCard actions menu in management mode.
  • Feature (Restore): Added an actions menu to the ArchivedHabitsSection allowing users to "Restore" or "Delete" archived habits.
  • UI: Created ArchiveHabitConfirmModal and RestoreHabitConfirmModal components.
  • Hooks: Implemented useRestoreHabit hook in hooks/useHabits.ts to complement the existing useArchiveHabit logic.
  • Store: Updated useUIStore to manage visibility of the new confirmation modals.
  • I18n: Added translation keys for all new actions and modals in both English (en.json) and Spanish (es.json).

🧪 Testing

  • Manual testing completed:
    • Verified archiving habits from the My Habits page.
    • Verified restoring habits from the Archived section and ensuring they reappear in the active list.
    • Verified permanent deletion of archived habits.
    • Confirmed action menus correctly float above other UI elements.
  • Unit tests added/updated:
    • Verified that existing HabitCard tests pass.
  • Integration tests added/updated

✅ Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (if applicable)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

📸 Screenshots (if applicable)

2026-01-18.11-57-55.mp4

📌 Additional Notes

The archiving system preserves all historical logs and data, allowing for a complete restoration of the streak and progress when a habit is unarchived.

- Updated English and Spanish localization files to include new entries for archiving and restoring habits, enhancing user guidance and experience.
- Added titles, descriptions, and toast messages for both archiving and restoring functionalities, ensuring clarity in user interactions.
- Introduced useRestoreHabit custom hook to restore archived habits by updating the archived_at timestamp.
- Enhanced UI store to manage states for restoring habits, including modal open/close actions.
- Updated query invalidation logic to refresh habit lists upon successful restoration, improving data consistency.
- Added an actions menu for each archived habit, allowing users to restore or delete habits directly from the UI.
- Implemented RestoreHabitConfirmModal for confirming restoration of habits, improving user interaction and feedback.
- Integrated state management for handling selected habits and modal visibility, enhancing overall functionality.
…tionality

- Added ArchiveHabitConfirmModal component for confirming habit archiving actions, enhancing user interaction.
- Updated HabitCard to include an archive button, allowing users to initiate the archiving process directly from the habit list.
- Integrated modal into HabitList for seamless user experience when archiving habits.
@BrayanMQ BrayanMQ linked an issue Jan 18, 2026 that may be closed by this pull request
10 tasks
@BrayanMQ BrayanMQ merged commit 3257e22 into main Jan 18, 2026
1 check passed
@BrayanMQ BrayanMQ deleted the feat-archive-habit-implementation branch January 18, 2026 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Archive Habit Feature Implementation

1 participant