Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
feat: add next-themes ThemeProvider and implement route-level lazy loading with React.lazy
valzor57f3bc65e1a7
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsxindex 1589afd..505fcd2 100644--- a/frontend/src/App.jsx+++ b/frontend/src/App.jsx@@ -1,46 +1,66 @@-import React from 'react';+import React, { lazy, Suspense } from 'react';import { createBrowserRouter, RouterProvider, Navigate } from 'react-router-dom';-import { ThemeProvider } from '@mui/material/styles';-import CssBaseline from '@mui/material/CssBaseline';-import theme from './themes/index';+import { ThemeProvider } from 'next-themes';+import { Toaster } from '@/components/ui/sonner';+import { TooltipProvider } from '@/components/ui/tooltip';import { AppProvider } from './context/AppContext';import MainLayout from './layout/index';-import Overview from './features/analytics/overview/Overview';-import ChannelAnalytics from './features/analytics/channel/ChannelAnalytics';-import InstagramAnalytics from './features/analytics/instagram/InstagramAnalytics';-import VideoExplorer from './features/analytics/videos/VideoExplorer';-import ShortsExplorer from './features/analytics/shorts/ShortsExplorer';-import ReelsExplorer from './features/analytics/reels/ReelsExplorer';-import UploadContent from './features/publishing/UploadContent';-import AccountManager from './features/accounts/AccountManager';-import Settings from './features/settings/Settings';++const Overview = lazy(() => import('./features/analytics/overview/Overview'));+const ChannelAnalytics = lazy(() => import('./features/analytics/channel/ChannelAnalytics'));+const InstagramAnalytics = lazy(() => import('./features/analytics/instagram/InstagramAnalytics'));+const VideoExplorer = lazy(() => import('./features/analytics/videos/VideoExplorer'));+const ShortsExplorer = lazy(() => import('./features/analytics/shorts/ShortsExplorer'));+const ReelsExplorer = lazy(() => import('./features/analytics/reels/ReelsExplorer'));+const UploadContent = lazy(() => import('./features/publishing/UploadContent'));+const AccountManager = lazy(() => import('./features/accounts/AccountManager'));+const Settings = lazy(() => import('./features/settings/Settings'));const router = createBrowserRouter([{path: '/',element: <MainLayout />,children: [- { index: true, element: <Overview /> },- { path: 'channel/:id', element: <ChannelAnalytics /> },- { path: 'instagram/:id', element: <InstagramAnalytics /> },- { path: 'videos', element: <VideoExplorer /> },- { path: 'shorts', element: <ShortsExplorer /> },- { path: 'reels', element: <ReelsExplorer /> },- { path: 'upload', element: <UploadContent /> },- { path: 'accounts', element: <AccountManager /> },- { path: 'settings', element: <Settings /> },- { path: '*', element: <Navigate to="/" replace /> },+ { index: true, element: <Overview /> },+ { path: 'channel/:id', element: <ChannelAnalytics /> },+ { path: 'instagram/:id', element: <InstagramAnalytics /> },+ { path: 'videos', element: <VideoExplorer /> },+ { path: 'shorts', element: <ShortsExplorer /> },+ { path: 'reels', element: <ReelsExplorer /> },+ { path: 'upload', element: <UploadContent /> },+ { path: 'accounts', element: <AccountManager /> },+ { path: 'settings', element: <Settings /> },+ { path: '*', element: <Navigate to="/" replace /> },],},]);+function PageFallback() {+ return (+ <div className="flex-1 p-4 sm:p-6 space-y-4 animate-pulse">+ <div className="h-8 w-48 rounded-md bg-muted" />+ <div className="h-4 w-72 rounded-md bg-muted" />+ <div className="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4 mt-6">+ {Array.from({ length: 4 }).map((_, i) => (+ <div key={i} className="h-28 rounded-xl bg-muted" />+ ))}+ </div>+ <div className="h-64 rounded-xl bg-muted" />+ </div>+ );+}+export default function App() {return (- <ThemeProvider theme={theme}>- <CssBaseline />- <AppProvider>- <RouterProvider router={router} />- </AppProvider>+ <ThemeProvider attribute="class" defaultTheme="system" enableSystem>+ <TooltipProvider>+ <AppProvider>+ <Suspense fallback={null}>+ <RouterProvider router={router} />+ </Suspense>+ <Toaster position="bottom-right" richColors />+ </AppProvider>+ </TooltipProvider></ThemeProvider>);}