A modern and elegant dashboard for network traffic visualization and analysis.
feat: Add transition progress bar to dashboard header and enhance i18n for settings and theme options.
luolei4168a309db3a
diff --git a/apps/web/app/[locale]/dashboard/components/content/index.tsx b/apps/web/app/[locale]/dashboard/components/content/index.tsxindex 1abc81a..7a9538c 100644--- a/apps/web/app/[locale]/dashboard/components/content/index.tsx+++ b/apps/web/app/[locale]/dashboard/components/content/index.tsx@@ -43,6 +43,7 @@ interface ContentProps {backendStatus: BackendStatus;onNavigate?: (tab: string) => void;isLoading?: boolean;+ isTransitioning?: boolean;}// Overview Content Component@@ -326,76 +327,88 @@ export function Content({activeBackendId,backendStatus,onNavigate,+ isTransitioning,}: ContentProps) {- switch (activeTab) {- case "overview":- return (- <OverviewContent- data={data}- countryData={countryData}- error={error}- timeRange={timeRange}- timePreset={timePreset}- autoRefresh={autoRefresh}- activeBackendId={activeBackendId}- onNavigate={onNavigate}- backendStatus={backendStatus}- />- );- case "domains":- return (- <DomainsContent- activeBackendId={activeBackendId}- timeRange={timeRange}- autoRefresh={autoRefresh}- />- );- case "countries":- return <CountriesContent countryData={countryData} />;- case "proxies":- return (- <ProxiesContent- data={data?.proxyStats}- activeBackendId={activeBackendId}- timeRange={timeRange}- backendStatus={backendStatus}- autoRefresh={autoRefresh}- />- );- case "rules":- return (- <RulesContent- activeBackendId={activeBackendId}- timeRange={timeRange}- backendStatus={backendStatus}- autoRefresh={autoRefresh}- />- );- case "devices":- return (- <DevicesContent- data={data?.deviceStats}- activeBackendId={activeBackendId}- timeRange={timeRange}- backendStatus={backendStatus}- autoRefresh={autoRefresh}- />- );- case "network":- return <NetworkContent />;- default:- return (- <OverviewContent- data={data}- countryData={countryData}- error={error}- timeRange={timeRange}- timePreset={timePreset}- autoRefresh={autoRefresh}- activeBackendId={activeBackendId}- onNavigate={onNavigate}- backendStatus={backendStatus}- />- );- }+ const renderContent = () => {+ switch (activeTab) {+ case "overview":+ return (+ <OverviewContent+ data={data}+ countryData={countryData}+ error={error}+ timeRange={timeRange}+ timePreset={timePreset}+ autoRefresh={autoRefresh}+ activeBackendId={activeBackendId}+ onNavigate={onNavigate}+ backendStatus={backendStatus}+ />+ );+ case "domains":+ return (+ <DomainsContent+ activeBackendId={activeBackendId}+ timeRange={timeRange}+ autoRefresh={autoRefresh}+ />+ );+ case "countries":+ return <CountriesContent countryData={countryData} />;+ case "proxies":+ return (+ <ProxiesContent+ data={data?.proxyStats}+ activeBackendId={activeBackendId}+ timeRange={timeRange}+ backendStatus={backendStatus}+ autoRefresh={autoRefresh}+ />+ );+ case "rules":+ return (+ <RulesContent+ activeBackendId={activeBackendId}+ timeRange={timeRange}+ backendStatus={backendStatus}+ autoRefresh={autoRefresh}+ />+ );+ case "devices":+ return (+ <DevicesContent+ data={data?.deviceStats}+ activeBackendId={activeBackendId}+ timeRange={timeRange}+ backendStatus={backendStatus}+ autoRefresh={autoRefresh}+ />+ );+ case "network":+ return <NetworkContent />;+ default:+ return (+ <OverviewContent+ data={data}+ countryData={countryData}+ error={error}+ timeRange={timeRange}+ timePreset={timePreset}+ autoRefresh={autoRefresh}+ activeBackendId={activeBackendId}+ onNavigate={onNavigate}+ backendStatus={backendStatus}+ />+ );+ }+ };++ return (+ <div className={cn(+ "transition-opacity duration-200",+ isTransitioning && "opacity-50 pointer-events-none"+ )}>+ {renderContent()}+ </div>+ );}diff --git a/apps/web/app/[locale]/dashboard/components/header/index.tsx b/apps/web/app/[locale]/dashboard/components/header/index.tsxindex 97f05f0..d1e2c0d 100644--- a/apps/web/app/[locale]/dashboard/components/header/index.tsx+++ b/apps/web/app/[locale]/dashboard/components/header/index.tsx@@ -89,6 +89,7 @@ interface HeaderProps {// Loading statesisLoading: boolean;+ isTransitioning?: boolean;// TranslationsbackendT: (key: string) => string;@@ -116,6 +117,7 @@ export function Header({pathname,onNavigate,isLoading,+ isTransitioning,backendT,dashboardT,}: HeaderProps) {@@ -123,6 +125,9 @@ export function Header({const { data: authQueryState } = useAuthState(); // Addedconst isShowcase = authQueryState?.showcaseMode ?? false; // Addedconst navT = useTranslations("nav"); // Added+ const settingsT = useTranslations("settings");+ const themeT = useTranslations("theme");+ const aboutT = useTranslations("about");return (<header className="sticky top-0 z-40 border-b border-border/40 bg-background/80 backdrop-blur-md">@@ -408,35 +413,35 @@ export function Header({) : (<Sun className="w-4 h-4" />)}- Theme+ {settingsT("theme")}</DropdownMenuLabel><DropdownMenuItemonClick={() => onThemeChange("light")}className={theme === "light" ? "bg-muted" : ""}><Sun className="w-4 h-4 mr-2 text-amber-500" />- Light {theme === "light" && "✓"}+ {themeT("light")} {theme === "light" && "✓"}</DropdownMenuItem><DropdownMenuItemonClick={() => onThemeChange("dark")}className={theme === "dark" ? "bg-muted" : ""}><Moon className="w-4 h-4 mr-2 text-indigo-500" />- Dark {theme === "dark" && "✓"}+ {themeT("dark")} {theme === "dark" && "✓"}</DropdownMenuItem><DropdownMenuItemonClick={() => onThemeChange("system")}className={theme === "system" ? "bg-muted" : ""}><Monitor className="w-4 h-4 mr-2 text-slate-500" />- System {theme === "system" && "✓"}+ {themeT("system")} {theme === "system" && "✓"}</DropdownMenuItem><DropdownMenuSeparator />{/* Language Selection */}<DropdownMenuLabel className="flex items-center gap-2"><Globe className="w-4 h-4" />- Language+ {settingsT("language")}</DropdownMenuLabel><DropdownMenuItemonClick={() => {@@ -473,7 +478,7 @@ export function Header({{/* About */}<DropdownMenuItem onClick={onOpenAboutDialog}><Info className="w-4 h-4 mr-2 text-primary" />- About+ {aboutT("title")}</DropdownMenuItem>{authState?.enabled && (<>@@ -504,6 +509,12 @@ export function Header({)}</div></div>+ {/* Transition progress bar - sits at the bottom edge of the header */}+ {isTransitioning && (+ <div className="absolute bottom-0 left-0 right-0 h-0.5 overflow-hidden">+ <div className="h-full w-1/3 bg-primary/60 rounded-full animate-progress-indeterminate" />+ </div>+ )}</header>);}diff --git a/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts b/apps/web/app/[locale]/dashboard/hooks/use-dashboard.tsindex 7e1aa2f..036d37c 100644--- a/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts+++ b/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts@@ -63,6 +63,7 @@ export interface UseDashboardReturn {wsConnected: boolean;wsRealtimeActive: boolean;isLoading: boolean;+ isTransitioning: boolean;// ActionssetActiveTab: (tab: TabId) => void;@@ -368,6 +369,7 @@ export function useDashboard(): UseDashboardReturn {wsConnected,wsRealtimeActive,isLoading: summaryQuery.isLoading || (backendsQuery.isLoading && !backends.length),+ isTransitioning: summaryQuery.isPlaceholderData === true,// ActionssetActiveTab,diff --git a/apps/web/app/[locale]/dashboard/page.tsx b/apps/web/app/[locale]/dashboard/page.tsxindex 9ba844f..4499026 100644--- a/apps/web/app/[locale]/dashboard/page.tsx+++ b/apps/web/app/[locale]/dashboard/page.tsx@@ -31,6 +31,7 @@ export default function DashboardPage() {backendStatusHint,queryError,isLoading,+ isTransitioning,// ActionssetActiveTab,@@ -87,6 +88,7 @@ export default function DashboardPage() {pathname={pathname}onNavigate={(path) => router.push(path)}isLoading={isManualRefreshing}+ isTransitioning={isTransitioning}backendT={backendT}dashboardT={dashboardT}/>@@ -100,6 +102,7 @@ export default function DashboardPage() {timeRange={timeRange}timePreset={timePreset}isLoading={isLoading}+ isTransitioning={isTransitioning}autoRefresh={autoRefresh}activeBackendId={activeBackendId}backendStatus={backendStatus}diff --git a/apps/web/app/globals.css b/apps/web/app/globals.cssindex 24aba02..5d94dd8 100644--- a/apps/web/app/globals.css+++ b/apps/web/app/globals.css@@ -345,3 +345,16 @@background-size: 200% 200%;animation: gradient-x 3s linear infinite;}++@keyframes progress-indeterminate {+ 0% {+ transform: translateX(-100%);+ }+ 100% {+ transform: translateX(400%);+ }+}++.animate-progress-indeterminate {+ animation: progress-indeterminate 1.5s ease-in-out infinite;+}diff --git a/apps/web/components/layout/navigation.tsx b/apps/web/components/layout/navigation.tsxindex 76c9e1f..7da869d 100644--- a/apps/web/components/layout/navigation.tsx+++ b/apps/web/components/layout/navigation.tsx@@ -47,8 +47,8 @@ const NAV_ITEMS = [{ id: "rules", icon: Route },{ id: "domains", icon: Globe },{ id: "countries", icon: MapPin },- { id: "devices", icon: Smartphone },{ id: "proxies", icon: Server },+ { id: "devices", icon: Smartphone },];export function Navigation({@@ -279,9 +279,10 @@ export function Navigation({{/* Mobile Bottom Navigation */}<nav className="lg:hidden fixed bottom-0 left-0 right-0 z-50 border-t border-border/40 bg-background/80 backdrop-blur-md"><div className="flex items-center justify-around h-16 px-2">- {NAV_ITEMS.slice(0, 5).map((item) => {+ {NAV_ITEMS.map((item, index) => {const Icon = item.icon;const isActive = activeTab === item.id;+ const isLast = index === NAV_ITEMS.length - 1;return (<buttonkey={item.id}@@ -289,6 +290,7 @@ export function Navigation({className={cn("flex flex-col items-center gap-1 px-3 py-2 rounded-lg transition-all",isActive ? "text-primary" : "text-muted-foreground",+ isLast && "hidden min-[410px]:flex",)}><Icon className={cn("w-5 h-5", isActive && "scale-110")} /><span className="text-[10px]">{t(item.id)}</span>diff --git a/apps/web/messages/en.json b/apps/web/messages/en.jsonindex 1b0270c..e2d749d 100644--- a/apps/web/messages/en.json+++ b/apps/web/messages/en.json@@ -387,7 +387,7 @@"collect": "Collect","setDisplay": "Set Display","selectBackend": "Select Backend",- "manageBackends": "Manage Backends",+ "manageBackends": "Settings","firstBackendAutoActive": "First backend automatically set as active","verificationFailed": "Backend verification failed. Please check the host address and token.","preferencesTab": "Preferences",diff --git a/package.json b/package.jsonindex 2c1052a..5b44d3c 100644--- a/package.json+++ b/package.json@@ -1,6 +1,6 @@{"name": "neko-master",- "version": "1.2.3",+ "version": "1.2.5","description": "Modern traffic analytics for edge gateways","private": true,"workspaces": [