feat: add indicator for new replies

This commit is contained in:
Xylight committed 2024-08-05 13:13:26 -07:00
1 parent 5235db3830
commit c174ce5362
1 file changed
+14 -4
@@ -7,7 +7,9 @@
Bookmark, Bookmark,
BookmarkSlash, BookmarkSlash,
BugAnt, BugAnt,
ChatBubbleLeftEllipsis,
ChatBubbleOvalLeft, ChatBubbleOvalLeft,
ChatBubbleOvalLeftEllipsis,
CheckBadge, CheckBadge,
EllipsisHorizontal, EllipsisHorizontal,
Eye, Eye,
@@ -19,6 +21,7 @@
PencilSquare, PencilSquare,
ServerStack, ServerStack,
Share, Share,
Star,
Trash, Trash,
UserCircle, UserCircle,
XMark, XMark,
@@ -48,10 +51,11 @@
import { fediseer, type Data } from '$lib/fediseer/fediseer' import { fediseer, type Data } from '$lib/fediseer/fediseer'
import { t } from '$lib/translations' import { t } from '$lib/translations'
import { text } from '$lib/components/translate/translation' import { text } from '$lib/components/translate/translation'
import { hidePost } from './helpers' import { hidePost, postLink } from './helpers'
import { feature } from '$lib/version' import { feature } from '$lib/version'
import Switch from '$lib/components/input/Switch.svelte' import Switch from '$lib/components/input/Switch.svelte'
import { instanceToURL } from '$lib/util' import { instanceToURL } from '$lib/util'
import { publishedToDate } from '$lib/components/util/date'
export let post: PostView export let post: PostView
export let view: View = 'cozy' export let view: View = 'cozy'
@@ -126,14 +130,20 @@
<Button <Button
size="sm" size="sm"
href="/post/{getInstance()}/{post.post.id}" href={postLink(post.post)}
class="!text-inherit h-full px-3" class="!text-inherit h-full px-3 relative"
color="ghost" color="ghost"
rounding="pill" rounding="pill"
target={$userSettings.openLinksInNewTab ? '_blank' : ''} target={$userSettings.openLinksInNewTab ? '_blank' : ''}
title={$t('post.actions.comments')} title={$t('post.actions.comments')}
> >
<Icon slot="prefix" src={ChatBubbleOvalLeft} size="18" /> {@const newComment =
publishedToDate(post.counts.newest_comment_time).getTime() >
new Date().getTime() - 5 * 60 * 1000}
<Icon
src={newComment ? ChatBubbleOvalLeftEllipsis : ChatBubbleOvalLeft}
size="18"
/>
<FormattedNumber number={post.counts.comments} /> <FormattedNumber number={post.counts.comments} />
</Button> </Button>
<div class="ml-auto" /> <div class="ml-auto" />