MCPcopy
hub / github.com/cpaczek/skylight / saveCurrentProfile

Function saveCurrentProfile

web/src/control/Control.tsx:100–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

98 const switchToProfile = (p: LocationProfile) =>
99 set({ centerLat: p.lat, centerLon: p.lon, radiusMiles: p.radiusMiles, locationName: p.name });
100 const saveCurrentProfile = () => {
101 const name = cfg.locationName?.trim() || formatLatLon(cfg.centerLat, cfg.centerLon);
102 const profile: LocationProfile = {
103 id: genId(),
104 name,
105 lat: cfg.centerLat,
106 lon: cfg.centerLon,
107 radiusMiles: cfg.radiusMiles,
108 };
109 // Replace any existing profile already saved at this spot.
110 const rest = cfg.locationProfiles.filter((p) => !atCurrent(p));
111 set({ locationProfiles: [...rest, profile] });
112 };
113 const removeProfile = (id: string) =>
114 set({ locationProfiles: cfg.locationProfiles.filter((p) => p.id !== id) });
115 const centerOnTraffic = () => {

Callers

nothing calls this directly

Calls 4

formatLatLonFunction · 0.85
genIdFunction · 0.85
atCurrentFunction · 0.85
setFunction · 0.85

Tested by

no test coverage detected