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