@mytec: iter7 ready for test
This commit is contained in:
@@ -26,6 +26,10 @@ interface SitesState {
|
||||
|
||||
// Multi-sector
|
||||
cloneSiteAsSectors: (siteId: string, sectorCount: 2 | 3) => Promise<void>;
|
||||
cloneSector: (siteId: string) => Promise<void>;
|
||||
|
||||
// Import/export
|
||||
importSites: (sitesData: SiteFormData[]) => Promise<number>;
|
||||
|
||||
// Batch operations
|
||||
toggleSiteSelection: (siteId: string) => void;
|
||||
@@ -141,6 +145,42 @@ export const useSitesStore = create<SitesState>((set, get) => ({
|
||||
}
|
||||
},
|
||||
|
||||
// Clone a single sector: duplicate site with 30° azimuth offset
|
||||
cloneSector: async (siteId: string) => {
|
||||
const source = get().sites.find((s) => s.id === siteId);
|
||||
if (!source) return;
|
||||
|
||||
const addSite = get().addSite;
|
||||
const newAzimuth = ((source.azimuth ?? 0) + 30) % 360;
|
||||
|
||||
await addSite({
|
||||
name: `${source.name}-clone`,
|
||||
lat: source.lat,
|
||||
lon: source.lon,
|
||||
height: source.height,
|
||||
power: source.power,
|
||||
gain: source.gain,
|
||||
frequency: source.frequency,
|
||||
antennaType: source.antennaType,
|
||||
azimuth: newAzimuth,
|
||||
beamwidth: source.beamwidth,
|
||||
color: '',
|
||||
visible: true,
|
||||
notes: source.notes ? `Clone of: ${source.notes}` : `Clone of ${source.name}`,
|
||||
});
|
||||
},
|
||||
|
||||
// Import sites from parsed data
|
||||
importSites: async (sitesData: SiteFormData[]) => {
|
||||
const addSite = get().addSite;
|
||||
let count = 0;
|
||||
for (const data of sitesData) {
|
||||
await addSite(data);
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
},
|
||||
|
||||
// Batch operations
|
||||
toggleSiteSelection: (siteId: string) => {
|
||||
set((state) => {
|
||||
|
||||
Reference in New Issue
Block a user