Skip to content

Commit 62c3f7c

Browse files
feat: add a tooltip to explain why user can't use tags suggestion
1 parent b921a8f commit 62c3f7c

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

components/Reuses/DescribeReuse.vue

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@
305305
:warning-text="getFirstWarning('tags')"
306306
/>
307307
<div class="flex items-center gap-4 mt-2 mb-3">
308-
<Tooltip v-if="!canGenerateTags && form.tags.length >= MAX_TAGS_NB">
308+
<Tooltip v-if="!canGenerateTags && tagsSuggestionTooltip">
309309
<BrandedButton
310310
type="button"
311311
color="primary"
@@ -316,7 +316,7 @@
316316
{{ $t('Suggérer des mots clés') }}
317317
</BrandedButton>
318318
<template #tooltip>
319-
{{ $t('Vous avez déjà {count} mots-clés. Le maximum recommandé est de {max}.', { count: form.tags.length, max: MAX_TAGS_NB }) }}
319+
{{ tagsSuggestionTooltip }}
320320
</template>
321321
</Tooltip>
322322
<BrandedButton
@@ -481,6 +481,26 @@ const canGenerateTags = computed(() => {
481481
return hasTitle && hasDescription && hasType && hasLessThanMaxTags
482482
})
483483
484+
const tagsSuggestionTooltip = computed(() => {
485+
if (form.value.tags.length >= MAX_TAGS_NB) {
486+
return t('Vous avez déjà {count} mots-clés. Le maximum recommandé est de {max}.', { count: form.value.tags.length, max: MAX_TAGS_NB })
487+
}
488+
const missing = []
489+
if (!form.value.title || !form.value.title.trim().length) {
490+
missing.push(t('le titre'))
491+
}
492+
if (!form.value.description || !form.value.description.trim().length) {
493+
missing.push(t('la description'))
494+
}
495+
if (!form.value.type?.label || !form.value.type.label.trim().length) {
496+
missing.push(t('le type'))
497+
}
498+
if (missing.length > 0) {
499+
return t('Remplissez {fields} pour utiliser cette fonctionnalité.', { fields: missing.join(', ') })
500+
}
501+
return ''
502+
})
503+
484504
const setFiles = (files: Array<File>) => {
485505
reuseForm.value.image = files[0]
486506
}

server/routes/nuxt-api/albert/generate-reuse-tags.post.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default defineEventHandler(async (event) => {
4141
+ `🧾Normalization rules:\n`
4242
+ `1. Use simple, concrete words (1–3 words max).\n`
4343
+ `2. Avoid repeating the reuse title.\n`
44-
+ `3. Avoid generic words like "données", "open-data", or "réutilisation".\n`
44+
+ `3. Avoid generic words like "données" or "open-data".\n`
4545
+ `4. Avoid technical jargon unless necessary.\n`
4646
+ `5. Use lowercase, singular, no accents, words separated by hyphens, keywords separated by commas.\n`
4747
+ `6. Remove duplicates or close synonyms.\n`

0 commit comments

Comments
 (0)