All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.3 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.4 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.4 (pull_request) Has been skipped
CI / Browser-Tests (pull_request) Successful in 14m21s
CI / PHP 8.3 / mysql:8.4-1 (pull_request) Successful in 19m7s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 5m20s
CI / Build-Artefakte aktuell (pull_request) Successful in 5m46s
- AskBubble unten rechts (abschaltbar), Gespräch bleibt beim Seitenwechsel - Antwortanzeige als gemeinsame Komponente AskAnswer - Trefferliste der Kopfzeilen-Suche in der App-Oberfläche linksbündig - CI: optionale Kern-Plugins für Browser-Tests einschalten, Suchtest mit Demo-Inhalt Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
70 lines
4.2 KiB
Vue
70 lines
4.2 KiB
Vue
<script setup>
|
||
import { computed } from 'vue';
|
||
import { ArrowUpRight, SearchX } from '@lucide/vue';
|
||
import { answerBlocks } from '@/lib/ask';
|
||
|
||
// Antwort von „Frag das Portal“ mit Quellen – auf der Seite und in der schwebenden Blase
|
||
const props = defineProps({
|
||
result: { type: Object, required: true },
|
||
// Kennung für Sprungmarken zu den Quellen (mehrere Antworten auf einer Seite)
|
||
anchor: { type: String, default: 'quelle' },
|
||
compact: { type: Boolean, default: false },
|
||
});
|
||
|
||
const blocks = computed(() => answerBlocks(props.result));
|
||
</script>
|
||
|
||
<template>
|
||
<div v-if="result.found" class="grid min-w-0 grid-cols-1">
|
||
<div class="grid grid-cols-1 leading-relaxed" :class="compact ? 'gap-2 text-sm' : 'gap-3 text-base'">
|
||
<template v-for="(block, i) in blocks" :key="i">
|
||
<p v-if="block.type === 'p'">
|
||
<template v-for="(seg, j) in block.segments" :key="j">
|
||
<a v-if="seg.cite" :href="`#${anchor}-${seg.cite}`" class="mx-0.5 align-super text-[0.7em] font-semibold text-brand-text hover:underline" :aria-label="`Quelle ${seg.cite}`">[{{ seg.cite }}]</a>
|
||
<template v-else>{{ seg.text }}</template>
|
||
</template>
|
||
</p>
|
||
<ul v-else class="grid list-disc gap-1.5 pl-5">
|
||
<li v-for="(item, k) in block.items" :key="k">
|
||
<template v-for="(seg, j) in item" :key="j">
|
||
<a v-if="seg.cite" :href="`#${anchor}-${seg.cite}`" class="mx-0.5 align-super text-[0.7em] font-semibold text-brand-text hover:underline" :aria-label="`Quelle ${seg.cite}`">[{{ seg.cite }}]</a>
|
||
<template v-else>{{ seg.text }}</template>
|
||
</template>
|
||
</li>
|
||
</ul>
|
||
</template>
|
||
</div>
|
||
|
||
<h3 class="mb-2 text-sm font-semibold" :class="compact ? 'mt-4' : 'mt-6'">Quellen</h3>
|
||
<ol class="grid grid-cols-1" :class="compact ? 'gap-1.5' : 'gap-2'">
|
||
<li v-for="source in result.sources" :id="`${anchor}-${source.n}`" :key="source.n" class="min-w-0">
|
||
<a :href="source.url" class="group flex items-start gap-3 rounded-lg border bg-background hover:border-brand-300 hover:bg-accent" :class="compact ? 'px-2.5 py-2' : 'px-3 py-2.5'">
|
||
<span class="grid size-6 shrink-0 place-items-center rounded-full bg-brand-soft text-xs font-semibold text-brand-text">{{ source.n }}</span>
|
||
<span class="min-w-0 flex-1">
|
||
<span class="block font-medium group-hover:underline" :class="{ 'text-sm': compact }">{{ source.title }}</span>
|
||
<span class="block truncate text-xs text-muted-foreground">{{ source.label }}<template v-if="source.meta"> · {{ source.meta }}</template></span>
|
||
</span>
|
||
<ArrowUpRight class="mt-0.5 size-4 shrink-0 text-muted-foreground" />
|
||
</a>
|
||
</li>
|
||
</ol>
|
||
<p class="mt-3 text-xs text-muted-foreground">Automatisch zusammengefasst – im Zweifel gilt, was in den Quellen steht.</p>
|
||
</div>
|
||
|
||
<div v-else class="grid min-w-0 grid-cols-1">
|
||
<div class="flex items-start gap-3">
|
||
<SearchX class="mt-0.5 size-5 shrink-0 text-muted-foreground" />
|
||
<div class="grid gap-1">
|
||
<p class="font-medium" :class="{ 'text-sm': compact }">{{ result.answer }}</p>
|
||
<p class="text-sm text-muted-foreground">Versuchen Sie es mit anderen Worten – oder fragen Sie direkt Ihre Ansprechpersonen.</p>
|
||
</div>
|
||
</div>
|
||
<div v-if="result.suggestions?.length" class="mt-4 grid grid-cols-1 gap-2">
|
||
<p class="text-sm font-medium">Vielleicht hilft Ihnen das weiter:</p>
|
||
<a v-for="item in result.suggestions" :key="item.url" :href="item.url" class="flex items-center justify-between gap-3 rounded-lg border bg-background px-3 py-2 text-sm hover:bg-accent">
|
||
<span class="min-w-0 truncate">{{ item.title }} <span class="text-muted-foreground">· {{ item.label }}</span></span>
|
||
<ArrowUpRight class="size-4 shrink-0 text-muted-foreground" />
|
||
</a>
|
||
</div>
|
||
</div>
|
||
</template>
|