From 27af4dd14b502af96f57188d5e28f6ed905da232 Mon Sep 17 00:00:00 2001 From: Daniel Volz Date: Sat, 27 Dec 2025 23:15:14 +0100 Subject: [PATCH] feat(edit-modal): implement mobile edit modal for medication with responsive design --- frontend/src/App.tsx | 129 ++++++++++++++++++++++++++++++++++++++- frontend/src/styles.css | 131 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 255 insertions(+), 5 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 6fdfd1a..ac69f7a 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -192,6 +192,7 @@ function AppContent() { const [loading, setLoading] = useState(false); const [saving, setSaving] = useState(false); const [editingId, setEditingId] = useState(null); + const [showEditModal, setShowEditModal] = useState(false); const [form, setForm] = useState(defaultForm()); const [range, setRange] = useState<{ start: string; end: string }>({ start: toInputValue(todayIso()), @@ -686,10 +687,15 @@ function AppContent() { startTime: toTimeValue(s.start) })), }); + // Show modal on mobile + if (window.innerWidth <= 768) { + setShowEditModal(true); + } } function resetForm() { setEditingId(null); + setShowEditModal(false); setPendingImage(null); setPendingImagePreview(null); setForm(defaultForm()); @@ -1314,7 +1320,7 @@ function AppContent() { -
+

{editingId ? t('form.editEntry') : t('form.newEntry')}

{t('form.badge')} @@ -2148,8 +2154,8 @@ function AppContent() { {/* Image Lightbox */} {showImageLightbox && selectedMed.imageUrl && ( -
setShowImageLightbox(false)}> - +
{ e.stopPropagation(); setShowImageLightbox(false); }}> + {selectedMed.name}
)} + + {/* Mobile Edit Modal */} + {showEditModal && ( +
setShowEditModal(false)}> +
e.stopPropagation()}> + +
+

{editingId ? t('form.editEntry') : t('form.newEntry')}

+
+
{ saveMedication(e); setShowEditModal(false); }}> + + + + + + + + + +