Loheide-eu-mitarbeiterplatt.../resources/js/components/QuickLinksRow.vue
Friederich Loheide a618927a52
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m7s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m30s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 8m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m21s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 17m13s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 17m12s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m52s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m29s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m23s
Schnellzugriffe mit Logo, Kategorien und Sichtbar für (0.51.0)
Untertitel, Logo, Kategorie, Rollen und Anheften je Eintrag; Knopf
„Anwendungen“ in der Kopfzeile mit allen sichtbaren Einträgen.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 18:44:53 +00:00

94 lines
4.2 KiB
Vue

<script setup>
import { onMounted, ref } from 'vue';
import { Link } from '@inertiajs/vue3';
import { useEventListener, useResizeObserver } from '@vueuse/core';
import { ChevronLeft, ChevronRight, LayoutGrid } from '@lucide/vue';
import AppMark from '@/components/apps/AppMark.vue';
import { appsOpen } from '@/lib/apps';
const props = defineProps({
links: { type: Array, required: true },
total: { type: Number, default: 0 },
});
const more = () => Math.max(0, props.total - props.links.length);
const track = ref(null);
const canScrollLeft = ref(false);
const canScrollRight = ref(false);
function update() {
const el = track.value;
if (!el) return;
canScrollLeft.value = el.scrollLeft > 4;
canScrollRight.value = el.scrollLeft + el.clientWidth < el.scrollWidth - 4;
}
function scroll(direction) {
track.value?.scrollBy({ left: direction * track.value.clientWidth * 0.8, behavior: 'smooth' });
}
onMounted(update);
useResizeObserver(track, update);
useEventListener(track, 'scroll', update, { passive: true });
</script>
<template>
<!-- Breit (Hauptspalte): wischbare Reihe; schmal (Seitenleiste, Handy): Raster mit drei Spalten -->
<section class="@container rounded-lg border bg-card">
<header class="flex items-center justify-between px-5 pt-4 pb-3 @max-md:px-4">
<h2 class="text-base font-semibold">Schnellzugriff</h2>
<div v-if="canScrollLeft || canScrollRight" class="flex gap-1.5">
<button
type="button"
class="grid size-7 place-items-center rounded-md border text-foreground/70 hover:bg-accent disabled:opacity-40"
:disabled="!canScrollLeft"
aria-label="Zurück"
@click="scroll(-1)"
>
<ChevronLeft class="size-4" />
</button>
<button
type="button"
class="grid size-7 place-items-center rounded-md border text-foreground/70 hover:bg-accent disabled:opacity-40"
:disabled="!canScrollRight"
aria-label="Weiter"
@click="scroll(1)"
>
<ChevronRight class="size-4" />
</button>
</div>
</header>
<div
ref="track"
class="flex snap-x scroll-px-5 gap-3 overflow-x-auto px-5 pb-5 [scrollbar-width:none] @max-md:grid @max-md:grid-cols-3 @max-md:gap-2 @max-md:overflow-visible @max-md:px-4 @max-md:pb-4 [&::-webkit-scrollbar]:hidden"
>
<component
:is="link.url.startsWith('/') && !link.new_tab ? Link : 'a'"
v-for="link in links"
:key="link.label + link.url"
:href="link.url"
:target="link.new_tab ? '_blank' : undefined"
:rel="link.new_tab ? 'noopener' : undefined"
class="flex w-[116px] shrink-0 snap-start flex-col items-center gap-2.5 rounded-md bg-muted px-2 py-4 text-center transition-colors hover:bg-brand-soft @max-md:w-auto @max-md:gap-2 @max-md:px-1.5 @max-md:py-3"
>
<AppMark :app="link" class="size-10" />
<span class="grid gap-0.5">
<span class="text-xs leading-tight font-medium break-words hyphens-auto">{{ link.label }}</span>
<span v-if="link.subtitle" class="text-[11px] leading-tight text-muted-foreground">{{ link.subtitle }}</span>
</span>
</component>
<button
v-if="more()"
type="button"
class="flex w-[116px] shrink-0 snap-start flex-col items-center gap-2.5 rounded-md border border-dashed px-2 py-4 text-center transition-colors hover:bg-accent @max-md:w-auto @max-md:gap-2 @max-md:px-1.5 @max-md:py-3"
@click.stop="appsOpen = true"
>
<span class="grid size-10 place-items-center rounded-lg bg-muted text-foreground/70"><LayoutGrid class="size-5" /></span>
<span class="text-xs leading-tight font-medium">Alle Anwendungen<span class="block text-[11px] font-normal text-muted-foreground">{{ more() }} weitere</span></span>
</button>
</div>
</section>
</template>