pds-dash/src/lib/AccountComponent.svelte

48 lines
1.2 KiB
Svelte
Raw Normal View History

2025-04-20 02:02:47 -04:00
<script lang="ts">
2025-04-20 18:14:12 +09:00
import type { AccountMetadata } from "./pdsfetch";
const { account }: { account: AccountMetadata } = $props();
import { Config } from "../../config";
2025-04-20 02:02:47 -04:00
</script>
2025-04-20 04:47:55 -04:00
<a id="link" href="{Config.FRONTEND_URL}/profile/{account.did}">
2025-04-20 18:14:12 +09:00
<div id="accountContainer">
{#if account.avatarCid}
<img
id="avatar"
alt="avatar of {account.displayName}"
src="{Config.PDS_URL}/xrpc/com.atproto.sync.getBlob?did={account.did}&cid={account.avatarCid}"
/>
{/if}
<div id="accountName">
{account.displayName || account.handle || account.did}
2025-04-20 04:47:55 -04:00
</div>
2025-04-20 18:14:12 +09:00
</div>
2025-04-20 04:47:55 -04:00
</a>
2025-04-20 02:02:47 -04:00
<style>
2025-04-20 18:14:12 +09:00
#accountContainer {
display: flex;
text-align: start;
align-items: center;
background-color: var(--background-color);
2025-04-20 18:14:12 +09:00
padding: 0px;
margin-bottom: 15px;
border: 1px solid var(--border-color);
2025-04-20 18:14:12 +09:00
}
#accountName {
margin-left: 10px;
font-size: 0.9em;
2025-04-20 17:15:00 +09:00
2025-04-20 18:14:12 +09:00
/* replace overflow with ellipsis */
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 80%;
}
#avatar {
width: 50px;
height: 50px;
margin: 0px;
border-right: var(--border-color) 1px solid;
2025-04-20 18:14:12 +09:00
}
2025-04-20 04:47:55 -04:00
</style>