minor changes

This commit is contained in:
2025-11-10 21:30:43 +01:00
parent 7cdd18bf7f
commit 9a3903b761
4 changed files with 181 additions and 25 deletions

View File

@@ -5,6 +5,7 @@ import './App.css';
import 'react-date-range/dist/styles.css';
import 'react-date-range/dist/theme/default.css';
import { formatDateValue, formatRangeLabel } from './utils/dateUtils';
import { inferLocationLabel } from './utils/locationLabel';
import useSyncProgress from './hooks/useSyncProgress';
import useNotificationSettings from './hooks/useNotificationSettings';
import useConfigManager from './hooks/useConfigManager';
@@ -634,6 +635,31 @@ function App() {
);
}
const userLocationWithLabel = useMemo(() => {
if (!preferences?.location) {
return null;
}
const label = inferLocationLabel(preferences.location, stores);
return label ? { ...preferences.location, label } : { ...preferences.location };
}, [preferences?.location, stores]);
const sharedNotificationProps = {
error: notificationError,
message: notificationMessage,
settings: notificationSettings,
capabilities: notificationCapabilities,
loading: notificationLoading,
dirty: notificationDirty,
saving: notificationSaving,
onReset: loadNotificationSettings,
onSave: saveNotificationSettings,
onFieldChange: handleNotificationFieldChange,
onSendTest: sendNotificationTest,
onCopyLink: copyToClipboard,
copyFeedback,
ntfyPreviewUrl
};
const dashboardContent = (
<DashboardView
session={session}
@@ -641,22 +667,7 @@ function App() {
onLogout={handleLogout}
notificationPanelOpen={notificationPanelOpen}
onToggleNotificationPanel={() => setNotificationPanelOpen((prev) => !prev)}
notificationProps={{
error: notificationError,
message: notificationMessage,
settings: notificationSettings,
capabilities: notificationCapabilities,
loading: notificationLoading,
dirty: notificationDirty,
saving: notificationSaving,
onReset: loadNotificationSettings,
onSave: saveNotificationSettings,
onFieldChange: handleNotificationFieldChange,
onSendTest: sendNotificationTest,
onCopyLink: copyToClipboard,
copyFeedback,
ntfyPreviewUrl
}}
notificationProps={sharedNotificationProps}
stores={stores}
availableCollapsed={availableCollapsed}
onToggleStores={() => setAvailableCollapsed((prev) => !prev)}
@@ -681,7 +692,7 @@ function App() {
canDelete={Boolean(session?.isAdmin)}
focusedStoreId={focusedStoreId}
onClearFocus={() => setFocusedStoreId(null)}
userLocation={preferences?.location || null}
userLocation={userLocationWithLabel}
locationLoading={preferencesLoading}
locationSaving={locationSaving}
locationError={preferencesError}
@@ -721,9 +732,14 @@ function App() {
<StoreWatchPage
authorizedFetch={authorizedFetch}
knownStores={stores}
userLocation={preferences?.location || null}
userLocation={userLocationWithLabel}
locationLoading={preferencesLoading}
locationSaving={locationSaving}
locationError={preferencesError}
onRequestLocation={updateLocation}
notificationPanelOpen={notificationPanelOpen}
onToggleNotificationPanel={() => setNotificationPanelOpen((prev) => !prev)}
notificationProps={sharedNotificationProps}
/>
}
/>