Link am Betrieb hinzugefügt

This commit is contained in:
2025-11-10 18:37:37 +01:00
parent aaf83eeb95
commit 2d0bd825a6

View File

@@ -240,7 +240,7 @@ const StoreWatchPage = ({ authorizedFetch, knownStores = [], userLocation }) =>
const storeId = String(store.id || store.storeId); const storeId = String(store.id || store.storeId);
const existing = prev.find((entry) => entry.storeId === storeId); const existing = prev.find((entry) => entry.storeId === storeId);
if (checked) { if (checked) {
if (existing) { if (store.isOpen || existing) {
return prev; return prev;
} }
setDirty(true); setDirty(true);
@@ -323,10 +323,27 @@ const StoreWatchPage = ({ authorizedFetch, knownStores = [], userLocation }) =>
</div> </div>
), ),
cell: ({ row }) => ( cell: ({ row }) => (
<div className="flex items-start justify-between gap-3">
<div> <div>
<p className="font-medium text-gray-900">{row.original.name}</p> <p className="font-medium text-gray-900 flex items-center gap-2">
{row.original.name}
</p>
<p className="text-xs text-gray-500">#{row.original.id}</p> <p className="text-xs text-gray-500">#{row.original.id}</p>
</div> </div>
<a
href={`https://foodsharing.de/store/${row.original.id}`}
target="_blank"
rel="noopener noreferrer"
className="text-gray-400 hover:text-blue-600"
title="Store öffnen"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" viewBox="0 0 20 20" fill="currentColor">
<path d="M12.293 2.293a1 1 0 011.414 0L18 6.586V7a1 1 0 01-1 1h-.586l-3.707-3.707a1 1 0 010-1.414z" />
<path d="M3 5a2 2 0 012-2h5a1 1 0 010 2H5v10h10v-5a1 1 0 112 0v5a2 2 0 01-2 2H5a2 2 0 01-2-2V5z" />
<path d="M11 3a1 1 0 100 2h2v2a1 1 0 102 0V4a1 1 0 00-1-1h-3z" />
</svg>
</a>
</div>
), ),
sortingFn: 'alphanumeric', sortingFn: 'alphanumeric',
enableColumnFilter: true, enableColumnFilter: true,
@@ -380,7 +397,7 @@ const StoreWatchPage = ({ authorizedFetch, knownStores = [], userLocation }) =>
const label = value const label = value
? new Date(value).toLocaleDateString('de-DE', { year: 'numeric', month: '2-digit', day: '2-digit' }) ? new Date(value).toLocaleDateString('de-DE', { year: 'numeric', month: '2-digit', day: '2-digit' })
: ''; : '';
return <div className="text-center font-mono text-xs text-gray-600">{label}</div>; return <div className="text-center text-xs text-gray-700 tracking-wide">{label}</div>;
}, },
sortingFn: (rowA, rowB, columnId) => { sortingFn: (rowA, rowB, columnId) => {
const a = rowA.getValue(columnId); const a = rowA.getValue(columnId);
@@ -541,6 +558,7 @@ const StoreWatchPage = ({ authorizedFetch, knownStores = [], userLocation }) =>
cell: ({ row }) => { cell: ({ row }) => {
const store = row.original; const store = row.original;
const checked = watchedIds.has(String(store.id)); const checked = watchedIds.has(String(store.id));
const disabled = store.isOpen;
return ( return (
<div className="text-center"> <div className="text-center">
<input <input
@@ -548,6 +566,10 @@ const StoreWatchPage = ({ authorizedFetch, knownStores = [], userLocation }) =>
className="h-5 w-5" className="h-5 w-5"
checked={checked} checked={checked}
onChange={(event) => handleToggleStore(store, event.target.checked)} onChange={(event) => handleToggleStore(store, event.target.checked)}
disabled={disabled}
title={
disabled ? 'Store ist bereits offen Überwachung nicht verfügbar.' : undefined
}
/> />
</div> </div>
); );