fix: use rich (emoji) display name only with <ContentRich>
This commit is contained in:
parent
6d2ca0a1b1
commit
e51ca06f97
|
@ -66,7 +66,7 @@ function previewAvatar() {
|
||||||
<AccountAvatar :account="account" hover:opacity-90 transition-opacity />
|
<AccountAvatar :account="account" hover:opacity-90 transition-opacity />
|
||||||
</button>
|
</button>
|
||||||
<div flex flex-col>
|
<div flex flex-col>
|
||||||
<ContentRich font-bold text-2xl break-words :content="getDisplayName(account)" :emojis="account.emojis" />
|
<ContentRich font-bold text-2xl break-words :content="getDisplayName(account, { rich: true })" :emojis="account.emojis" />
|
||||||
<AccountHandle :account="account" op50 />
|
<AccountHandle :account="account" op50 />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,7 @@ const accountHandle = $(useAccountHandle(account, fullServer))
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
<NuxtLink flex flex-col :to="link ? getAccountPath(account) : null">
|
<NuxtLink flex flex-col :to="link ? getAccountPath(account) : null">
|
||||||
<ContentRich font-bold hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
|
<ContentRich font-bold hover:underline :content="getDisplayName(account, { rich: true })" :emojis="account.emojis" />
|
||||||
<AccountHandle :account="account" text-sm op35 />
|
<AccountHandle :account="account" text-sm op35 />
|
||||||
<slot name="bottom" />
|
<slot name="bottom" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
|
|
@ -10,6 +10,6 @@ const { link = true } = defineProps<{
|
||||||
<template>
|
<template>
|
||||||
<NuxtLink :to="link ? getAccountPath(account) : undefined" min-w-0 flex gap-1 items-center>
|
<NuxtLink :to="link ? getAccountPath(account) : undefined" min-w-0 flex gap-1 items-center>
|
||||||
<AccountAvatar :account="account" w-5 h-5 />
|
<AccountAvatar :account="account" w-5 h-5 />
|
||||||
<ContentRich hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
|
<ContentRich hover:underline :content="getDisplayName(account, { rich: true })" :emojis="account.emojis" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -8,6 +8,6 @@ defineProps<{
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NuxtLink :to="getAccountPath(account)">
|
<NuxtLink :to="getAccountPath(account)">
|
||||||
<ContentRich font-bold :content="getDisplayName(account)" :emojis="account.emojis" />
|
<ContentRich font-bold :content="getDisplayName(account, { rich: true })" :emojis="account.emojis" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -14,7 +14,7 @@ const accountHandle = $(useAccountHandle(account))
|
||||||
:to="link ? getAccountPath(account) : undefined"
|
:to="link ? getAccountPath(account) : undefined"
|
||||||
flex="~ col" min-w-0 md:flex="~ row gap-2" md:items-center
|
flex="~ col" min-w-0 md:flex="~ row gap-2" md:items-center
|
||||||
>
|
>
|
||||||
<ContentRich font-bold break-words hover:underline :content="getDisplayName(account)" :emojis="account.emojis" />
|
<ContentRich font-bold break-words hover:underline :content="getDisplayName(account, { rich: true })" :emojis="account.emojis" />
|
||||||
<p op35 text-sm>
|
<p op35 text-sm>
|
||||||
{{ accountHandle }}
|
{{ accountHandle }}
|
||||||
</p>
|
</p>
|
||||||
|
|
|
@ -39,8 +39,12 @@ export function getServerName(account: Account) {
|
||||||
return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || ''
|
return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || ''
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDisplayName(account: Account) {
|
export function getDisplayName(account?: Account, options?: { rich?: boolean }) {
|
||||||
return account.displayName || account.username
|
const displayName = account?.displayName || account?.username || ''
|
||||||
|
if (options?.rich)
|
||||||
|
return displayName
|
||||||
|
|
||||||
|
return displayName.replace(/:([\w-]+?):/g, '')
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getShortHandle(account: Account) {
|
export function getShortHandle(account: Account) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ const { data: context } = useAsyncData(`context:${id}`, () => masto.statuses.fet
|
||||||
v-if="currentUser"
|
v-if="currentUser"
|
||||||
border="t base"
|
border="t base"
|
||||||
:draft-key="`reply-${id}`"
|
:draft-key="`reply-${id}`"
|
||||||
:placeholder="`Reply to ${status?.account ? getDisplayName(status?.account) : 'this thread'}`"
|
:placeholder="`Reply to ${status?.account ? getDisplayName(status.account) : 'this thread'}`"
|
||||||
:in-reply-to-id="id"
|
:in-reply-to-id="id"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ const account = await fetchAccountByName(accountName).catch(() => null)
|
||||||
|
|
||||||
if (account) {
|
if (account) {
|
||||||
useHead({
|
useHead({
|
||||||
title: () => `${account.displayName?.replace(/\:\w+\:/g, '') ?? ''} (@${account.acct})`,
|
title: () => `${getDisplayName(account)} (@${account.acct})`,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue