feat(dashboard): add news
This commit is contained in:
parent
ce323096e6
commit
92e7e1f1cb
5 changed files with 73 additions and 5 deletions
31
Catalogger.Frontend/src/routes/Message.svelte
Normal file
31
Catalogger.Frontend/src/routes/Message.svelte
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<script lang="ts">
|
||||
import type { NewsMessage } from "$lib/api";
|
||||
import {
|
||||
Card,
|
||||
CardBody,
|
||||
CardFooter,
|
||||
CardText,
|
||||
} from "@sveltestrap/sveltestrap";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
export let message: NewsMessage;
|
||||
|
||||
$: postedAt = DateTime.fromISO(message.posted_at).toLocaleString(
|
||||
DateTime.DATETIME_MED,
|
||||
);
|
||||
$: editedAt = message.edited_at
|
||||
? DateTime.fromISO(message.edited_at).toLocaleString(DateTime.DATETIME_MED)
|
||||
: null;
|
||||
</script>
|
||||
|
||||
<Card>
|
||||
<CardBody>
|
||||
<CardText>{message.content}</CardText>
|
||||
</CardBody>
|
||||
<CardFooter>
|
||||
From {message.author} • Posted {postedAt}
|
||||
{#if editedAt}
|
||||
<p class="text-muted">(edited {editedAt})</p>
|
||||
{/if}
|
||||
</CardFooter>
|
||||
</Card>
|
||||
Loading…
Add table
Add a link
Reference in a new issue