| 1 |
<script lang="ts"> |
| 2 |
import { day } from "../format"; |
| 3 |
import { urlForAccount } from "../helpers"; |
| 4 |
import { account_details } from "../stores"; |
| 5 |
import AccountIndicator from "./AccountIndicator.svelte"; |
| 6 |
|
| 7 |
interface Props { |
| 8 |
account: string; |
| 9 |
} |
| 10 |
|
| 11 |
let { account }: Props = $props(); |
| 12 |
|
| 13 |
let parts = $derived(account.split(":")); |
| 14 |
|
| 15 |
let details = $derived($account_details[account]); |
| 16 |
let last = $derived(details?.last_entry); |
| 17 |
</script> |
| 18 |
|
| 19 |
<span class="droptarget" data-account-name={account}> |
| 20 |
{#each parts as part, index} |
| 21 |
{@const name = parts.slice(0, index + 1).join(":")}<a |
| 22 |
href={$urlForAccount(name)} |
| 23 |
title={name}>{part}</a |
| 24 |
>{#if index < parts.length - 1}:{/if}{/each} |
| 25 |
<AccountIndicator {account} /> |
| 26 |
{#if last} |
| 27 |
<span class="last-activity"> |
| 28 |
(Last entry: <a href="#context-{last.entry_hash}">{day(last.date)}</a>) |
| 29 |
</span> |
| 30 |
{/if} |
| 31 |
</span> |
| 32 |
|
| 33 |
<style> |
| 34 |
a { |
| 35 |
color: unset; |
| 36 |
} |
| 37 |
|
| 38 |
.droptarget { |
| 39 |
padding: 0.6em; |
| 40 |
margin-left: -0.6em; |
| 41 |
} |
| 42 |
|
| 43 |
.last-activity { |
| 44 |
display: inline-block; |
| 45 |
margin-left: 10px; |
| 46 |
font-size: 12px; |
| 47 |
font-weight: normal; |
| 48 |
opacity: 0.8; |
| 49 |
} |
| 50 |
</style> |