fix: buttons not working

This commit is contained in:
2025-11-10 11:22:58 +01:00
parent bf160febee
commit 6df5cb35de
2 changed files with 26 additions and 2 deletions

View File

@@ -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)}
/>
);

View File

@@ -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 (
<tr key={item.id || index} className={index % 2 === 0 ? 'bg-gray-50' : 'bg-white'}>
<tr
key={item.id || index}
data-store-row={item.id}
className={index % 2 === 0 ? 'bg-gray-50' : 'bg-white'}
>
<td className="px-4 py-2 text-center">
<input
type="checkbox"