Added a guest haptics preference and surfaced it in both the settings sheet and /settings, with safe device detection

and a reduced‑motion guard. Haptics now honor the toggle and still fall back gracefully on iOS (switch disabled when
  navigator.vibrate isn’t available).

  What changed

  - Haptics preference storage + gating: resources/js/guest/lib/haptics.ts
  - Preference hook: resources/js/guest/hooks/useHapticsPreference.ts
  - Settings UI toggle in sheet + page: resources/js/guest/components/settings-sheet.tsx, resources/js/guest/pages/
    SettingsPage.tsx
  - i18n labels: resources/js/guest/i18n/messages.ts
  - Tests: resources/js/guest/lib/__tests__/haptics.test.ts
This commit is contained in:
Codex Agent
2025-12-27 14:00:12 +01:00
parent 3e3a2c49d6
commit fa5a1fa367
11 changed files with 241 additions and 1 deletions

View File

@@ -653,6 +653,12 @@ export const messages: Record<LocaleCode, NestedMessages> = {
saved: 'Gespeichert (ok)',
loading: 'Lade gespeicherten Namen...',
},
haptics: {
title: 'Haptisches Feedback',
description: 'Kurze Vibrationen bei Likes, Uploads und Aktualisierungen.',
label: 'Vibrationen aktivieren',
unsupported: 'Auf diesem Gerät nicht verfügbar.',
},
legal: {
title: 'Rechtliches',
description: 'Die rechtlich verbindlichen Texte sind jederzeit hier abrufbar.',
@@ -1345,6 +1351,12 @@ export const messages: Record<LocaleCode, NestedMessages> = {
saved: 'Saved',
loading: 'Loading saved name...',
},
haptics: {
title: 'Haptic feedback',
description: 'Short vibrations for likes, uploads, and refreshes.',
label: 'Enable vibrations',
unsupported: 'Not available on this device.',
},
legal: {
title: 'Legal',
description: 'The legally binding documents are always available here.',