forked from yvv/decision
- Aujourd'hui (Fil 13 sections + capture sticky) + Le chemin (tunnel 2 gestes, Q0 inline, 3 chips, dérogation asymétrique, alternatives réglage/consignation) - Registre + fiche décision (timeline, périmètre premier/second lieu auditable, affluence non-ignorable, S'instruire condensé, éléments + cartographie de clôture, épreuve du réel, Remettre en question, PV A4, gravure) - Salle de vote 5 modalités (consentement, nuancé+histogramme, binaire hérité avec jauge inertielle, Réglage collectif complet — faisceau, médiane basse, Pour moi, Explorer, cristallisation-geste —, élection à départage humain) - Textes (Pacte en clair, document vivant, diff, vue projetée, Atelier des formules porté du v1 sur le moteur unique) + Mandats (faits comptés, feux de la rampe, wizard 3 étapes) + Observatoire (consigner→observer→protocoliser) - Onboarding 7 gabarits + Données locales (export/import, attributs, atelier) - voting→framing gardé (Reformuler d'un réglage figé non cristallisé) - Pages v1 supprimées (login, documents, mandates, protocols, sanctuary, tools, decisions/new) — 342 tests verts, build zéro erreur Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
79 lines
2.3 KiB
Vue
79 lines
2.3 KiB
Vue
<script setup lang="ts">
|
|
// Advice request card — three inline positions, one tap each.
|
|
import type { Advice, Decision } from '~/types/domain'
|
|
import { ROUTE_ICONS } from '~/lexicon'
|
|
import { useCollectiveStore } from '~/stores/collective'
|
|
import { useDecisionsStore } from '~/stores/decisions'
|
|
|
|
const props = defineProps<{ decision: Decision }>()
|
|
|
|
const col = useCollectiveStore()
|
|
const decisions = useDecisionsStore()
|
|
const error = ref('')
|
|
|
|
const POSITIONS: { value: Advice['position']; label: string; icon: string }[] = [
|
|
{ value: 'favorable', label: 'Favorable', icon: 'i-lucide-thumbs-up' },
|
|
{ value: 'reserved', label: 'Réservé', icon: 'i-lucide-minus' },
|
|
{ value: 'unfavorable', label: 'Défavorable', icon: 'i-lucide-thumbs-down' },
|
|
]
|
|
|
|
const mine = computed(() =>
|
|
col.advices.find(a => a.decisionId === props.decision.id && a.personId === col.me?.id),
|
|
)
|
|
const mineLabel = computed(
|
|
() => POSITIONS.find(p => p.value === mine.value?.position)?.label ?? '',
|
|
)
|
|
|
|
function give(position: Advice['position']) {
|
|
const res = decisions.adviseOn(props.decision.id, position)
|
|
error.value = 'ok' in res ? res.reason : ''
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<!-- ld-v2 -->
|
|
<FeedItemCard
|
|
:title="decision.title"
|
|
:icon="ROUTE_ICONS.advice"
|
|
tint="var(--route-advice)"
|
|
:to="`/decisions/${decision.id}`"
|
|
>
|
|
<template #meta>
|
|
<LdCountdown :ends-at="decision.windowEndsAt" :suspended-at="decision.windowSuspendedAt" />
|
|
</template>
|
|
|
|
<p v-if="error" class="fa-error">{{ error }}</p>
|
|
|
|
<template #actions>
|
|
<span v-if="mine" class="fa-done">
|
|
<UIcon name="i-lucide-check" /> Ton avis est déposé — {{ mineLabel }}
|
|
</span>
|
|
<template v-else>
|
|
<button
|
|
v-for="p in POSITIONS"
|
|
:key="p.value"
|
|
class="ld-btn ld-btn--ghost fa-btn"
|
|
type="button"
|
|
@click="give(p.value)"
|
|
>
|
|
<UIcon :name="p.icon" />
|
|
<span>{{ p.label }}</span>
|
|
</button>
|
|
</template>
|
|
</template>
|
|
</FeedItemCard>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.fa-error { margin: 0; font-size: 0.8125rem; color: var(--mood-error); }
|
|
.fa-done {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.35rem;
|
|
font-size: 0.875rem;
|
|
font-weight: 600;
|
|
color: var(--mood-status-vigueur);
|
|
}
|
|
.fa-btn { font-size: 0.875rem; padding: 0.4rem 0.875rem; }
|
|
</style>
|