65 lines
1.2 KiB
Svelte
65 lines
1.2 KiB
Svelte
<script lang="ts">
|
|
import type { MessageView } from "#lib/api/types.js";
|
|
import Icon from "#lib/components/ui/Icon.svelte";
|
|
import { formatTime } from "#lib/format/datetime.js";
|
|
|
|
interface Props {
|
|
message: MessageView;
|
|
onversions?: () => void;
|
|
own?: boolean;
|
|
}
|
|
|
|
let { message, onversions, own = false }: Props = $props();
|
|
</script>
|
|
|
|
<span class="MessageMeta">
|
|
{#if message.edited_at}
|
|
<button
|
|
class="edited"
|
|
onclick={onversions}
|
|
title="View edit history"
|
|
type="button"
|
|
>
|
|
edited
|
|
</button>
|
|
{/if}
|
|
<span class="time">{formatTime(message.date)}</span>
|
|
{#if own}
|
|
<Icon
|
|
class="ticks"
|
|
name={message.read ? "message-read" : "check"}
|
|
size="1rem"
|
|
/>
|
|
{/if}
|
|
</span>
|
|
|
|
<style lang="scss">
|
|
.MessageMeta {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.25rem;
|
|
|
|
float: right;
|
|
margin-top: 0.125rem;
|
|
margin-inline-start: 0.5rem;
|
|
|
|
font-size: 0.75rem;
|
|
color: var(--meta-color, var(--color-text-meta));
|
|
user-select: none;
|
|
}
|
|
|
|
.time {
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.edited {
|
|
cursor: pointer;
|
|
padding: 0;
|
|
border: 0;
|
|
font-size: 0.75rem;
|
|
font-style: italic;
|
|
color: inherit;
|
|
background: transparent;
|
|
}
|
|
</style>
|