starfleet-ui
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#6 · main · 2 min 01 s
0Étoiles
0Forks
0Issues
| 1 | <script lang="ts"> |
| 2 | import type { Hint } from '$lib/game/advisor'; |
| 3 | import { specFor } from '$lib/game/actions'; |
| 4 | import Button from '$lib/ui/Button.svelte'; |
| 5 | |
| 6 | interface Props { |
| 7 | hints: Hint[]; |
| 8 | onAction: (action: string) => void; |
| 9 | onTarget: (symbol: string) => void; |
| 10 | } |
| 11 | |
| 12 | let { hints, onAction, onTarget }: Props = $props(); |
| 13 | |
| 14 | const TONE = { |
| 15 | danger: 'border-red-500/50 bg-red-950/50 text-red-100', |
| 16 | warn: 'border-amber-400/40 bg-amber-950/40 text-amber-100', |
| 17 | info: 'border-cyan-400/30 bg-cyan-950/40 text-cyan-50' |
| 18 | }; |
| 19 | const ICON = { danger: '⚠', warn: '!', info: '›' }; |
| 20 | </script> |
| 21 | |
| 22 | {#if hints.length} |
| 23 | <ul class="space-y-2" aria-label="Suggestions"> |
| 24 | {#each hints as h (h.id)} |
| 25 | <li class="animate-rise flex items-start gap-2.5 rounded-lg border px-3 py-2 text-sm {TONE[h.level]}"> |
| 26 | <span aria-hidden="true" class="mt-px font-bold">{ICON[h.level]}</span> |
| 27 | <span class="flex-1">{h.text}</span> |
| 28 | <span class="flex shrink-0 gap-1"> |
| 29 | {#if h.target} |
| 30 | <Button size="sm" variant="ghost" onclick={() => onTarget(h.target!)}>Show</Button> |
| 31 | {/if} |
| 32 | {#if h.action} |
| 33 | <Button size="sm" variant="primary" onclick={() => onAction(h.action!)}>{specFor(h.action).label}</Button> |
| 34 | {/if} |
| 35 | </span> |
| 36 | </li> |
| 37 | {/each} |
| 38 | </ul> |
| 39 | {/if} |