mirror of
https://github.com/jcreek/LivingDexTracker.git
synced 2026-07-13 11:03:44 +00:00
feat(*): Enable sliding filters bar for smaller viewports
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
|
|
||||||
let showOrigins = true;
|
let showOrigins = true;
|
||||||
let showForms = true;
|
let showForms = true;
|
||||||
|
let drawerOpen = false;
|
||||||
|
|
||||||
function toggleOrigins() {
|
function toggleOrigins() {
|
||||||
showOrigins = !showOrigins;
|
showOrigins = !showOrigins;
|
||||||
@@ -152,19 +153,67 @@
|
|||||||
{#if !localUser}
|
{#if !localUser}
|
||||||
<p>Please <a href="/signin" class="underline text-primary hover:text-secondary">sign in</a></p>
|
<p>Please <a href="/signin" class="underline text-primary hover:text-secondary">sign in</a></p>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex">
|
<div class="drawer lg:drawer-open">
|
||||||
<aside class="w-64 bg-gray-800 text-white p-4 fixed h-5/6">
|
<input id="my-drawer" type="checkbox" class="drawer-toggle" bind:checked={drawerOpen} />
|
||||||
|
<div class="drawer-content flex flex-col items-center justify-center md:ml-64">
|
||||||
|
<label
|
||||||
|
for="my-drawer"
|
||||||
|
class="btn btn-secondary drawer-button lg:hidden fixed -left-10 top-1/2 -rotate-90"
|
||||||
|
>
|
||||||
|
{drawerOpen ? 'Close Filters' : 'Open Filters'}
|
||||||
|
</label>
|
||||||
|
<main class="flex-1 p-4 w-full">
|
||||||
|
<div class="max-w-min mx-auto">
|
||||||
|
{#if combinedData && combinedData.length > 0}
|
||||||
|
{#each combinedData as { pokedexEntry, catchRecord }}
|
||||||
|
<PokedexEntryCatchRecord
|
||||||
|
{pokedexEntry}
|
||||||
|
{showOrigins}
|
||||||
|
{showForms}
|
||||||
|
bind:catchRecord
|
||||||
|
on:updateCatch={updateACatch}
|
||||||
|
/>
|
||||||
|
{/each}
|
||||||
|
{:else if failedToLoad}
|
||||||
|
{#if creatingRecords && totalRecordsCreated > 0}
|
||||||
|
<p>Processed {totalRecordsCreated} Pokédex entries so far...</p>
|
||||||
|
<p>Please be patient, this may take some time.</p>
|
||||||
|
{:else if creatingRecords}
|
||||||
|
<p>Processing...</p>
|
||||||
|
<p>Please be patient, this may take some time.</p>
|
||||||
|
{:else}
|
||||||
|
<h1>Failed to load</h1>
|
||||||
|
<p>
|
||||||
|
If you're seeing this, you probably haven't created your Pokédex data yet. Please do
|
||||||
|
so by clicking this button.
|
||||||
|
</p>
|
||||||
|
<button class="btn" on:click={createCatchRecords}>Create Pokédex data</button>
|
||||||
|
{/if}
|
||||||
|
{:else}
|
||||||
|
<div class="min-w-max mx-auto">
|
||||||
|
<h1>Loading Pokédex</h1>
|
||||||
|
<span class="loading loading-spinner loading-xl"></span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
<div class="drawer-side lg:relative">
|
||||||
|
<label for="my-drawer" class="drawer-overlay lg:hidden"></label>
|
||||||
|
<aside
|
||||||
|
class="menu bg-gray-800 text-white min-h-full w-64 p-4 lg:fixed xs:top-0 lg:left-0 h-full lg:h-5/6"
|
||||||
|
>
|
||||||
<h2 class="text-2xl font-semibold mb-4">Filters</h2>
|
<h2 class="text-2xl font-semibold mb-4">Filters</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li class="mb-2">
|
<li class="mb-2">
|
||||||
<button class="block p-2 hover:bg-gray-700 rounded" on:click={() => toggleForms()}
|
<button class="block p-2 hover:bg-gray-700 rounded" on:click={() => toggleForms()}>
|
||||||
>Toggle Forms (Currently {showForms ? 'On' : 'Off'})</button
|
Toggle Forms (Currently {showForms ? 'On' : 'Off'})
|
||||||
>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="mb-2">
|
<li class="mb-2">
|
||||||
<button class="block p-2 hover:bg-gray-700 rounded" on:click={() => toggleOrigins()}
|
<button class="block p-2 hover:bg-gray-700 rounded" on:click={() => toggleOrigins()}>
|
||||||
>Toggle Origins (Currently {showOrigins ? 'On' : 'Off'})</button
|
Toggle Origins (Currently {showOrigins ? 'On' : 'Off'})
|
||||||
>
|
</button>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
@@ -246,41 +295,6 @@
|
|||||||
<Pagination bind:currentPage bind:itemsPerPage bind:totalPages />
|
<Pagination bind:currentPage bind:itemsPerPage bind:totalPages />
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
</div>
|
||||||
<main class="flex-1 p-4 ml-64">
|
|
||||||
<div class="max-w-min mx-auto">
|
|
||||||
{#if combinedData && combinedData.length > 0}
|
|
||||||
{#each combinedData as { pokedexEntry, catchRecord }}
|
|
||||||
<PokedexEntryCatchRecord
|
|
||||||
{pokedexEntry}
|
|
||||||
{showOrigins}
|
|
||||||
{showForms}
|
|
||||||
bind:catchRecord
|
|
||||||
on:updateCatch={updateACatch}
|
|
||||||
/>
|
|
||||||
{/each}
|
|
||||||
{:else if failedToLoad}
|
|
||||||
{#if creatingRecords && totalRecordsCreated > 0}
|
|
||||||
<p>Processed {totalRecordsCreated} Pokédex entries so far...</p>
|
|
||||||
<p>Please be patient, this may take some time.</p>
|
|
||||||
{:else if creatingRecords}
|
|
||||||
<p>Processing...</p>
|
|
||||||
<p>Please be patient, this may take some time.</p>
|
|
||||||
{:else}
|
|
||||||
<h1>Failed to load</h1>
|
|
||||||
<p>
|
|
||||||
If you're seeing this, you probably haven't created your Pokédex data yet. Please do
|
|
||||||
so by clicking this button.
|
|
||||||
</p>
|
|
||||||
<button class="btn" on:click={createCatchRecords}>Create Pokédex data</button>
|
|
||||||
{/if}
|
|
||||||
{:else}
|
|
||||||
<div class="min-w-max mx-auto">
|
|
||||||
<h1>Loading Pokédex</h1>
|
|
||||||
<span class="loading loading-spinner loading-xl"></span>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user