From 70809d6c27126ee997acaefc4ac45e2efba8f510 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 30 Mar 2026 18:08:22 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20TimezoneWidget=20respects=2012h/24h=20se?= =?UTF-8?q?tting,=20addon=20notification=20toggles,=20cover=20image=20path?= =?UTF-8?q?=20=E2=80=94=20closes=20#147?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Dashboard/TimezoneWidget.tsx | 12 +++++++----- client/src/pages/SettingsPage.tsx | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/src/components/Dashboard/TimezoneWidget.tsx b/client/src/components/Dashboard/TimezoneWidget.tsx index 087937a..f3b3a8e 100644 --- a/client/src/components/Dashboard/TimezoneWidget.tsx +++ b/client/src/components/Dashboard/TimezoneWidget.tsx @@ -1,6 +1,7 @@ import { useState, useEffect } from 'react' import { Clock, Plus, X } from 'lucide-react' import { useTranslation } from '../../i18n' +import { useSettingsStore } from '../../store/settingsStore' const POPULAR_ZONES = [ { label: 'New York', tz: 'America/New_York' }, @@ -23,9 +24,9 @@ const POPULAR_ZONES = [ { label: 'Cairo', tz: 'Africa/Cairo' }, ] -function getTime(tz, locale) { +function getTime(tz, locale, is12h) { try { - return new Date().toLocaleTimeString(locale, { timeZone: tz, hour: '2-digit', minute: '2-digit' }) + return new Date().toLocaleTimeString(locale, { timeZone: tz, hour: '2-digit', minute: '2-digit', hour12: is12h }) } catch { return '—' } } @@ -42,6 +43,7 @@ function getOffset(tz) { export default function TimezoneWidget() { const { t, locale } = useTranslation() + const is12h = useSettingsStore(s => s.settings.time_format) === '12h' const [zones, setZones] = useState(() => { const saved = localStorage.getItem('dashboard_timezones') return saved ? JSON.parse(saved) : [ @@ -87,7 +89,7 @@ export default function TimezoneWidget() { const removeZone = (tz) => setZones(zones.filter(z => z.tz !== tz)) - const localTime = new Date().toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit' }) + const localTime = new Date().toLocaleTimeString(locale, { hour: '2-digit', minute: '2-digit', hour12: is12h }) const rawZone = Intl.DateTimeFormat().resolvedOptions().timeZone const localZone = rawZone.split('/').pop().replace(/_/g, ' ') // Show abbreviated timezone name (e.g. CET, CEST, EST) @@ -113,7 +115,7 @@ export default function TimezoneWidget() { {zones.map(z => (
-

{getTime(z.tz, locale)}

+

{getTime(z.tz, locale, is12h)}

{z.label} {getOffset(z.tz)}

))}
diff --git a/client/src/pages/SettingsPage.tsx b/client/src/pages/SettingsPage.tsx index bc469b1..7ae6bd2 100644 --- a/client/src/pages/SettingsPage.tsx +++ b/client/src/pages/SettingsPage.tsx @@ -70,10 +70,10 @@ function NotificationPreferences({ t, memoriesEnabled }: { t: any; memoriesEnabl const options = [ { key: 'notify_trip_invite', label: t('settings.notifyTripInvite') }, { key: 'notify_booking_change', label: t('settings.notifyBookingChange') }, - ...(addons.vacay !== false ? [{ key: 'notify_vacay_invite', label: t('settings.notifyVacayInvite') }] : []), + ...(addons.vacay ? [{ key: 'notify_vacay_invite', label: t('settings.notifyVacayInvite') }] : []), ...(memoriesEnabled ? [{ key: 'notify_photos_shared', label: t('settings.notifyPhotosShared') }] : []), - ...(addons.collab !== false ? [{ key: 'notify_collab_message', label: t('settings.notifyCollabMessage') }] : []), - ...(addons.documents !== false ? [{ key: 'notify_packing_tagged', label: t('settings.notifyPackingTagged') }] : []), + ...(addons.collab ? [{ key: 'notify_collab_message', label: t('settings.notifyCollabMessage') }] : []), + ...(addons.documents ? [{ key: 'notify_packing_tagged', label: t('settings.notifyPackingTagged') }] : []), { key: 'notify_webhook', label: t('settings.notifyWebhook') }, ]