bug: try to fix some multimap weirdness
Some checks are pending
Verify Latest Dependencies / Verify Latest Dependencies (push) Waiting to run
build and test / wxbox - latest (push) Waiting to run

This commit is contained in:
core 2025-06-02 23:50:59 -04:00
parent 01c00b1e85
commit 7f343319d5
Signed by: core
GPG key ID: FDBF740DADDCEECF
2 changed files with 26 additions and 9 deletions

20
.idea/workspace.xml generated
View file

@ -7,14 +7,17 @@
<cargoProject FILE="$PROJECT_DIR$/Cargo.toml" />
</component>
<component name="ChangeListManager">
<list default="true" id="2d855648-9644-469a-afa2-59beb52bb1d6" name="Changes" comment="feat: new ui" />
<list default="true" id="2d855648-9644-469a-afa2-59beb52bb1d6" name="Changes" comment="bug: try to fix some multimap weirdness">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/client/src/routes/+page.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/client/src/routes/+page.svelte" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DarkyenusTimeTracker">
<option name="totalTimeSeconds" value="23936" />
<option name="totalTimeSeconds" value="25084" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
@ -207,7 +210,15 @@
<option name="project" value="LOCAL" />
<updated>1748921263065</updated>
</task>
<option name="localTasksCounter" value="10" />
<task id="LOCAL-00010" summary="bug: try to fix some multimap weirdness">
<option name="closed" value="true" />
<created>1748921698886</created>
<option name="number" value="00010" />
<option name="presentableId" value="LOCAL-00010" />
<option name="project" value="LOCAL" />
<updated>1748921698886</updated>
</task>
<option name="localTasksCounter" value="11" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -224,6 +235,7 @@
<MESSAGE value="feat: fix singlesite rendering, works on all sites now" />
<MESSAGE value="chore: prep for migration" />
<MESSAGE value="feat: new ui" />
<option name="LAST_COMMIT_MESSAGE" value="feat: new ui" />
<MESSAGE value="bug: try to fix some multimap weirdness" />
<option name="LAST_COMMIT_MESSAGE" value="bug: try to fix some multimap weirdness" />
</component>
</project>

View file

@ -8,16 +8,21 @@
mapNumber: number
}
let mapgeneratornumber = 1;
let maps: MapData[] = $state([{
mapNumber: 1
mapNumber: mapgeneratornumber
}]);
function addMap() {
maps.push({ mapNumber: maps.length + 1 });
maps.push({ mapNumber: ++mapgeneratornumber });
}
function removeThisMapFactory(idx: number) {
return () => {
maps.splice(idx, 1);
for (let i = 0; i < maps.length; i++) {
if (maps[i].mapNumber == idx) {
maps.splice(i, 1);
return;
}
}
}
</script>
@ -25,7 +30,7 @@
<div class="flex min-h-screen min-w-screen flex-row">
{#key maps}
{#each maps as map, i}
<Map {addMap} removeThisMap={removeThisMapFactory(i)} mapNum={i+1} stations={data.stations} categories={data.layers} />
<Map {addMap} removeThisMap={() => {removeThisMapFactory(map.mapNumber)}} mapNum={i+1} stations={data.stations} categories={data.layers} />
{/each}
{/key}
</div>