fix: improve tenant header branding and logo display
This commit is contained in:
7 files changed
+86
-22
No files matched your search
@@ -5,13 +5,19 @@
|
||||
:title="title"
|
||||
@click.stop.prevent="visitBrandDestination"
|
||||
>
|
||||
<img
|
||||
v-if="showLogo"
|
||||
:key="logoUrl"
|
||||
:src="logoUrl"
|
||||
class="nova-tenancy-brand__logo"
|
||||
alt=""
|
||||
/>
|
||||
<span v-if="showLogo" class="nova-tenancy-brand__logo" aria-hidden="true">
|
||||
<img
|
||||
v-if="!logoFailed"
|
||||
:key="logoUrl"
|
||||
:src="logoUrl"
|
||||
alt=""
|
||||
@error="logoFailed = true"
|
||||
/>
|
||||
|
||||
<span v-else class="nova-tenancy-brand__initial">
|
||||
{{ initial }}
|
||||
</span>
|
||||
</span>
|
||||
|
||||
<span v-if="showTitle" class="nova-tenancy-brand__title">
|
||||
{{ title }}
|
||||
@@ -21,12 +27,15 @@
|
||||
|
||||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
||||
import { currentLogoUrl } from '../tenantState'
|
||||
import { currentLogoUrl, tenantInitial } from '../tenantState'
|
||||
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
const configuration = Nova.config('novaTenancy') || {}
|
||||
const brand = ref(null)
|
||||
const current = ref(configuration.current || null)
|
||||
const revision = ref(Date.now())
|
||||
const logoFailed = ref(false)
|
||||
let parentLink = null
|
||||
|
||||
const showLogo = computed(() => configuration.branding?.show_logo !== false)
|
||||
@@ -34,6 +43,7 @@ const showTitle = computed(() => configuration.branding?.show_title !== false)
|
||||
const title = computed(
|
||||
() => current.value?.title || configuration.copy?.selectTenant || 'Select tenant'
|
||||
)
|
||||
const initial = computed(() => tenantInitial(title.value))
|
||||
const logoUrl = computed(() => {
|
||||
const apiBase = configuration.apiBase || '/nova-vendor/nova-tenancy'
|
||||
const key = current.value?.key ?? 'none'
|
||||
@@ -44,6 +54,7 @@ const logoUrl = computed(() => {
|
||||
const updateCurrent = payload => {
|
||||
current.value = payload?.current ?? payload ?? null
|
||||
revision.value = Date.now()
|
||||
logoFailed.value = false
|
||||
}
|
||||
|
||||
const refreshCurrent = async () => {
|
||||
|
||||
Reference in new issue
Block a user