Files
space-booking/frontend/src/composables/useLandingTheme.ts
Claude Agent b2080e79b2 feat(frontend): pagini Termeni, Confidențialitate/GDPR și Contact
Activează linkurile din footer-ul landing-ului către pagini reale,
în stilul paginilor statice din autopass.

- Componentă comună LegalPage.vue: același antet (brand + selector
  de temă), footer și paletă (8 teme) ca landing-ul, cu slot "prose"
- Logica temei extrasă în composable useLandingTheme (partajat de
  landing și paginile legale, persistat în localStorage)
- Rute publice /termeni, /confidentialitate, /contact (fullBleed)
- Footer-ul (landing + pagini) trimite acum la aceste rute

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 18:10:17 +00:00

44 lines
1.3 KiB
TypeScript

import { ref, computed } from 'vue'
/**
* Theme selector for the public pages (landing + legal/contact).
* Same 8 themes and cycle order as the ROA app / autopass landing.
* Persisted under its own key so it doesn't clash with the in-app theme.
*/
const THEMES: [string, string][] = [
['light', 'Light'],
['dark', 'Dark'],
['petrol', 'Petrol'],
['grafit', 'Grafit'],
['cobalt', 'Cobalt'],
['cupru', 'Cupru'],
['hartie', 'Hârtie'],
['auto', 'Auto']
]
const THEME_KEY = 'roa-landing-theme'
const VALID = new Set(THEMES.map((t) => t[0]))
function resolve(id: string): string {
if (id === 'auto') {
return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
}
return id
}
// Module-level singleton so every public page shares the same selection.
const stored = localStorage.getItem(THEME_KEY)
const themeId = ref(stored && VALID.has(stored) ? stored : 'grafit')
export function useLandingTheme() {
const theme = computed(() => resolve(themeId.value))
const themeLabel = computed(() => THEMES.find((t) => t[0] === themeId.value)?.[1] ?? 'Grafit')
function cycleTheme() {
const idx = THEMES.findIndex((t) => t[0] === themeId.value)
themeId.value = THEMES[(idx + 1) % THEMES.length][0]
localStorage.setItem(THEME_KEY, themeId.value)
}
return { themeId, theme, themeLabel, cycleTheme }
}