fix: buttons not working
This commit is contained in:
@@ -39,6 +39,7 @@ function App() {
|
|||||||
const [confirmDialog, setConfirmDialog] = useState({ open: false, resolve: null });
|
const [confirmDialog, setConfirmDialog] = useState({ open: false, resolve: null });
|
||||||
const [activeRangePicker, setActiveRangePicker] = useState(null);
|
const [activeRangePicker, setActiveRangePicker] = useState(null);
|
||||||
const [notificationPanelOpen, setNotificationPanelOpen] = useState(false);
|
const [notificationPanelOpen, setNotificationPanelOpen] = useState(false);
|
||||||
|
const [focusedStoreId, setFocusedStoreId] = useState(null);
|
||||||
const minSelectableDate = useMemo(() => startOfDay(new Date()), []);
|
const minSelectableDate = useMemo(() => startOfDay(new Date()), []);
|
||||||
|
|
||||||
const weekdays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
|
const weekdays = ['Montag', 'Dienstag', 'Mittwoch', 'Donnerstag', 'Freitag', 'Samstag', 'Sonntag'];
|
||||||
@@ -886,6 +887,7 @@ function App() {
|
|||||||
const storeId = String(store.id);
|
const storeId = String(store.id);
|
||||||
const existing = configMap.get(storeId);
|
const existing = configMap.get(storeId);
|
||||||
if (existing && !existing.hidden) {
|
if (existing && !existing.hidden) {
|
||||||
|
setFocusedStoreId(storeId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const confirmed = await askConfirmation({
|
const confirmed = await askConfirmation({
|
||||||
@@ -927,6 +929,7 @@ function App() {
|
|||||||
},
|
},
|
||||||
message
|
message
|
||||||
);
|
);
|
||||||
|
setFocusedStoreId(storeId);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAdminSettingChange = (field, value, isNumber = false) => {
|
const handleAdminSettingChange = (field, value, isNumber = false) => {
|
||||||
@@ -1152,6 +1155,8 @@ function App() {
|
|||||||
onHideEntry={hideEntry}
|
onHideEntry={hideEntry}
|
||||||
onDeleteEntry={deleteEntry}
|
onDeleteEntry={deleteEntry}
|
||||||
canDelete={Boolean(session?.isAdmin)}
|
canDelete={Boolean(session?.isAdmin)}
|
||||||
|
focusedStoreId={focusedStoreId}
|
||||||
|
onClearFocus={() => setFocusedStoreId(null)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
import NotificationPanel from './NotificationPanel';
|
import NotificationPanel from './NotificationPanel';
|
||||||
|
|
||||||
const DashboardView = ({
|
const DashboardView = ({
|
||||||
@@ -28,8 +29,22 @@ const DashboardView = ({
|
|||||||
onResetConfig,
|
onResetConfig,
|
||||||
onHideEntry,
|
onHideEntry,
|
||||||
onDeleteEntry,
|
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 {
|
const {
|
||||||
error: notificationError,
|
error: notificationError,
|
||||||
message: notificationMessage,
|
message: notificationMessage,
|
||||||
@@ -212,7 +227,11 @@ const DashboardView = ({
|
|||||||
const rangeEnd = normalizedRange?.end || '';
|
const rangeEnd = normalizedRange?.end || '';
|
||||||
const hasDateRange = Boolean(rangeStart || rangeEnd);
|
const hasDateRange = Boolean(rangeStart || rangeEnd);
|
||||||
return (
|
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">
|
<td className="px-4 py-2 text-center">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
|
|||||||
Reference in New Issue
Block a user