feat: add buttons to reload comments and go back

This commit is contained in:
Xyphyn committed 2023-09-04 16:58:25 -07:00
1 parent 5577441d7d
commit f657df6c27
3 files changed
+28 -12

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "photon-lemmy", "name": "photon-lemmy",
"version": "1.3.3", "version": "1.3.4",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite dev", "dev": "vite dev",
+4 -9
View File
@@ -49,6 +49,10 @@
<Icon src={Cog6Tooth} mini size="20" title="Settings" /> <Icon src={Cog6Tooth} mini size="20" title="Settings" />
<span class:hidden={!$userSettings.expandSidebar}>Settings</span> <span class:hidden={!$userSettings.expandSidebar}>Settings</span>
</SidebarButton> </SidebarButton>
<SidebarButton expanded={$userSettings.expandSidebar} href="/communities">
<Icon mini src={GlobeAlt} size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Communities</span>
</SidebarButton>
{#if $profileData.profiles.length >= 1} {#if $profileData.profiles.length >= 1}
<hr class="border-slate-300 dark:border-zinc-800 my-1" /> <hr class="border-slate-300 dark:border-zinc-800 my-1" />
{#each $profileData.profiles as prof, index (prof.id)} {#each $profileData.profiles as prof, index (prof.id)}
@@ -75,15 +79,6 @@
expanded={$userSettings.expandSidebar} expanded={$userSettings.expandSidebar}
items={$profile.user.follows.map((i) => i.community)} items={$profile.user.follows.map((i) => i.community)}
/> />
<Button
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
href="/communities"
color="tertiary"
alignment="left"
>
<Icon mini src={GlobeAlt} size="20" />
<span class:hidden={!$userSettings.expandSidebar}>Communities</span>
</Button>
{:else} {:else}
<Button <Button
class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}" class="hover:bg-slate-200 {$userSettings.expandSidebar ? '' : '!p-1.5'}"
@@ -8,7 +8,12 @@
import Markdown from '$lib/components/markdown/Markdown.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte'
import { page } from '$app/stores' import { page } from '$app/stores'
import PostActions from '$lib/components/lemmy/post/PostActions.svelte' import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
import { ExclamationTriangle, Icon } from 'svelte-hero-icons' import {
ArrowLeft,
ArrowPath,
ExclamationTriangle,
Icon,
} from 'svelte-hero-icons'
import PostLink from '$lib/components/lemmy/post/PostLink.svelte' import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte' import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
import { Badge, Material, Spinner, removeToast, toast } from 'mono-svelte' import { Badge, Material, Spinner, removeToast, toast } from 'mono-svelte'
@@ -129,6 +134,8 @@
</Material> </Material>
{/if} {/if}
<div class="flex flex-row justify-between items-center gap-2 flex-wrap">
<div class="w-max">
<PostMeta <PostMeta
community={post.post_view.community} community={post.post_view.community}
user={post.post_view.creator} user={post.post_view.creator}
@@ -143,6 +150,15 @@
published={new Date(post.post_view.post.published + 'Z')} published={new Date(post.post_view.post.published + 'Z')}
saved={post.post_view.saved} saved={post.post_view.saved}
/> />
</div>
<Button
on:click={() => history.back()}
size="square-md"
class={history.length < 3 ? 'hidden' : ''}
>
<Icon src={ArrowLeft} mini size="16" slot="prefix" />
</Button>
</div>
<h1 class="font-bold text-lg">{post.post_view.post.name}</h1> <h1 class="font-bold text-lg">{post.post_view.post.name}</h1>
{#if isImage(post.post_view.post.url)} {#if isImage(post.post_view.post.url)}
<img <img
@@ -236,18 +252,23 @@
</Material> </Material>
{/if} {/if}
<div class="mt-4 flex flex-col gap-2 w-full"> <div class="mt-4 flex flex-col gap-2 w-full">
<div class="flex flex-row justify-between"> <div class="flex flex-row justify-between flex-wrap gap-2">
<div class="font-bold opacity-80 text-base flex items-center gap-2"> <div class="font-bold opacity-80 text-base flex items-center gap-2">
Comments <Badge color="gray" class="!text-sm"> Comments <Badge color="gray" class="!text-sm">
<FormattedNumber number={post.post_view.counts.comments} /> <FormattedNumber number={post.post_view.counts.comments} />
</Badge> </Badge>
</div> </div>
<div class="gap-2 flex">
<MultiSelect <MultiSelect
options={['Hot', 'Top', 'New']} options={['Hot', 'Top', 'New']}
bind:selected={commentSort} bind:selected={commentSort}
on:select={reloadComments} on:select={reloadComments}
headless headless
/> />
<Button size="square-md" on:click={reloadComments}>
<Icon src={ArrowPath} size="16" mini slot="prefix" />
</Button>
</div>
</div> </div>
{#await data.streamed.comments} {#await data.streamed.comments}
<div class="h-16 mx-auto grid place-items-center"> <div class="h-16 mx-auto grid place-items-center">