From a5ef2bdc674deb2d2c5d44f23ca94499c845c1af Mon Sep 17 00:00:00 2001 From: patak Date: Thu, 24 Nov 2022 15:20:50 +0100 Subject: [PATCH] feat: avatar on the side in StatusCard --- components/account/AccountInfo.vue | 4 +- components/status/StatusAccountDetails.vue | 19 +++++++++ components/status/StatusCard.vue | 45 ++++++++++++---------- composables/masto.ts | 4 ++ 4 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 components/status/StatusAccountDetails.vue diff --git a/components/account/AccountInfo.vue b/components/account/AccountInfo.vue index 1448bde9..986cff86 100644 --- a/components/account/AccountInfo.vue +++ b/components/account/AccountInfo.vue @@ -7,7 +7,7 @@ const { account, link = true, fullServer = false } = defineProps<{ fullServer?: boolean }>() -const id = computed(() => fullServer && !account.acct.includes('@') ? `@${account.acct}@${account.url.match(UserLinkRE)?.[1]}` : getAccountHandle(account)) +const accountHandle = $(useAccountHandle(account, fullServer)) diff --git a/composables/masto.ts b/composables/masto.ts index 28e46b11..623940af 100644 --- a/composables/masto.ts +++ b/composables/masto.ts @@ -45,6 +45,10 @@ export function getStatusPath(status: Status) { return `/status/${status.id}` } +export function useAccountHandle(account: Account, fullServer = true) { + return computed(() => fullServer && !account.acct.includes('@') ? `@${account.acct}@${account.url.match(UserLinkRE)?.[1]}` : getAccountHandle(account)) +} + // Batch requests for relationships when used in the UI // We don't want to hold to old values, so every time a Relationship is needed it // is requested again from the server to show the latest state