From 9e3e69bb0824504255c34768332bacf5eef84adf Mon Sep 17 00:00:00 2001 From: cssbubble Date: Thu, 26 May 2022 11:47:14 +0100 Subject: [PATCH] sidebar --- src/App.svelte | 42 +++++++++++++++++----------------- src/TopicDetail.svelte | 39 +++++++------------------------ src/tailwindui/AppShell.svelte | 2 +- templates/index.html | 11 +++++++++ 4 files changed, 41 insertions(+), 53 deletions(-) diff --git a/src/App.svelte b/src/App.svelte index 6f56611..0c8f8da 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -83,35 +83,35 @@ - - - Topics + + +

Topics

- - - Formats + + +

Formats

- - - Random Item + + +

Random Item

- - - Search + + +

Search


- - - Want to learn + + +

Want to learn

- - - Finished learning + + +

Finished learning


- - - Datasette + + +

Datasette

diff --git a/src/TopicDetail.svelte b/src/TopicDetail.svelte index 472fc16..a62864f 100644 --- a/src/TopicDetail.svelte +++ b/src/TopicDetail.svelte @@ -16,7 +16,8 @@ .then(r => r.json()) .then(data => { items = data; - }); + }); + @@ -31,22 +32,21 @@
- - {#each formats as format} - {format.name} - {/each} - - {#each formats as format} + + {#each formats.filter(f => items.filter(x => x.links.includes(f.id + '|')).length > 0) as format} + {format.name} + + {#if format.id == 'book'}
{#each items.filter(x => x.links.includes(format.id + '|')) as item} + {/each}
- {:else if format.id == 'video'}
@@ -69,29 +69,6 @@
-
diff --git a/src/tailwindui/AppShell.svelte b/src/tailwindui/AppShell.svelte index 94437b2..ed2f979 100644 --- a/src/tailwindui/AppShell.svelte +++ b/src/tailwindui/AppShell.svelte @@ -73,7 +73,7 @@ {/if} -