feat: put account name copy button (#2347)
This commit is contained in:
parent
7ec76ffed9
commit
e00e4074e1
|
@ -22,6 +22,7 @@ const namedFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
const isEditingPersonalNote = ref<boolean>(false)
|
const isEditingPersonalNote = ref<boolean>(false)
|
||||||
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
|
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
|
||||||
|
const isCopied = ref<boolean>(false)
|
||||||
|
|
||||||
function getFieldIconTitle(fieldName: string) {
|
function getFieldIconTitle(fieldName: string) {
|
||||||
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
||||||
|
@ -105,6 +106,23 @@ const isSelf = $(useSelfAccount(() => account))
|
||||||
const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
|
const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
|
||||||
|
|
||||||
const personalNoteMaxLength = 2000
|
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)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -175,7 +193,15 @@ const personalNoteMaxLength = 2000
|
||||||
<AccountLockIndicator v-if="account.locked" show-label />
|
<AccountLockIndicator v-if="account.locked" show-label />
|
||||||
<AccountBotIndicator v-if="account.bot" show-label />
|
<AccountBotIndicator v-if="account.bot" show-label />
|
||||||
</div>
|
</div>
|
||||||
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
|
||||||
|
<div flex items-center gap-1>
|
||||||
|
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
||||||
|
<CommonTooltip placement="bottom" :content="$t('account.copy_account_name')" no-auto-focus flex>
|
||||||
|
<button text-secondary-light text-sm :class="isCopied ? 'i-ri:check-fill text-green' : 'i-ri:file-copy-line'" @click="copyAccountName">
|
||||||
|
<span sr-only>{{ $t('account.copy_account_name') }}</span>
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label
|
<label
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"blocked_users": "Blocked users",
|
"blocked_users": "Blocked users",
|
||||||
"blocking": "Blocked",
|
"blocking": "Blocked",
|
||||||
"bot": "BOT",
|
"bot": "BOT",
|
||||||
|
"copy_account_name": "Copy account name",
|
||||||
"favourites": "Favorites",
|
"favourites": "Favorites",
|
||||||
"follow": "Follow",
|
"follow": "Follow",
|
||||||
"follow_back": "Follow back",
|
"follow_back": "Follow back",
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"blocked_users": "ブロックしたユーザー",
|
"blocked_users": "ブロックしたユーザー",
|
||||||
"blocking": "ブロック中",
|
"blocking": "ブロック中",
|
||||||
"bot": "BOT",
|
"bot": "BOT",
|
||||||
|
"copy_account_name": "アカウント名をコピー",
|
||||||
"favourites": "お気に入り",
|
"favourites": "お気に入り",
|
||||||
"follow": "フォローする",
|
"follow": "フォローする",
|
||||||
"follow_back": "フォローバックする",
|
"follow_back": "フォローバックする",
|
||||||
|
|
Loading…
Reference in a new issue