Skip to content

Commit

Permalink
Show "source tags" heading only if generated tags exist
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <[email protected]>
  • Loading branch information
obulat committed May 29, 2024
1 parent 4c66149 commit 579dd43
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions frontend/src/components/VMediaInfo/VMediaTags.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<template>
<div class="flex flex-col gap-6 sm:gap-8">
<div v-if="tagsByType.source.length > 0">
<h3 class="label-regular mb-2">
<div v-if="hasSourceTags">
<h3 v-if="hasGeneratedTags" class="label-regular mb-2">
{{ $t("mediaDetails.tags.source.heading") }}
</h3>
<h3 v-else class="sr-only">{{ $t("mediaDetails.tags.title") }}</h3>
<VCollapsibleTagSection
:media-type="mediaType"
:tags="tagsByType.source"
/>
</div>
<div v-if="tagsByType.generated.length > 0">
<div v-if="hasGeneratedTags">
<div class="label-regular mb-2 flex gap-2">
<h3>{{ $t("mediaDetails.tags.generated.heading") }}</h3>
<VLink :href="generatedTagsPath">{{
Expand Down Expand Up @@ -68,11 +69,16 @@ export default defineComponent({
return { generated: generatedTags, source: sourceTags }
})
const hasSourceTags = computed(() => tagsByType.value.source.length > 0)
const hasGeneratedTags = computed(
() => tagsByType.value.generated.length > 0
)
const { app } = useContext()
const generatedTagsPath = computed(() => app.localePath("/generated-tags"))
return { generatedTagsPath, tagsByType }
return { generatedTagsPath, tagsByType, hasSourceTags, hasGeneratedTags }
},
})
</script>
1 change: 1 addition & 0 deletions frontend/src/locales/scripts/en.json5
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@
imageInfo: "Image information",
audioInfo: "Audio track information",
tags: {
title: "Tags",
generated: {
heading: "Generated tags",
pageTitle: "What is this?",
Expand Down

0 comments on commit 579dd43

Please sign in to comment.