fix: buttons not working

This commit is contained in:
2025-11-10 11:46:26 +01:00
parent a501bb0ca1
commit f1d5d6bfee
2 changed files with 21 additions and 13 deletions

View File

@@ -681,7 +681,7 @@ function App() {
}; };
}, [isDirty]); }, [isDirty]);
const persistConfigUpdate = async (updater, successMessage) => { const persistConfigUpdate = async (updater, successMessage, { autoCommit = false } = {}) => {
if (!session?.token) { if (!session?.token) {
return; return;
} }
@@ -693,6 +693,9 @@ function App() {
if (!nextConfigState) { if (!nextConfigState) {
return; return;
} }
if (!autoCommit) {
setIsDirty(true);
}
setStatus('Speichere...'); setStatus('Speichere...');
setError(''); setError('');
try { try {
@@ -714,6 +717,9 @@ function App() {
setIsDirty(false); setIsDirty(false);
} catch (err) { } catch (err) {
setError(`Fehler beim Speichern: ${err.message}`); setError(`Fehler beim Speichern: ${err.message}`);
if (autoCommit) {
setIsDirty(true);
}
} }
}; };
@@ -727,10 +733,10 @@ function App() {
if (!confirmed) { if (!confirmed) {
return; return;
} }
setIsDirty(true);
await persistConfigUpdate( await persistConfigUpdate(
(prev) => prev.filter((item) => item.id !== entryId), (prev) => prev.filter((item) => item.id !== entryId),
'Eintrag gelöscht!' 'Eintrag gelöscht!',
{ autoCommit: true }
); );
}; };
@@ -743,10 +749,10 @@ function App() {
if (!confirmed) { if (!confirmed) {
return; return;
} }
setIsDirty(true);
await persistConfigUpdate( await persistConfigUpdate(
(prev) => prev.map((item) => (item.id === entryId ? { ...item, hidden: true } : item)), (prev) => prev.map((item) => (item.id === entryId ? { ...item, hidden: true } : item)),
'Betrieb ausgeblendet.' 'Betrieb ausgeblendet.',
{ autoCommit: true }
); );
}; };
@@ -898,9 +904,7 @@ function App() {
if (!confirmed) { if (!confirmed) {
return; return;
} }
setIsDirty(true);
const message = existing ? 'Betrieb wieder eingeblendet.' : 'Betrieb zur Liste hinzugefügt.'; const message = existing ? 'Betrieb wieder eingeblendet.' : 'Betrieb zur Liste hinzugefügt.';
setIsDirty(true);
await persistConfigUpdate( await persistConfigUpdate(
(prev) => { (prev) => {
const already = prev.find((item) => item.id === storeId); const already = prev.find((item) => item.id === storeId);
@@ -927,7 +931,8 @@ function App() {
} }
]; ];
}, },
message message,
{ autoCommit: true }
); );
setFocusedStoreId(storeId); setFocusedStoreId(storeId);
}; };

View File

@@ -43,14 +43,17 @@ const DashboardView = ({
return; return;
} }
row.scrollIntoView({ behavior: 'smooth', block: 'center' }); row.scrollIntoView({ behavior: 'smooth', block: 'center' });
row.classList.add('ring-2', 'ring-blue-400', 'bg-yellow-100'); row.classList.add('ring-4', 'ring-blue-400', 'bg-blue-50', 'transition');
row.style.transition = 'background-color 0.8s ease, box-shadow 0.8s ease';
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
row.classList.remove('ring-2', 'ring-blue-400', 'bg-yellow-100'); row.classList.remove('ring-4', 'ring-blue-400');
onClearFocus(); row.style.backgroundColor = 'transparent';
}, 3000); setTimeout(onClearFocus, 600);
}, 2200);
return () => { return () => {
clearTimeout(timeout); clearTimeout(timeout);
row.classList.remove('ring-2', 'ring-blue-400', 'bg-yellow-100'); row.classList.remove('ring-4', 'ring-blue-400');
row.style.backgroundColor = 'transparent';
}; };
}, [focusedStoreId, onClearFocus]); }, [focusedStoreId, onClearFocus]);
const { const {