Loheide-eu-mitarbeiterplatt.../resources/js/lib/listView.js
Friederich Loheide 9cb34635bc
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 9m26s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 9m11s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m4s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m31s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m3s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 13m1s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 10m30s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 46s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 11m28s
Einheitliche Listen (0.61.0)
Gemeinsame Werkzeugleiste ListToolbar (Filter-Chips, Suche, Sortierung,
Kacheln/Liste) für Neuigkeiten, Stellen, Ideen und Personen; im SDK für Plugins.
Neuigkeiten durchsuchbar.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-06 20:12:57 +00:00

29 lines
704 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { ref, watch } from 'vue';
/**
* Kacheln oder Liste – je Seite im Browser gemerkt (@inhaus/ui: useListView).
*
* const view = useListView('verleih', 'grid');
*/
export function useListView(key, fallback = 'grid') {
const storageKey = `inhaus:ansicht:${key}`;
let initial = fallback;
try {
const stored = localStorage.getItem(storageKey);
if (stored === 'grid' || stored === 'list') initial = stored;
} catch {
// ohne Speicher: Standard
}
const view = ref(initial);
watch(view, (value) => {
try {
localStorage.setItem(storageKey, value);
} catch {
// egal
}
});
return view;
}