From 402489c928eafa23531f070ae2c2fdfde4ab0b23 Mon Sep 17 00:00:00 2001 From: mohamad Date: Sun, 8 Jun 2025 01:32:53 +0200 Subject: [PATCH] feat: Enhance ChoresPage with detail and history modals This update introduces new functionality to the ChoresPage, including: - Added modals for viewing chore details and history. - Implemented loading states for assignments and history. - Enhanced chore display with assignment and completion details. - Introduced new types for chore assignments and history. - Improved UI with badges for overdue and due-today statuses. These changes improve user experience by providing more context and information about chores and their assignments. --- fe/src/pages/ChoresPage.vue | 441 +++++++++++++++++++++++++++++++++++- 1 file changed, 432 insertions(+), 9 deletions(-) diff --git a/fe/src/pages/ChoresPage.vue b/fe/src/pages/ChoresPage.vue index 15f4e30..2952a03 100644 --- a/fe/src/pages/ChoresPage.vue +++ b/fe/src/pages/ChoresPage.vue @@ -1,10 +1,10 @@ @@ -679,4 +894,212 @@ const toggleCompletion = async (chore: ChoreWithCompletion) => { transform: scaleX(1); transform-origin: left; } + +/* New styles for enhanced UX */ +.chore-main-info { + display: flex; + align-items: center; + gap: 0.5rem; + flex-wrap: wrap; +} + +.chore-badges { + display: flex; + gap: 0.25rem; +} + +.badge { + font-size: 0.75rem; + padding: 0.125rem 0.375rem; + border-radius: 0.25rem; + font-weight: 500; + text-transform: uppercase; + letter-spacing: 0.025em; +} + +.badge-group { + background-color: #3b82f6; + color: white; +} + +.badge-overdue { + background-color: #ef4444; + color: white; +} + +.badge-due-today { + background-color: #f59e0b; + color: white; +} + +.chore-description { + font-size: 0.875rem; + color: var(--dark); + opacity: 0.8; + margin-top: 0.25rem; + font-style: italic; +} + +/* Status-based styling */ +.status-overdue { + border-left: 4px solid #ef4444; +} + +.status-due-today { + border-left: 4px solid #f59e0b; +} + +.status-completed { + opacity: 0.7; +} + +/* Modal styles */ +.detail-modal .modal-container, +.history-modal .modal-container { + max-width: 600px; + max-height: 80vh; + overflow-y: auto; +} + +.detail-section { + margin-bottom: 1.5rem; +} + +.detail-section h4 { + margin-bottom: 0.75rem; + font-weight: 600; + color: var(--dark); + border-bottom: 1px solid #e5e7eb; + padding-bottom: 0.25rem; +} + +.detail-grid { + display: grid; + grid-template-columns: 1fr 1fr; + gap: 0.75rem; +} + +.detail-item { + display: flex; + flex-direction: column; + gap: 0.25rem; +} + +.detail-item.full-width { + grid-column: 1 / -1; +} + +.detail-item .label { + font-weight: 600; + font-size: 0.875rem; + color: var(--dark); + opacity: 0.8; +} + +.detail-item .value { + font-size: 0.875rem; + color: var(--dark); +} + +.assignments-list { + display: flex; + flex-direction: column; + gap: 0.75rem; +} + +.assignment-item { + padding: 0.75rem; + border: 1px solid #e5e7eb; + border-radius: 0.5rem; + background-color: #f9fafb; +} + +.assignment-main { + display: flex; + justify-content: space-between; + align-items: center; + margin-bottom: 0.5rem; +} + +.assigned-user { + font-weight: 500; + color: var(--dark); +} + +.assignment-status { + font-size: 0.875rem; + padding: 0.25rem 0.5rem; + border-radius: 0.25rem; + background-color: #fbbf24; + color: white; +} + +.assignment-status.completed { + background-color: #10b981; +} + +.assignment-details { + display: flex; + flex-direction: column; + gap: 0.25rem; + font-size: 0.875rem; + color: var(--dark); + opacity: 0.8; +} + +.history-list { + display: flex; + flex-direction: column; + gap: 0.5rem; +} + +.history-item { + padding: 0.75rem; + border-left: 3px solid #e5e7eb; + background-color: #f9fafb; + border-radius: 0 0.25rem 0.25rem 0; +} + +.history-text { + font-size: 0.875rem; + color: var(--dark); +} + +.history-data { + margin-top: 0.5rem; +} + +.history-data details { + font-size: 0.75rem; +} + +.history-data summary { + cursor: pointer; + color: var(--primary); + font-weight: 500; +} + +.history-data pre { + margin-top: 0.25rem; + padding: 0.5rem; + background-color: #f3f4f6; + border-radius: 0.25rem; + font-size: 0.75rem; + overflow-x: auto; +} + +.loading-spinner { + text-align: center; + padding: 1rem; + color: var(--dark); + opacity: 0.7; +} + +.no-data { + text-align: center; + padding: 1rem; + color: var(--dark); + opacity: 0.7; + font-style: italic; +}