From 246e54f97082ed98b7fe3001fb3e6ad638cb5e40 Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Wed, 21 Jan 2026 10:19:34 +0100 Subject: [PATCH] Update task mode UI details --- .../js/admin/i18n/locales/de/management.json | 11 +-- .../js/admin/i18n/locales/en/management.json | 11 +-- resources/js/admin/mobile/EventTasksPage.tsx | 75 ++++++++++++------- .../mobile/__tests__/EventTasksPage.test.tsx | 6 +- 4 files changed, 62 insertions(+), 41 deletions(-) diff --git a/resources/js/admin/i18n/locales/de/management.json b/resources/js/admin/i18n/locales/de/management.json index c2765aa..5f8215e 100644 --- a/resources/js/admin/i18n/locales/de/management.json +++ b/resources/js/admin/i18n/locales/de/management.json @@ -537,13 +537,13 @@ "disabledTitle": "Fotoaufgaben-Modus ist für dieses Event aus", "disabledBody": "Gäste sehen nur den Fotofeed. Aktiviere Fotoaufgaben in den Event-Einstellungen, um sie wieder anzuzeigen.", "toggle": { - "title": "Fotoaufgaben für dieses Event", - "description": "Gib Gästen optionale Fotoaufgaben und kleine Foto-Ideen.", + "title": "Fotoaufgaben-Modus", + "description": "Steuere, ob Gäste Mission Cards und Fotoideen sehen.", "active": "AKTIV", "inactive": "INAKTIV", - "onLabel": "Gäste sehen Fotoaufgaben", - "offLabel": "Gäste sehen nur Fotos", - "switchLabel": "Fotoaufgaben aktiv", + "onLabel": "Mission Cards aktiv", + "offLabel": "Nur Fotofeed", + "switchLabel": "Fotoaufgaben für Gäste", "enabled": "Fotoaufgaben aktiviert", "disabled": "Fotoaufgaben deaktiviert", "permissionHint": "Du hast keine Berechtigung, Fotoaufgaben zu ändern." @@ -561,6 +561,7 @@ "limitReached": "Fotoaufgaben-Limit erreicht.", "limitReachedHint": "Dieses Event erlaubt maximal {{count}} Fotoaufgaben.", "limitRemaining": "{{count}} von {{total}} Fotoaufgaben verfügbar.", + "remainingIndicator": "{{count}} / {{total}} übrig", "limitSkipped": "{{count}} Fotoaufgaben wegen Limit übersprungen.", "created": "Fotoaufgabe gespeichert", "removed": "Fotoaufgabe entfernt", diff --git a/resources/js/admin/i18n/locales/en/management.json b/resources/js/admin/i18n/locales/en/management.json index 85c76f5..f4a2ad7 100644 --- a/resources/js/admin/i18n/locales/en/management.json +++ b/resources/js/admin/i18n/locales/en/management.json @@ -533,13 +533,13 @@ "disabledTitle": "Photo tasks mode is off for this event", "disabledBody": "Guests only see the photo feed. Enable photo tasks in the event settings to show them again.", "toggle": { - "title": "Photo tasks for this event", - "description": "Give guests optional photo tasks and prompts.", + "title": "Photo task mode", + "description": "Control whether guests see mission cards and prompts.", "active": "ACTIVE", "inactive": "INACTIVE", - "onLabel": "Guests see photo tasks", - "offLabel": "Guest app shows photos only", - "switchLabel": "Photo tasks enabled", + "onLabel": "Mission cards active", + "offLabel": "Photo feed only", + "switchLabel": "Photo tasks for guests", "enabled": "Photo tasks activated", "disabled": "Photo tasks disabled", "permissionHint": "You do not have permission to change photo tasks." @@ -557,6 +557,7 @@ "limitReached": "Photo task limit reached.", "limitReachedHint": "This event allows up to {{count}} photo tasks.", "limitRemaining": "{{count}} of {{total}} photo tasks remaining.", + "remainingIndicator": "{{count}} / {{total}} tasks remaining", "limitSkipped": "Skipped {{count}} tasks due to limit.", "created": "Photo task saved", "removed": "Photo task removed", diff --git a/resources/js/admin/mobile/EventTasksPage.tsx b/resources/js/admin/mobile/EventTasksPage.tsx index 4d8b888..8b54ae1 100644 --- a/resources/js/admin/mobile/EventTasksPage.tsx +++ b/resources/js/admin/mobile/EventTasksPage.tsx @@ -206,11 +206,15 @@ export default function MobileEventTasksPage() { return typeof limit === 'number' && Number.isFinite(limit) ? limit : null; }, [eventRecord?.limits?.tasks?.limit]); const remainingTasks = React.useMemo(() => { + const remaining = eventRecord?.limits?.tasks?.remaining; + if (typeof remaining === 'number' && Number.isFinite(remaining)) { + return Math.max(0, remaining); + } if (maxTasks === null) { return null; } return Math.max(0, maxTasks - assignedTasks.length); - }, [assignedTasks.length, maxTasks]); + }, [assignedTasks.length, eventRecord?.limits?.tasks?.remaining, maxTasks]); const canAddTasks = maxTasks === null || (remainingTasks ?? 0) > 0; const limitReachedMessage = t('events.tasks.limitReached', 'Photo task limit reached.'); const limitReachedHint = @@ -781,9 +785,19 @@ export default function MobileEventTasksPage() { ) : ( - - {t('events.tasks.count', '{{count}} photo tasks', { count: filteredTasks.length })} - + + + {t('events.tasks.count', '{{count}} photo tasks', { count: filteredTasks.length })} + + {typeof remainingTasks === 'number' && typeof maxTasks === 'number' ? ( + + ) : null} + {selectionMode ? ( @@ -977,7 +991,7 @@ export default function MobileEventTasksPage() { - {t('events.tasks.toggle.title', 'Photo tasks for this event')} + {t('events.tasks.toggle.title', 'Photo task mode')} {tasksEnabled @@ -985,21 +999,13 @@ export default function MobileEventTasksPage() { : t('events.tasks.toggle.inactive', 'INACTIVE')} - {showTaskDetails ? ( - - {t( - 'events.tasks.toggle.description', - 'Give guests optional photo tasks and prompts.' - )} - - ) : null} setShowTaskDetails((prev) => !prev)} aria-label={t( 'events.tasks.toggle.description', - 'Give guests optional photo tasks and prompts.' + 'Control whether guests see mission cards and prompts.' )} > - - - {showTaskDetails ? ( - - {tasksEnabled - ? t('events.tasks.toggle.onLabel', 'Guests see photo tasks') - : t('events.tasks.toggle.offLabel', 'Guest app shows photos only')} - + + + {t( + 'events.tasks.toggle.description', + 'Control whether guests see mission cards and prompts.' + )} + + + + {t('events.tasks.toggle.switchLabel', 'Photo tasks for guests')} + + + + + + + {tasksEnabled + ? t('events.tasks.toggle.onLabel', 'Mission cards active') + : t('events.tasks.toggle.offLabel', 'Photo feed only')} + + ) : null} {isMember && !canManageTasks ? ( diff --git a/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx b/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx index 07cd2e6..a100b21 100644 --- a/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx +++ b/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx @@ -275,7 +275,7 @@ describe('MobileEventTasksPage', () => { it('renders the quick jump chips and photo task header', async () => { render(); - expect(await screen.findByText('Photo tasks for this event')).toBeInTheDocument(); + expect(await screen.findByText('Photo task mode')).toBeInTheDocument(); expect(screen.getByText('Quick jump')).toBeInTheDocument(); expect(screen.getByText('assigned')).toBeInTheDocument(); expect(screen.getByPlaceholderText('Search photo tasks')).toBeInTheDocument(); @@ -289,8 +289,8 @@ describe('MobileEventTasksPage', () => { it('toggles task details in the hero section', async () => { render(); - const detailsLabel = 'Give guests optional photo tasks and prompts.'; - expect(await screen.findByText('Photo tasks for this event')).toBeInTheDocument(); + const detailsLabel = 'Control whether guests see mission cards and prompts.'; + expect(await screen.findByText('Photo task mode')).toBeInTheDocument(); expect(screen.queryByText(detailsLabel)).not.toBeInTheDocument(); fireEvent.click(screen.getByLabelText(detailsLabel));