1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-02 19:55:18 +02:00

refactor: Improve performance and fix conditional rendering issue in +page.svelte

This commit is contained in:
Sean Morley 2024-07-30 07:10:41 -04:00
parent f98ca62aad
commit 3a01178acb
2 changed files with 18 additions and 19 deletions

View file

@ -19,7 +19,6 @@
let showVisited = true;
let showPlanned = true;
let showCollectionAdventures = false;
$: {
if (!showVisited) {
@ -34,12 +33,6 @@
const plannedMarkers = data.props.markers.filter((marker) => marker.type === 'planned');
markers = [...markers, ...plannedMarkers];
}
if (!showCollectionAdventures) {
markers = markers.filter((marker) => marker.collection === null);
} else {
const collectionMarkers = data.props.markers.filter((marker) => marker.collection !== null);
markers = [...markers, ...collectionMarkers];
}
}
let newMarker = [];
@ -124,14 +117,6 @@
<span class="label-text">Planned</span>
<input type="checkbox" bind:checked={showPlanned} class="checkbox checkbox-primary" />
</label>
<label class="label cursor-pointer">
<span class="label-text">Collection Adventures</span>
<input
type="checkbox"
bind:checked={showCollectionAdventures}
class="checkbox checkbox-primary"
/>
</label>
{#if newMarker.length > 0}
<button type="button" class="btn btn-primary mb-2" on:click={() => (createModalOpen = true)}