diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-05-31 01:09:58 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-05-31 01:09:58 +0200 |
| commit | 6ccc6f60fc85e665c8a07a169efbe8d09c9d9e8e (patch) | |
| tree | 87c397af49b7820b5fb2c0fa3037be2ac4a587e8 /src/lib/components | |
| parent | 852ee620f0a2f6a83cf83eba860ca951b66bb7e2 (diff) | |
Lint, rm unused code
Diffstat (limited to 'src/lib/components')
| -rw-r--r-- | src/lib/components/forum/forum.svelte | 11 | ||||
| -rw-r--r-- | src/lib/components/forum_list/forum_list.svelte | 4 | ||||
| -rw-r--r-- | src/lib/components/glyph/glyph.svelte | 12 | ||||
| -rw-r--r-- | src/lib/components/post/post.svelte | 33 | ||||
| -rw-r--r-- | src/lib/components/topic/topic.svelte | 19 | ||||
| -rw-r--r-- | src/lib/components/topic_summary/topic_summary.svelte | 6 |
6 files changed, 56 insertions, 29 deletions
diff --git a/src/lib/components/forum/forum.svelte b/src/lib/components/forum/forum.svelte index e9841a9..e0a9ec5 100644 --- a/src/lib/components/forum/forum.svelte +++ b/src/lib/components/forum/forum.svelte @@ -1,6 +1,5 @@ <script lang="ts"> import type { Forum } from '$lib/data/types'; - import { topicsForForum } from '$lib/stores/topics'; export let forum: Forum; @@ -10,9 +9,9 @@ <h1 class="py-4 font-bold text-3xl">{forum.glyph} {$_(forum.label)}</h1> <ul class="list-disc list-inside pl-2"> - {#if forum.topics} - {#each forum.topics as topic} - <TopicSummary {topic} /> - {/each} - {/if} + {#if forum.topics} + {#each forum.topics as topic} + <TopicSummary {topic} /> + {/each} + {/if} </ul> diff --git a/src/lib/components/forum_list/forum_list.svelte b/src/lib/components/forum_list/forum_list.svelte index d1518bd..c8b48bc 100644 --- a/src/lib/components/forum_list/forum_list.svelte +++ b/src/lib/components/forum_list/forum_list.svelte @@ -4,9 +4,7 @@ export let forums: Forum[]; import { _ } from 'svelte-i18n'; - $: sortedForums = forums - .slice() - .sort((a, b) => a.position - b.position); + $: sortedForums = forums.slice().sort((a, b) => a.position - b.position); </script> <ul class="p-0 pl-2"> diff --git a/src/lib/components/glyph/glyph.svelte b/src/lib/components/glyph/glyph.svelte index 0726752..89bc10c 100644 --- a/src/lib/components/glyph/glyph.svelte +++ b/src/lib/components/glyph/glyph.svelte @@ -5,9 +5,17 @@ export let uuid: string; </script> -<div class="inline-block w-12 h-12 mt-1 bg-white border border-black border-solid p-0.5 box-content glyphicon" role="img" aria-label={$_('glyph.title')} title={$_('glyph.title')}> +<div + class="inline-block w-12 h-12 mt-1 bg-white border border-black border-solid p-0.5 box-content glyphicon" + role="img" + aria-label={$_('glyph.title')} + title={$_('glyph.title')} +> {#each getGlyphHash(uuid) as fragment} - <span class="block text-2xl float-left w-6 h-6 text-center leading-6 {fragment.glyph}" style="color: {fragment.color} "> + <span + class="block text-2xl float-left w-6 h-6 text-center leading-6 {fragment.glyph}" + style="color: {fragment.color} " + > {fragment.glyph} </span> {/each} diff --git a/src/lib/components/post/post.svelte b/src/lib/components/post/post.svelte index b0f99e4..dfabdce 100644 --- a/src/lib/components/post/post.svelte +++ b/src/lib/components/post/post.svelte @@ -16,29 +16,40 @@ title={$_('post.metadata_title', { values: { count: index + 1, total: count } })} > <Glyph uuid={post.author_id} /> - {#if post.author} - <span class="h-card"> - {$_('post.author_credit')} - <a href="/a/{post.author.handle}" class="p-nickname u-url underline text-blue-600 visited:text-purple-500">{post.author.handle}</a>. - </span> - {:else} - <span>????</span> - {/if} + {#if post.author} + <span class="h-card"> + {$_('post.author_credit')} + <a + href="/a/{post.author.handle}" + class="p-nickname u-url underline text-blue-600 visited:text-purple-500" + >{post.author.handle}</a + >. + </span> + {:else} + <span>????</span> + {/if} <time role="presentation" class="dt-published" datetime={timestampToISO(post.created_at)}> - <a title={$_('post.permalink_title')} class="underline text-blue-600 visited:text-purple-500" href="/p/{post.id}"> + <a + title={$_('post.permalink_title')} + class="underline text-blue-600 visited:text-purple-500" + href="/p/{post.id}" + > {timestampToISO(post.created_at)} </a> </time> {#if post.topic} <span> - ({$_('post.topic_location')} <a class="text-blue-600 underline visited:text-purple-500" href="/t/{post.topic.id}">{post.topic.title}</a>.) + ({$_('post.topic_location')} + <a class="text-blue-600 underline visited:text-purple-500" href="/t/{post.topic.id}" + >{post.topic.title}</a + >.) </span> {/if} </aside> <article class="e-content whitespace-pre" title={$_('post.title', { - values: { count: index + 1, total: count, author: post.author?.handle || '????' } + values: { count: index + 1, total: count, author: post.author?.handle || '????' } })} > {post.text} diff --git a/src/lib/components/topic/topic.svelte b/src/lib/components/topic/topic.svelte index 0715857..7fb4101 100644 --- a/src/lib/components/topic/topic.svelte +++ b/src/lib/components/topic/topic.svelte @@ -17,14 +17,21 @@ {#if topic.forum} <span class="topic-location"> {$_('topic.category_location')} - <a href="/f/{topic.forum.id}" class="p-category underline text-blue-600 visited:text-purple-500"> + <a + href="/f/{topic.forum.id}" + class="p-category underline text-blue-600 visited:text-purple-500" + > {topic.forum.glyph} {$_(topic.forum.label)} </a>. </span> {/if} <span class="topic-ttl"> - <a class="u-url u-uid underline text-blue-600 visited:text-purple-500" title={$_('topic.permalink_title')} href="/t/{topic.id}"> + <a + class="u-url u-uid underline text-blue-600 visited:text-purple-500" + title={$_('topic.permalink_title')} + href="/t/{topic.id}" + > ({$_('topic.remaining_time', { values: { remaining: $_(remaining.label, { values: { count: remaining.count } }) } })}) @@ -37,13 +44,13 @@ {#each topic.tags as tag} <a href="/g/{tag.tag}" class="p-category underline text-blue-600 visited:text-purple-500"> {tag.tag}<span class="tag-weight">({tag.count})</span></a - >{' '} + >{' '} {/each} </aside> {/if} {#if topic.posts} - {#each topic.posts as post, index} - <Post {post} {index} count={topic.posts.length} /> - {/each} + {#each topic.posts as post, index} + <Post {post} {index} count={topic.posts.length} /> + {/each} {/if} </div> diff --git a/src/lib/components/topic_summary/topic_summary.svelte b/src/lib/components/topic_summary/topic_summary.svelte index d54a195..8c4df4d 100644 --- a/src/lib/components/topic_summary/topic_summary.svelte +++ b/src/lib/components/topic_summary/topic_summary.svelte @@ -12,7 +12,11 @@ <li class="h-entry" title={$_('topic.title')}> <span class="p-name"> - <a class="u-url u-uid underline text-blue-600 visited:text-purple-500" title={$_('topic.permalink_title')} href="/t/{topic.id}"> + <a + class="u-url u-uid underline text-blue-600 visited:text-purple-500" + title={$_('topic.permalink_title')} + href="/t/{topic.id}" + > {topic.title} </a></span > |