diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index b9534fbd..85d2cfe5 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -22,6 +22,7 @@ const namedFields = ref([]) const iconFields = ref([]) const isEditingPersonalNote = ref(false) const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png')) +const isCopied = ref(false) function getFieldIconTitle(fieldName: string) { return fieldName === 'Joined' ? t('account.joined') : fieldName @@ -105,6 +106,23 @@ const isSelf = $(useSelfAccount(() => account)) const isNotifiedOnPost = $computed(() => !!relationship?.notifying) const personalNoteMaxLength = 2000 + +async function copyAccountName() { + try { + const shortHandle = getShortHandle(account) + const serverName = getServerName(account) + const accountName = `${shortHandle}@${serverName}` + await navigator.clipboard.writeText(accountName) + } + catch (err) { + console.error('Failed to copy account name:', err) + } + + isCopied.value = true + setTimeout(() => { + isCopied.value = false + }, 2000) +}