feat: Complete frontend master upgrade with PWA, SEO, Bundle Analysis, and State Management
- Install nanostores for lightweight state management - Add enhanced Directus client with auth and realtime - Configure PWA with offline support and service worker - Enable auto-sitemap generation for SEO - Add Partytown for web worker analytics - Implement image optimization with astro-imagetools - Add bundle visualizer for performance analysis - Enable Brotli compression for all assets - Add Vite Inspect for debugging - Create sidebar state management store - Install TipTap rich text editor - Add React Hook Form + Zod validation - Add TanStack Query for data fetching All plugins tested and build verified successfully.
This commit is contained in:
12
frontend/src/lib/directus-enhanced.ts
Normal file
12
frontend/src/lib/directus-enhanced.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { createDirectus, rest, authentication, realtime } from '@directus/sdk';
|
||||
import type { SparkSchema } from '@/types/schema';
|
||||
|
||||
const DIRECTUS_URL = import.meta.env.PUBLIC_DIRECTUS_URL || 'https://spark.jumpstartscaling.com';
|
||||
|
||||
export const directus = createDirectus<SparkSchema>(DIRECTUS_URL)
|
||||
.with(authentication('cookie', { autoRefresh: true, mode: 'json' }))
|
||||
.with(rest())
|
||||
.with(realtime());
|
||||
|
||||
// Re-export for convenience
|
||||
export { readItems, readItem, createItem, updateItem, deleteItem, aggregate } from '@directus/sdk';
|
||||
17
frontend/src/stores/sidebarStore.ts
Normal file
17
frontend/src/stores/sidebarStore.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { atom } from 'nanostores';
|
||||
|
||||
// Sidebar open/close state
|
||||
export const isSidebarOpen = atom(true);
|
||||
|
||||
// Active route for highlighting
|
||||
export const activeRoute = atom('/admin');
|
||||
|
||||
// Helper to toggle sidebar
|
||||
export function toggleSidebar() {
|
||||
isSidebarOpen.set(!isSidebarOpen.get());
|
||||
}
|
||||
|
||||
// Helper to set active route
|
||||
export function setActiveRoute(route: string) {
|
||||
activeRoute.set(route);
|
||||
}
|
||||
Reference in New Issue
Block a user