Implement comprehensive feature toggle system allowing menu options and features to be controlled via JSON configuration fetched from API endpoint or static files. Core System: - Create FeatureConfig type system with page, feature, and limit-based flags - Add React Context (FeatureProvider) that fetches from /api/user/features - Implement custom hooks (useFeatures, useIsFeatureEnabled, useFeatureLimit, etc.) - Default config disables everything except home page Integration: - Update PageHeader to filter menu items based on page flags - Add ProtectedRoute component to guard routes - Update VR menu to conditionally render items based on feature flags - Update CreateDiagramModal to enable/disable options (private, encrypted, invite) - Update ManageDiagramsModal to use configurable maxDiagrams limit Configuration Files: - Add static JSON files for local testing (none, free, basic, pro tiers) - Add dev proxy for /api/user/features endpoint - Include README with testing instructions Updates: - Complete CLAUDE.md naming conventions section - Version bump to 0.0.8-27 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
58 lines
1.5 KiB
TypeScript
58 lines
1.5 KiB
TypeScript
import React from "react";
|
|
import {createBrowserRouter} from "react-router-dom";
|
|
import About from "./marketing/about";
|
|
import Documentation from "./marketing/documentation";
|
|
import Examples from "./marketing/examples";
|
|
import Pricing from "./marketing/pricing";
|
|
import VrExperience from "./pages/vrExperience";
|
|
import NotFound from "./pages/notFound";
|
|
import {ProtectedRoute} from "./components/ProtectedRoute";
|
|
|
|
export const webRouter = createBrowserRouter([
|
|
{
|
|
path: "/",
|
|
element: (
|
|
<About/>
|
|
),
|
|
},
|
|
{
|
|
path: "/documentation",
|
|
element: (
|
|
<ProtectedRoute page="documentation">
|
|
<Documentation/>
|
|
</ProtectedRoute>
|
|
)
|
|
}, {
|
|
path: "/examples",
|
|
element: (
|
|
<ProtectedRoute page="examples">
|
|
<Examples/>
|
|
</ProtectedRoute>
|
|
)
|
|
}, {
|
|
path: "/Pricing",
|
|
element: (
|
|
<ProtectedRoute page="pricing">
|
|
<Pricing/>
|
|
</ProtectedRoute>
|
|
)
|
|
}, {
|
|
path: "/db/public/:db",
|
|
element: (
|
|
<ProtectedRoute page="vrExperience">
|
|
<VrExperience/>
|
|
</ProtectedRoute>
|
|
)
|
|
}, {
|
|
path: "/db/private/:db",
|
|
element: (
|
|
<ProtectedRoute page="vrExperience">
|
|
<VrExperience/>
|
|
</ProtectedRoute>
|
|
)
|
|
}, {
|
|
path: "*",
|
|
element: (<NotFound/>)
|
|
}
|
|
|
|
]) |