1
0

chore: preview header only when it's already set (#1311)

Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
webfansplz 2023-01-19 18:26:40 +08:00 committed by GitHub
parent a48524e7ad
commit 09997c2f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,7 @@ const relationship = $(useRelationship(account))
const namedFields = ref<mastodon.v1.AccountField[]>([])
const iconFields = ref<mastodon.v1.AccountField[]>([])
const hasHeader = $computed(() => !account.header.endsWith('/original/missing.png'))
function getFieldIconTitle(fieldName: string) {
return fieldName === 'Joined' ? t('account.joined') : fieldName
@ -85,9 +86,9 @@ const isNotifiedOnPost = $computed(() => !!relationship?.notifying)
<template>
<div flex flex-col>
<button border="b base" z-1>
<img h-50 height="200" w-full object-cover :src="account.header" :alt="t('account.profile_description', [account.username])" @click="previewHeader">
</button>
<component :is="hasHeader ? 'button' : 'div'" border="b base" z-1 @click="hasHeader ? previewHeader() : undefined">
<img h-50 height="200" w-full object-cover :src="account.header" :alt="t('account.profile_description', [account.username])">
</component>
<div p4 mt--18 flex flex-col gap-4>
<div relative>
<div flex="~ col gap-2 1">