Skip to content

Commit

Permalink
feat: change copy icon to check icon after the copy
Browse files Browse the repository at this point in the history
  • Loading branch information
shuuji3 committed Nov 14, 2023
1 parent 8b14673 commit d27603a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/account/AccountHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const namedFields = ref<mastodon.v1.AccountField[]>([])
const iconFields = ref<mastodon.v1.AccountField[]>([])
const isEditingPersonalNote = ref<boolean>(false)
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
const isCopied = ref<boolean>(false)
function getFieldIconTitle(fieldName: string) {
return fieldName === 'Joined' ? t('account.joined') : fieldName
Expand Down Expand Up @@ -116,6 +117,11 @@ async function copyAccountName() {
catch (err) {
console.error('Failed to copy account name:', err)
}
isCopied.value = true
setTimeout(() => {
isCopied.value = false
}, 2000)
}
</script>

Expand Down Expand Up @@ -187,7 +193,7 @@ async function copyAccountName() {
<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 i-ri:file-copy-line @click="copyAccountName">
<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>
Expand Down

0 comments on commit d27603a

Please sign in to comment.