feat(b5): M2b — légende des cinq types et double type pour les indécis

Deux chips maximum : le premier alimente submission_type, le second
s'écrit en tête de description_user (« Type suggéré : X ou Y »), sans
ALTER NocoDB. Le marqueur « Type : non précisé » n'est posé que sans
aucun type (contrat worker/enrich.js inchangé). ?categorie= présélectionne
un seul chip. Tests : 16/16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UvxdoEGWjCTSEJDmraYW96
This commit is contained in:
Jules Neny
2026-09-28 12:14:54 +02:00
co-authored by Claude Opus 5.5
parent 043e2e2348
commit a1edcf3093
3 changed files with 152 additions and 12 deletions
+32 -5
View File
@@ -38,17 +38,20 @@
</div>
<div class="field-group">
<label id="libre-type-label">Type suggéré <span class="label-hint">(optionnel — ça nous aide à trier)</span></label>
<ChipGroup aria-label="Type suggéré">
<label id="libre-type-label">Type suggéré <span class="label-hint">(optionnel — un ou deux si tu hésites)</span></label>
<ChipGroup aria-label="Type suggéré" aria-describedby="libre-type-hint">
<Chip
v-for="t in TYPES_SUGGERES"
:key="t"
:label="TYPES_SUGGERES_LABELS[t]"
variant="fonction"
:active="typeSuggere === t"
:active="typeSuggere === t || typeSecondaire === t"
@toggle="toggleType(t)"
/>
</ChipGroup>
<span id="libre-type-hint" class="label-hint">
Écosystème : {{ TYPES_SUGGERES_HINTS.ecosysteme }} · Réseau : {{ TYPES_SUGGERES_HINTS.reseau }} · Jobs : {{ TYPES_SUGGERES_HINTS.jobs }} · Outils : {{ TYPES_SUGGERES_HINTS.outils }} · Références : {{ TYPES_SUGGERES_HINTS.references }}
</span>
</div>
<div class="field-group" :class="{ 'field-error': errors.submitted_by_email }">
@@ -84,7 +87,7 @@
</template>
<script setup lang="ts">
import { LibreSubmitSchema, TYPES_SUGGERES, TYPES_SUGGERES_LABELS, type TypeSuggere } from '~/utils/submitLibre'
import { LibreSubmitSchema, TYPES_SUGGERES, TYPES_SUGGERES_LABELS, TYPES_SUGGERES_HINTS, type TypeSuggere } from '~/utils/submitLibre'
const props = defineProps<{ presetType?: TypeSuggere }>()
const emit = defineEmits<{ success: [] }>()
@@ -93,6 +96,8 @@ const liens = reactive<string[]>([''])
const texte = ref('')
const email = ref('')
const typeSuggere = ref<TypeSuggere | undefined>(props.presetType)
// Deuxième chip optionnelle (B5-M2b) — pour les indécis entre deux types.
const typeSecondaire = ref<TypeSuggere | undefined>()
const siteWeb = ref('') // honeypot
const errors = reactive<Record<string, string>>({})
@@ -108,8 +113,29 @@ function removeLien(i: number) {
if (liens.length === 0) liens.push('')
}
/**
* Deux chips maximum. Premier clic = principal, deuxième = secondaire.
* Décocher le principal alors qu'un secondaire existe promeut ce dernier.
* Troisième clic sur un chip inactif quand deux sont déjà actifs : remplace
* le secondaire par le nouveau chip (choix le plus simple — pas de file d'attente).
*/
function toggleType(t: TypeSuggere) {
typeSuggere.value = typeSuggere.value === t ? undefined : t
if (typeSuggere.value === t) {
typeSuggere.value = typeSecondaire.value
typeSecondaire.value = undefined
return
}
if (typeSecondaire.value === t) {
typeSecondaire.value = undefined
return
}
if (typeSuggere.value === undefined) {
typeSuggere.value = t
} else if (typeSecondaire.value === undefined) {
typeSecondaire.value = t
} else {
typeSecondaire.value = t
}
}
function currentPayload() {
@@ -118,6 +144,7 @@ function currentPayload() {
texte: texte.value,
submitted_by_email: email.value || undefined,
type_suggere: typeSuggere.value,
type_secondaire: typeSecondaire.value,
site_web: siteWeb.value,
}
}