Kleinanzeigen 1.3.0: einheitliche Werkzeugleiste mit Listenansicht

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-10-06 19:57:17 +00:00
parent 2be070eb67
commit 9a418d5465
6 changed files with 43 additions and 33 deletions

File diff suppressed because one or more lines are too long

2
dist/assets/style-BD4vSwmw.css vendored Normal file

File diff suppressed because one or more lines are too long

2
dist/inhaus.json vendored
View file

@ -9,6 +9,6 @@
"widgets/Latest": "widgets/Latest.js"
},
"css": [
"assets/style-4oROdXNr.css"
"assets/style-BD4vSwmw.css"
]
}

2
dist/pages/Index.js vendored

File diff suppressed because one or more lines are too long

View file

@ -1,13 +1,13 @@
{
"slug": "kleinanzeigen",
"name": "Kleinanzeigen",
"version": "1.2.0",
"version": "1.3.0",
"description": "Kleinanzeigen von Kolleginnen und Kollegen für Kolleginnen und Kollegen: verkaufen, verschenken, suchen, tauschen – mit Fotos, Merkliste und Freigabe durch die Moderation. Kontakt über das Chat-Plugin oder per E-Mail.",
"author": "Loheide",
"namespace": "Inhaus\\Plugins\\Kleinanzeigen\\",
"class": "Inhaus\\Plugins\\Kleinanzeigen\\KleinanzeigenPlugin",
"requires": {
"core": ">=0.39.1",
"core": ">=0.61.0",
"php": ">=8.3"
},
"update_url": "https://git.loheide.cloud/api/v1/repos/friloo/inhaus-plugin-kleinanzeigen/releases/latest"

View file

@ -1,8 +1,8 @@
<script setup>
import { ref, watch } from 'vue';
import { watch } from 'vue';
import { Link, router, usePage } from '@inertiajs/vue3';
import { Heart, ListChecks, Plus, Search, ShieldCheck, ShoppingBag } from '@lucide/vue';
import { AppLayout, Button, EmptyState, PageHeader, toast } from '@inhaus/ui';
import { Heart, ListChecks, Plus, ShieldCheck, ShoppingBag } from '@lucide/vue';
import { AppLayout, Button, EmptyState, ListToolbar, PageHeader, toast, useListView } from '@inhaus/ui';
import ListingCard from '../components/ListingCard.vue';
const props = defineProps({
@ -19,12 +19,7 @@ const props = defineProps({
const page = usePage();
watch(() => page.props.flash?.status, (status) => status && toast.success(status), { immediate: true });
const query = ref(props.filters.q);
let timer;
watch(query, (value) => {
clearTimeout(timer);
timer = setTimeout(() => apply({ q: value }), 350);
});
const view = useListView('kleinanzeigen', 'grid');
function apply(changes) {
const params = { ...props.filters, ...changes };
@ -48,16 +43,6 @@ const sorts = { neu: 'Neueste zuerst', preis: 'Preis aufsteigend', 'preis-ab': '
<div class="ih:grid ih:gap-6 ih:lg:grid-cols-[15rem_minmax(0,1fr)]">
<aside class="ih:grid ih:content-start ih:gap-5">
<div class="ih:relative">
<Search class="ih:pointer-events-none ih:absolute ih:top-1/2 ih:left-2.5 ih:size-4 ih:-translate-y-1/2 ih:text-muted-foreground" />
<input v-model="query" type="search" placeholder="Suchen" aria-label="Anzeigen durchsuchen" class="ih:h-10 ih:w-full ih:rounded-md ih:border ih:border-input ih:bg-card ih:pr-3 ih:pl-8 ih:text-sm ih:shadow-xs ih:focus-visible:ring-3 ih:focus-visible:ring-ring/30 ih:focus-visible:outline-none" />
</div>
<nav aria-label="Art" class="ih:flex ih:flex-wrap ih:gap-1.5">
<button type="button" class="ih:rounded-full ih:border ih:px-3 ih:py-1 ih:text-[13px]" :class="!filters.typ ? 'ih:border-brand ih:bg-brand ih:text-brand-foreground' : 'ih:bg-card ih:hover:bg-accent'" :aria-pressed="!filters.typ" @click="apply({ typ: null })">Alle</button>
<button v-for="(label, key) in types" :key="key" type="button" class="ih:rounded-full ih:border ih:px-3 ih:py-1 ih:text-[13px]" :class="filters.typ === key ? 'ih:border-brand ih:bg-brand ih:text-brand-foreground' : 'ih:bg-card ih:hover:bg-accent'" :aria-pressed="filters.typ === key" @click="apply({ typ: key })">{{ label }}</button>
</nav>
<nav aria-label="Kategorien" class="ih:hidden ih:lg:block">
<h2 class="ih:mb-1.5 ih:text-xs ih:font-semibold ih:tracking-wider ih:text-muted-foreground ih:uppercase">Kategorien</h2>
<ul class="ih:grid ih:gap-0.5 ih:text-sm">
@ -76,19 +61,44 @@ const sorts = { neu: 'Neueste zuerst', preis: 'Preis aufsteigend', 'preis-ab': '
</aside>
<section class="ih:min-w-0">
<div class="ih:mb-4 ih:flex ih:flex-wrap ih:items-center ih:gap-3">
<p class="ih:flex-1 ih:text-sm ih:text-muted-foreground">{{ pagination.total }} {{ pagination.total === 1 ? 'Anzeige' : 'Anzeigen' }}</p>
<button type="button" class="ih:inline-flex ih:items-center ih:gap-1.5 ih:rounded-md ih:border ih:px-3 ih:py-1.5 ih:text-sm" :class="filters.merkliste ? 'ih:border-brand ih:bg-brand-soft ih:text-brand-text' : 'ih:bg-card ih:hover:bg-accent'" :aria-pressed="filters.merkliste" @click="apply({ merkliste: filters.merkliste ? null : 1 })">
<ListToolbar
:filters="[{ value: null, label: 'Alle' }, ...Object.entries(types).map(([value, label]) => ({ value, label }))]"
:filter="filters.typ || null"
filter-label="Art"
:search="filters.q ?? ''"
search-placeholder="Anzeigen durchsuchen"
:sorts="Object.entries(sorts).map(([value, label]) => ({ value, label }))"
:sort="filters.sortierung || 'neu'"
v-model:view="view"
@update:filter="(value) => apply({ typ: value })"
@update:search="(value) => apply({ q: value })"
@update:sort="(value) => apply({ sortierung: value })"
>
<button type="button" class="ih:inline-flex ih:h-9 ih:items-center ih:gap-1.5 ih:rounded-full ih:border ih:px-3 ih:text-sm" :class="filters.merkliste ? 'ih:border-brand ih:bg-brand-soft ih:text-brand-text' : 'ih:bg-card ih:hover:bg-accent'" :aria-pressed="!!filters.merkliste" @click="apply({ merkliste: filters.merkliste ? null : 1 })">
<Heart class="ih:size-4" :class="filters.merkliste ? 'ih:fill-current' : ''" /> Merkliste
</button>
<select class="ih:h-9 ih:rounded-md ih:border ih:bg-card ih:px-2 ih:text-sm" aria-label="Sortierung" :value="filters.sortierung" @change="apply({ sortierung: $event.target.value })">
<option v-for="(label, key) in sorts" :key="key" :value="key">{{ label }}</option>
</select>
</div>
</ListToolbar>
<p class="ih:-mt-2 ih:mb-3 ih:text-sm ih:text-muted-foreground">{{ pagination.total }} {{ pagination.total === 1 ? 'Anzeige' : 'Anzeigen' }}</p>
<div v-if="listings.length" class="ih:grid ih:grid-cols-2 ih:gap-3 ih:sm:gap-4 ih:md:grid-cols-3 ih:xl:grid-cols-4">
<div v-if="listings.length && view === 'grid'" class="ih:grid ih:grid-cols-2 ih:gap-3 ih:sm:gap-4 ih:md:grid-cols-3 ih:xl:grid-cols-4">
<ListingCard v-for="listing in listings" :key="listing.id" :listing="listing" />
</div>
<ul v-else-if="listings.length" class="ih:divide-y ih:rounded-lg ih:border ih:bg-card">
<li v-for="listing in listings" :key="listing.id">
<Link :href="listing.url" class="ih:flex ih:items-center ih:gap-3 ih:px-4 ih:py-2.5 ih:hover:bg-accent/60">
<span class="ih:grid ih:size-14 ih:shrink-0 ih:place-items-center ih:overflow-hidden ih:rounded-md ih:bg-muted">
<img v-if="listing.thumb_url" :src="listing.thumb_url" alt="" class="ih:size-full ih:object-cover" />
<ShoppingBag v-else class="ih:size-5 ih:text-muted-foreground" />
</span>
<span class="ih:grid ih:min-w-0 ih:flex-1">
<span class="ih:text-xs ih:text-muted-foreground">{{ listing.type_label }} · {{ listing.category_label }}<template v-if="listing.reserved"> · reserviert</template></span>
<span class="ih:truncate ih:font-medium">{{ listing.title }}</span>
<span v-if="listing.location" class="ih:truncate ih:text-xs ih:text-muted-foreground">{{ listing.location }}</span>
</span>
<span v-if="listing.price" class="ih:shrink-0 ih:font-semibold ih:text-brand-text">{{ listing.price }}</span>
</Link>
</li>
</ul>
<div v-else class="ih:rounded-lg ih:border ih:bg-card">
<EmptyState :icon="ShoppingBag" :title="filters.q || filters.typ || filters.kategorie || filters.merkliste ? 'Keine passenden Anzeigen' : 'Noch keine Anzeigen'" text="Etwas übrig oder auf der Suche? Geben Sie die erste Anzeige auf." />
</div>