diff --git a/components/account/AccountHandle.vue b/components/account/AccountHandle.vue new file mode 100644 index 00000000..2f3b1981 --- /dev/null +++ b/components/account/AccountHandle.vue @@ -0,0 +1,16 @@ + + + diff --git a/components/account/AccountHeader.vue b/components/account/AccountHeader.vue index 97d22e68..c291f2de 100644 --- a/components/account/AccountHeader.vue +++ b/components/account/AccountHeader.vue @@ -66,9 +66,7 @@ function previewAvatar() {
-

- {{ getShortHandle(account) }} -

+
@@ -94,13 +92,13 @@ function previewAvatar() {
- + {{ formattedNumber(account.statusesCount) }} Posts - + {{ humanReadableNumber(account.followingCount) }} Following - + {{ humanReadableNumber(account.followersCount) }} Followers
diff --git a/components/account/AccountInfo.vue b/components/account/AccountInfo.vue index 3ea73f72..fd384d23 100644 --- a/components/account/AccountInfo.vue +++ b/components/account/AccountInfo.vue @@ -20,9 +20,7 @@ const accountHandle = $(useAccountHandle(account, fullServer)) -

- {{ accountHandle }} -

+
diff --git a/composables/masto.ts b/composables/masto.ts index fc319a94..caf04639 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -35,6 +35,10 @@ export const STATUS_VISIBILITIES = [ }, ] as const +export function getServerName(account: Account) { + return account.url.match(UserLinkRE)?.[1] || currentUser.value?.server || '' +} + export function getDisplayName(account: Account) { return account.displayName || account.username } @@ -47,7 +51,7 @@ export function getFullHandle(account: Account) { const handle = `@${account.acct}` if (!currentUser.value || account.acct.includes('@')) return handle - return `${handle}@${account.url.match(UserLinkRE)?.[1] || currentUser.value.server}` + return `${handle}@${getServerName(account)}` } export function toShortHandle(fullHandle: string) {