Skip to content

Commit

Permalink
Disable subscheme deletion with only 1 subscheme
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter York committed Nov 1, 2023
1 parent f9a803c commit 2581b27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
9 changes: 8 additions & 1 deletion src/lib/sidebar/EntireSubscheme.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
let displayDeleteConfirmation = false;
let features: FeatureUnion[] = [];
// @ts-ignore we know subschemes exists because otherwise this wouldn't be rendered
$: disabledSubschemeDeletion = $gjScheme.subschemes?.length < 2;
let numErrors = 0;
onMount(async () => {
Expand Down Expand Up @@ -54,7 +57,11 @@
value={subscheme.name}
on:change={getSubschemeNameUpdater(subscheme.name)}
/>
<WarningButton on:click={() => (displayDeleteConfirmation = true)}>
<p>{disabledSubschemeDeletion.toString()} hello?</p>
<WarningButton
disabled={disabledSubschemeDeletion}
on:click={() => (displayDeleteConfirmation = true)}
>
Delete subscheme
</WarningButton>
<Modal
Expand Down
13 changes: 9 additions & 4 deletions src/lib/sidebar/Superscheme.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,15 @@
console.log(`Failed to load from local storage: ${err}`);
}
} else {
gjScheme.set(backfillSuperscheme({
type: "FeatureCollection",
features: [],
}, authorityName))
gjScheme.set(
backfillSuperscheme(
{
type: "FeatureCollection",
features: [],
},
authorityName
)
);
}
loaded = true;
});
Expand Down

0 comments on commit 2581b27

Please sign in to comment.