diff --git a/client/src/pages/locations/index.tsx b/client/src/pages/locations/index.tsx index 7083d7e..e8c61ba 100644 --- a/client/src/pages/locations/index.tsx +++ b/client/src/pages/locations/index.tsx @@ -305,6 +305,20 @@ function LocationMetaContainer() { return
Failed to load spools
; } + const addNewLocation = () => { + let newLocationName = "New Location"; + + const newLocs = [...locationsList]; + let i = 1; + while (newLocs.includes(newLocationName)) { + newLocationName = "New Location " + i; + i++; + } + newLocs.push(newLocationName); + + setLocationsSetting.mutate(newLocs); + }; + return (
{containers} @@ -317,7 +331,7 @@ function LocationMetaContainer() { style={{ margin: "1em", }} - onClick={() => setLocationsSetting.mutate([...settingsLocations, "New Location"])} + onClick={addNewLocation} />