SurfSense/surfsense_web
Claude 2a2a909ef4
Implement dynamic site appearance configuration system
This commit implements a comprehensive database-driven site configuration
system that allows administrators to control the visibility and behavior
of homepage elements, navigation links, footer sections, and route
availability without code changes.

Backend Changes:
- Added SiteConfiguration model with singleton pattern (id=1)
- Created migration 38_add_site_configuration_table.py
- Implemented site_configuration_routes.py with public + admin endpoints
- Added Pydantic schemas for validation (Base, Update, Read, Public)
- Registered routes in main app

Frontend Changes:
- Created SiteConfigContext.tsx for global state management
- Updated app/layout.tsx to wrap app in SiteConfigProvider
- Implemented RouteGuard component for disabled routes
- Updated navbar with conditional rendering (pricing, docs, github, signin)
- Updated hero-section with conditional buttons (get started, talk to us)
- Updated footer with conditional sections and custom copyright
- Applied route guards to pricing, contact, terms, privacy pages

Admin Panel:
- Created /dashboard/site-settings page with full UI
- Visual toggle switches for all configuration options
- Real-time updates via API with toast notifications
- Organized by section (Header, Homepage, Footer, Routes, Text)
- Dark mode support and responsive design

Configuration Options:
Header: show_pricing_link, show_docs_link, show_github_link, show_sign_in
Homepage: show_get_started_button, show_talk_to_us_button
Footer: show_pages_section, show_legal_section, show_register_section
Routes: disable_pricing/docs/contact/terms/privacy_route
Custom: custom_copyright text (max 200 chars)

Security:
- Superuser-only admin endpoints with JWT validation
- Public read-only endpoint for frontend consumption
- Input validation via Pydantic schemas
- Singleton pattern with database constraints
- Client-side route guards for disabled routes

Documentation:
- Added comprehensive section to claude.md
- Includes API docs, migration guide, testing checklist
- Example code snippets and configuration tables
- Security considerations and future enhancements

All configuration defaults to minimal/privacy-focused state (most
features disabled by default). Administrators can enable features
as needed via the admin panel.

Files Changed: 16 files (6 backend, 10 frontend, 1 documentation)
2025-11-18 10:58:31 +00:00
..
.vscode Initial formatting using biome 2025-07-27 10:05:37 -07:00
app Implement dynamic site appearance configuration system 2025-11-18 10:58:31 +00:00
atoms clean up 2025-11-17 08:10:12 +02:00
components Implement dynamic site appearance configuration system 2025-11-18 10:58:31 +00:00
content/docs chore: update configuration for rerankers 2025-10-29 23:23:08 -07:00
contexts Implement dynamic site appearance configuration system 2025-11-18 10:58:31 +00:00
contracts update login form 2025-11-17 08:10:12 +02:00
hooks feat: added global llm configurations 2025-11-14 21:53:46 -08:00
i18n feat(removed): sub_section_writer 2025-10-27 20:30:10 -07:00
lib fix build error 2025-11-17 08:10:12 +02:00
messages feat: improved onboarding 2025-11-16 15:54:54 -08:00
public Implement dynamic social media link management system 2025-11-17 20:44:17 +00:00
.cursorrules feat: monorepo 2025-04-07 23:47:06 -07:00
.dockerignore feat: frontend docker to use nextjs production build 2025-10-23 20:37:01 -07:00
.env.example remove github repo & owner env variables 2025-10-19 23:25:23 +02:00
.gitignore feat(i18n): Add next-intl framework with full bilingual support (EN/ZH) 2025-10-26 17:18:57 +08:00
biome.json Added config for biome.js 2025-07-26 20:52:13 -07:00
components.json Initial formatting using biome 2025-07-27 10:05:37 -07:00
Dockerfile feat: frontend docker to use nextjs production build 2025-10-23 20:37:01 -07:00
drizzle.config.ts chore: biome checks 2025-10-15 14:38:26 -07:00
eslint.config.mjs Biome: fixes for eslint config 2025-07-27 11:47:38 -07:00
LICENSE feat: monorepo 2025-04-07 23:47:06 -07:00
mdx-components.tsx Initial formatting using biome 2025-07-27 10:05:37 -07:00
middleware.ts feat(removed): sub_section_writer 2025-10-27 20:30:10 -07:00
next.config.ts feat(removed): sub_section_writer 2025-10-27 20:30:10 -07:00
package-lock.json feat: monorepo 2025-04-07 23:47:06 -07:00
package.json chore(dependencies): update Next.js and add Google Analytics support 2025-11-13 03:38:36 -08:00
pnpm-lock.yaml chore(dependencies): update Next.js and add Google Analytics support 2025-11-13 03:38:36 -08:00
postcss.config.mjs Initial formatting using biome 2025-07-27 10:05:37 -07:00
source.config.ts Initial formatting using biome 2025-07-27 10:05:37 -07:00
tailwind.config.js Initial formatting using biome 2025-07-27 10:05:37 -07:00
tsconfig.json Initial formatting using biome 2025-07-27 10:05:37 -07:00