@mytec: iter5 ready for test

This commit is contained in:
2026-01-30 12:12:13 +02:00
parent 1a3c3e0f11
commit a03e9746d4
6 changed files with 124 additions and 44 deletions

View File

@@ -3,7 +3,11 @@ import { useSitesStore } from '@/store/sites.ts';
import { useToastStore } from '@/components/ui/Toast.tsx';
import Button from '@/components/ui/Button.tsx';
export default function BatchEdit() {
interface BatchEditProps {
onBatchApplied?: (affectedIds: string[]) => void;
}
export default function BatchEdit({ onBatchApplied }: BatchEditProps) {
const selectedSiteIds = useSitesStore((s) => s.selectedSiteIds);
const batchUpdateHeight = useSitesStore((s) => s.batchUpdateHeight);
const batchSetHeight = useSitesStore((s) => s.batchSetHeight);
@@ -15,9 +19,11 @@ export default function BatchEdit() {
if (selectedSiteIds.length === 0) return null;
const handleAdjustHeight = async (delta: number) => {
const ids = [...selectedSiteIds];
await batchUpdateHeight(delta);
onBatchApplied?.(ids);
addToast(
`Adjusted ${selectedSiteIds.length} site(s) by ${delta > 0 ? '+' : ''}${delta}m`,
`Updated ${ids.length} site(s) by ${delta > 0 ? '+' : ''}${delta}m`,
'success'
);
};
@@ -28,8 +34,10 @@ export default function BatchEdit() {
addToast('Height must be between 1-100m', 'error');
return;
}
const ids = [...selectedSiteIds];
await batchSetHeight(height);
addToast(`Set ${selectedSiteIds.length} site(s) to ${height}m`, 'success');
onBatchApplied?.(ids);
addToast(`Set ${ids.length} site(s) to ${height}m`, 'success');
setCustomHeight('');
};