mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-15 19:30:38 +08:00
We stop using the disabled `Popover` component. Instead of using the disabled component it is simpler to just not use the component at all. This also avoids issues where the toggle button of the `Popover` was nested inside the button in `src/App/Header/Authenticate.svelte` which in turn created problems with `.getByRole` selectors in tests. Because of this change we can also drop the use of `NodeId` in places where it simply displays the node ID and avatar. Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
72 lines
1.6 KiB
Svelte
72 lines
1.6 KiB
Svelte
<script lang="ts">
|
|
import { formatNodeId } from "@app/lib/utils";
|
|
|
|
import Avatar from "./Avatar.svelte";
|
|
import HoverPopover from "./HoverPopover.svelte";
|
|
import CopyableId from "./CopyableId.svelte";
|
|
|
|
export let nodeId: string;
|
|
export let alias: string | undefined = undefined;
|
|
export let large: boolean = false;
|
|
</script>
|
|
|
|
<style>
|
|
.avatar-alias {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.25rem;
|
|
height: 1rem;
|
|
font-family: var(--font-family-monospace);
|
|
font-weight: var(--font-weight-semibold);
|
|
font-size: var(--font-size-small);
|
|
}
|
|
.large {
|
|
height: 1.25rem;
|
|
gap: 0.5rem;
|
|
}
|
|
.popover-avatar {
|
|
height: 1rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-family: var(--font-family-monospace);
|
|
font-weight: var(--font-weight-semibold);
|
|
font-size: var(--font-size-small);
|
|
}
|
|
.popover-container {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 1rem;
|
|
}
|
|
</style>
|
|
|
|
<HoverPopover
|
|
stylePopoverPositionLeft="-4.5rem"
|
|
stylePopoverPadding="0.5rem 0.5rem 0.5rem 0.75rem"
|
|
stylePopoverPositionTop="-4.5rem">
|
|
<div slot="toggle" class="avatar-alias" class:large>
|
|
<Avatar {nodeId} />
|
|
{#if alias}
|
|
{alias}
|
|
{:else}
|
|
{formatNodeId(nodeId)}
|
|
{/if}
|
|
</div>
|
|
|
|
<div slot="popover">
|
|
<div class="popover-container">
|
|
<div class="popover-avatar">
|
|
<Avatar {nodeId} />
|
|
{#if alias}
|
|
{alias}
|
|
{/if}
|
|
</div>
|
|
|
|
<CopyableId id={nodeId}>
|
|
{formatNodeId(nodeId)}
|
|
</CopyableId>
|
|
</div>
|
|
</div>
|
|
</HoverPopover>
|