# ThrillWiki Interaction Patterns This document describes the standardized interaction patterns used throughout ThrillWiki. ## Alpine.js Stores ThrillWiki uses Alpine.js stores for global client-side state management. ### Toast Store The toast store manages notification messages displayed to users. ```javascript // Show a success toast Alpine.store('toast').success('Park saved successfully!'); // Show an error toast Alpine.store('toast').error('Failed to save park'); // Show a warning toast Alpine.store('toast').warning('Your session will expire soon'); // Show an info toast Alpine.store('toast').info('New features are available'); // Toast with custom duration (in ms) Alpine.store('toast').success('Quick message', 2000); // Toast with action button Alpine.store('toast').success('Item deleted', 5000, { action: { label: 'Undo', onClick: () => undoDelete() } }); // Persistent toast (duration = 0) Alpine.store('toast').error('Connection lost', 0); ``` ### Theme Store The theme store manages dark/light mode preferences. ```javascript // Get current theme const isDark = Alpine.store('theme').isDark; // Toggle theme Alpine.store('theme').toggle(); // Set specific theme Alpine.store('theme').set('dark'); Alpine.store('theme').set('light'); Alpine.store('theme').set('system'); ``` ### Auth Store The auth store tracks user authentication state. ```javascript // Check if user is authenticated if (Alpine.store('auth').isAuthenticated) { // Show authenticated content } // Get current user const user = Alpine.store('auth').user; ``` ## HTMX Patterns ### Standard Request Pattern ```html ``` ### Form Submission ```html
``` ### Inline Validation ```html ``` ### Infinite Scroll ```html