diff --git a/src/App.js b/src/App.js index 79618bb..7c98656 100644 --- a/src/App.js +++ b/src/App.js @@ -39,6 +39,7 @@ function App() { const [confirmDialog, setConfirmDialog] = useState({ open: false, resolve: null }); const [activeRangePicker, setActiveRangePicker] = useState(null); const [notificationPanelOpen, setNotificationPanelOpen] = useState(false); + const [focusedStoreId, setFocusedStoreId] = useState(null); const minSelectableDate = useMemo(() => startOfDay(new Date()), []); const weekdays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag']; @@ -886,6 +887,7 @@ function App() { const storeId = String(store.id); const existing = configMap.get(storeId); if (existing && !existing.hidden) { + setFocusedStoreId(storeId); return; } const confirmed = await askConfirmation({ @@ -927,6 +929,7 @@ function App() { }, message ); + setFocusedStoreId(storeId); }; const handleAdminSettingChange = (field, value, isNumber = false) => { @@ -1152,6 +1155,8 @@ function App() { onHideEntry={hideEntry} onDeleteEntry={deleteEntry} canDelete={Boolean(session?.isAdmin)} + focusedStoreId={focusedStoreId} + onClearFocus={() => setFocusedStoreId(null)} /> ); diff --git a/src/components/DashboardView.js b/src/components/DashboardView.js index 83350d8..1351acf 100644 --- a/src/components/DashboardView.js +++ b/src/components/DashboardView.js @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import NotificationPanel from './NotificationPanel'; const DashboardView = ({ @@ -28,8 +29,22 @@ const DashboardView = ({ onResetConfig, onHideEntry, onDeleteEntry, - canDelete + canDelete, + focusedStoreId, + onClearFocus }) => { + useEffect(() => { + if (!focusedStoreId) { + return; + } + const row = document.querySelector(`[data-store-row="${focusedStoreId}"]`); + if (row) { + row.scrollIntoView({ behavior: 'smooth', block: 'center' }); + row.classList.add('ring-2', 'ring-blue-400'); + setTimeout(() => row.classList.remove('ring-2', 'ring-blue-400'), 1500); + } + onClearFocus(); + }, [focusedStoreId, onClearFocus]); const { error: notificationError, message: notificationMessage, @@ -212,7 +227,11 @@ const DashboardView = ({ const rangeEnd = normalizedRange?.end || ''; const hasDateRange = Boolean(rangeStart || rangeEnd); return ( -