misc: expose time edited on hover, close #406

This commit is contained in:
James Xylight committed 2025-08-30 13:23:58 -07:00
1 parent 76080c726c
commit 69ee0b5c28
5 files changed
+36 -15

No files matched your search

@@ -5,12 +5,14 @@
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte'
import { publishedToDate } from '$lib/components/util/date.js'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import RelativeDate, {
formatRelativeDate,
} from '$lib/components/util/RelativeDate.svelte'
import { t } from '$lib/i18n/translations'
import { getClient } from '$lib/lemmy.svelte.js'
import { errorMessage } from '$lib/lemmy/error'
import { settings } from '$lib/settings.svelte'
import { Button, Modal, toast } from 'mono-svelte'
import { Button, modal, Modal, toast } from 'mono-svelte'
import {
Bookmark,
Icon,
@@ -168,8 +170,20 @@
date={publishedToDate(node.comment_view.comment.published)}
/>
<span class="text-slate-600 dark:text-zinc-400 flex flex-row gap-2 ml-1">
{#if node.comment_view.comment.updated}
<Icon src={Pencil} solid size="12" aria-label="Edited" />
{#if node.comment_view.comment.updated}{@const edited = $t(
'post.meta.lastEdited',
{
default: formatRelativeDate(
publishedToDate(node.comment_view.comment.updated),
{
style: 'long',
},
),
},
)}
<div title={edited}>
<Icon src={Pencil} micro size="14" />
</div>
{/if}
{#if node.comment_view.comment.deleted || node.comment_view.comment.removed}
<Icon
+13 -3
View File
@@ -55,7 +55,7 @@
import { instance } from '$lib/instance.svelte'
import { settings, type View } from '$lib/settings.svelte'
import type { Community, Person, SubscribedType } from 'lemmy-js-client'
import { Badge, Popover } from 'mono-svelte'
import { Badge, modal, Popover } from 'mono-svelte'
import {
Bookmark,
ExclamationTriangle,
@@ -147,6 +147,7 @@
{#snippet target(attachment)}
<button
{@attach attachment}
class={[
'row-span-2 shrink-0 mr-2 self-center group/btn',
'bg-slate-200 dark:bg-zinc-800 rounded-lg cursor-pointer',
@@ -229,15 +230,24 @@
<RelativeDate date={published} class="shrink-0" />
{/if}
{#if edited}
<div
<button
title={$t('post.meta.lastEdited', {
default: formatRelativeDate(publishedToDate(edited), {
style: 'long',
}),
})}
onclick={() =>
modal({
title: $t('common.info'),
body: $t('post.meta.lastEdited', {
default: formatRelativeDate(publishedToDate(edited), {
style: 'long',
}),
}),
})}
>
<Icon src={Pencil} micro size="14" />
</div>
</button>
{/if}
</div>
<div
+2 -1
View File
@@ -648,7 +648,8 @@
"general": "General",
"remove": "Remove",
"download": "Download",
"attach": "Attach file"
"attach": "Attach file",
"info": "Info"
},
"message": {
"success": "Success",
-7
View File
@@ -1,15 +1,9 @@
<script>
import { notifications } from '$lib/auth.svelte'
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
import {} from '$lib/components/ui/layout/Shell.svelte'
import { t } from '$lib/i18n/translations'
import { Badge } from 'mono-svelte'
/**
* @typedef {Object} Props
* @property {import('svelte').Snippet} [children]
*/
/** @type {Props} */
let { children } = $props()
</script>
@@ -49,7 +43,6 @@
name: $t('routes.admin.media.title'),
},
]}
class="overflow-auto"
/>
{@render children?.()}
</div>
+3
View File
@@ -1,6 +1,9 @@
import { profile } from '$lib/auth.svelte.js'
import { getClient, site as siteStore } from '$lib/lemmy.svelte.js'
import { error } from '@sveltejs/kit'
export async function load({ fetch }) {
if (!profile.current.jwt) error(403)
const site = siteStore
if (!site.data) {