Schnellzugriffe mit Logo, Kategorien und Sichtbar für (0.51.0)
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
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
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>
This commit is contained in:
parent
25fe5e8c37
commit
a618927a52
152 changed files with 653 additions and 379 deletions
|
|
@ -2,13 +2,17 @@
|
|||
import { onMounted, ref } from 'vue';
|
||||
import { Link } from '@inertiajs/vue3';
|
||||
import { useEventListener, useResizeObserver } from '@vueuse/core';
|
||||
import { ChevronLeft, ChevronRight } from '@lucide/vue';
|
||||
import AppIcon from '@/components/AppIcon.vue';
|
||||
import { ChevronLeft, ChevronRight, LayoutGrid } from '@lucide/vue';
|
||||
import AppMark from '@/components/apps/AppMark.vue';
|
||||
import { appsOpen } from '@/lib/apps';
|
||||
|
||||
defineProps({
|
||||
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);
|
||||
|
|
@ -70,9 +74,21 @@ useEventListener(track, 'scroll', update, { passive: true });
|
|||
: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"
|
||||
>
|
||||
<AppIcon :name="link.icon || 'link'" class="size-6 text-brand-text" :stroke-width="1.6" />
|
||||
<span class="text-xs leading-tight font-medium break-words hyphens-auto">{{ link.label }}</span>
|
||||
<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>
|
||||
|
|
|
|||
87
resources/js/components/apps/AppLauncher.vue
Normal file
87
resources/js/components/apps/AppLauncher.vue
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
<script setup>
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { Link, usePage } from '@inertiajs/vue3';
|
||||
import { ArrowUpRight, LayoutGrid, Search } from '@lucide/vue';
|
||||
import { Popover, PopoverContent, PopoverTrigger } from '@/components/ui/popover';
|
||||
import AppMark from '@/components/apps/AppMark.vue';
|
||||
import { appsOpen } from '@/lib/apps';
|
||||
|
||||
/**
|
||||
* „Anwendungen“ in der Kopfzeile: alle Schnellzugriffe, die die Person sehen darf –
|
||||
* nach Kategorien geordnet, ab neun Einträgen mit Suche.
|
||||
*/
|
||||
const page = usePage();
|
||||
const apps = computed(() => page.props.apps ?? []);
|
||||
const query = ref('');
|
||||
|
||||
watch(appsOpen, (open) => open || (query.value = ''));
|
||||
|
||||
const filtered = computed(() => {
|
||||
const q = query.value.trim().toLowerCase();
|
||||
|
||||
return q ? apps.value.filter((app) => `${app.label} ${app.subtitle} ${app.category}`.toLowerCase().includes(q)) : apps.value;
|
||||
});
|
||||
|
||||
const groups = computed(() => {
|
||||
const map = new Map();
|
||||
|
||||
for (const app of filtered.value) {
|
||||
const key = app.category || '';
|
||||
if (!map.has(key)) map.set(key, []);
|
||||
map.get(key).push(app);
|
||||
}
|
||||
|
||||
// Ohne Kategorie zuerst, dann in der Reihenfolge des ersten Auftretens
|
||||
return [...map.entries()].sort(([a], [b]) => (a === '' ? -1 : b === '' ? 1 : 0)).map(([name, items]) => ({ name, items }));
|
||||
});
|
||||
|
||||
const wide = computed(() => apps.value.length > 6);
|
||||
const isInternal = (app) => app.url.startsWith('/') && !app.new_tab;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Popover v-if="apps.length" v-model:open="appsOpen">
|
||||
<PopoverTrigger
|
||||
class="grid size-10 place-items-center rounded-md text-foreground/70 hover:bg-accent hover:text-foreground data-[state=open]:bg-accent"
|
||||
aria-label="Anwendungen"
|
||||
title="Anwendungen"
|
||||
>
|
||||
<LayoutGrid class="size-5" />
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="end" class="max-h-[min(36rem,calc(100dvh-6rem))] overflow-y-auto p-3" :class="wide ? 'w-[min(34rem,calc(100vw-2rem))]' : 'w-[min(22rem,calc(100vw-2rem))]'">
|
||||
<div class="grid gap-3">
|
||||
<div class="flex items-center justify-between px-1">
|
||||
<p class="text-sm font-semibold">Anwendungen</p>
|
||||
<span class="text-xs text-muted-foreground">{{ apps.length }}</span>
|
||||
</div>
|
||||
<label v-if="apps.length > 8" class="flex h-9 items-center gap-2 rounded-md border px-2.5 text-sm text-muted-foreground focus-within:ring-2 focus-within:ring-ring">
|
||||
<Search class="size-4" />
|
||||
<input v-model="query" type="search" placeholder="Anwendung suchen" class="min-w-0 flex-1 bg-transparent text-foreground outline-none" />
|
||||
</label>
|
||||
<section v-for="group in groups" :key="group.name" class="grid gap-1">
|
||||
<h3 v-if="group.name" class="px-1 pt-1 text-xs font-semibold tracking-wide text-muted-foreground uppercase">{{ group.name }}</h3>
|
||||
<div class="grid gap-1" :class="wide ? 'grid-cols-3' : 'grid-cols-2'">
|
||||
<component
|
||||
:is="isInternal(app) ? Link : 'a'"
|
||||
v-for="app in group.items"
|
||||
:key="app.label + app.url"
|
||||
:href="app.url"
|
||||
:target="app.new_tab ? '_blank' : undefined"
|
||||
:rel="app.new_tab ? 'noopener' : undefined"
|
||||
class="group relative flex flex-col items-center gap-2 rounded-lg px-2 py-3 text-center hover:bg-accent"
|
||||
@click="appsOpen = false"
|
||||
>
|
||||
<AppMark :app="app" class="size-11" />
|
||||
<span class="grid gap-0.5">
|
||||
<span class="text-[13px] leading-tight font-medium">{{ app.label }}</span>
|
||||
<span v-if="app.subtitle" class="text-[11px] leading-tight text-muted-foreground">{{ app.subtitle }}</span>
|
||||
</span>
|
||||
<ArrowUpRight v-if="app.new_tab" class="absolute top-2 right-2 size-3.5 text-muted-foreground opacity-0 group-hover:opacity-100" aria-label="öffnet in neuem Tab" />
|
||||
</component>
|
||||
</div>
|
||||
</section>
|
||||
<p v-if="!filtered.length" class="px-1 py-4 text-center text-sm text-muted-foreground">Nichts gefunden.</p>
|
||||
</div>
|
||||
</PopoverContent>
|
||||
</Popover>
|
||||
</template>
|
||||
15
resources/js/components/apps/AppMark.vue
Normal file
15
resources/js/components/apps/AppMark.vue
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<script setup>
|
||||
import AppIcon from '@/components/AppIcon.vue';
|
||||
|
||||
/** Logo einer Anwendung – oder ihr Symbol, wenn kein Logo hochgeladen ist */
|
||||
defineProps({
|
||||
app: { type: Object, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span class="grid shrink-0 place-items-center overflow-hidden rounded-lg" :class="app.logo_url ? 'bg-white ring-1 ring-border' : 'bg-brand-soft text-brand-text'">
|
||||
<img v-if="app.logo_url" :src="app.logo_url" alt="" class="size-full object-contain p-1" />
|
||||
<AppIcon v-else :name="app.icon || 'link'" class="size-[55%]" :stroke-width="1.7" />
|
||||
</span>
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue