mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 02:00:31 +08:00
desktop: Add an actor profile editor behind the actorRepos lab
Co-authored-by: Brandon Oxendine <brandon.oxendine@gmail.com>
This commit is contained in:
co-authored by
Brandon Oxendine
parent
442e58780f
commit
bc2914f06b
@@ -1,13 +1,16 @@
|
||||
<script lang="ts">
|
||||
import type { ActorInfo } from "@bindings/actor/ActorInfo";
|
||||
import type { Config } from "@bindings/config/Config";
|
||||
|
||||
import UserAvatar from "@radicle-gui/ui/components/UserAvatar.svelte";
|
||||
import debounce from "lodash/debounce";
|
||||
|
||||
import { writeToClipboard } from "@app/lib/invoke";
|
||||
import { labs } from "@app/lib/labs";
|
||||
import { entityUrl } from "@app/lib/mentions";
|
||||
import * as router from "@app/lib/router";
|
||||
import { didFromPublicKey, explorerHost, truncateDid } from "@app/lib/utils";
|
||||
|
||||
import ActorAvatar from "@app/components/ActorAvatar.svelte";
|
||||
import Button from "@app/components/Button.svelte";
|
||||
import DropdownListItem from "@app/components/DropdownListItem.svelte";
|
||||
import Icon from "@app/components/Icon.svelte";
|
||||
@@ -16,9 +19,10 @@
|
||||
|
||||
interface Props {
|
||||
config: Config;
|
||||
actor: ActorInfo | null;
|
||||
}
|
||||
|
||||
const { config }: Props = $props();
|
||||
const { config, actor }: Props = $props();
|
||||
|
||||
let popoverExpanded: boolean = $state(false);
|
||||
let copyIcon: "copy" | "checkmark" = $state("copy");
|
||||
@@ -35,8 +39,9 @@
|
||||
styleJustifyContent="flex-start"
|
||||
active={popoverExpanded}
|
||||
{onclick}>
|
||||
<UserAvatar nodeId={config.publicKey} styleWidth="1rem" />
|
||||
<span class="label">{config.alias}</span>
|
||||
<!-- A profile looks the same on each of its devices. -->
|
||||
<ActorAvatar {actor} fallbackId={config.publicKey} styleWidth="1rem" />
|
||||
<span class="label">{actor?.profile?.displayName || config.alias}</span>
|
||||
<span class="label" style:color="var(--color-text-tertiary)">
|
||||
<Icon name={popoverExpanded ? "chevron-up" : "chevron-down"} />
|
||||
</span>
|
||||
@@ -48,6 +53,19 @@
|
||||
style:border-radius="var(--border-radius-md)"
|
||||
style:background-color="var(--color-surface-canvas)"
|
||||
style:padding="0.25rem">
|
||||
{#if labs.actorRepos}
|
||||
<DropdownListItem
|
||||
styleGap="0.5rem"
|
||||
styleWidth="100%"
|
||||
selected={false}
|
||||
onclick={async () => {
|
||||
closeFocused();
|
||||
await router.push({ resource: "profile", tab: "profile" });
|
||||
}}>
|
||||
<Icon name="avatar-incognito" />
|
||||
{actor ? "Profile" : "Set up profile"}
|
||||
</DropdownListItem>
|
||||
{/if}
|
||||
<DropdownListItem
|
||||
styleGap="0.5rem"
|
||||
styleWidth="100%"
|
||||
|
||||
Reference in New Issue
Block a user