Skip to content

Commit ba001df

Browse files
committed
feat: integrate language settings in AppShell and clean up Sidebar imports
- Added a useEffect hook in AppShell to change the application language based on the configuration retrieved from settings IPC. - Removed unused SidebarHeader import to streamline the Sidebar component.
1 parent ed2b883 commit ba001df

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

src/components/layout/AppShell.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { useEffect, useState } from "react";
22
import { TooltipProvider } from "@/components/ui/tooltip";
33
import { Sidebar } from "./Sidebar";
4-
import { TopBar } from "./TopBar";
54
import { ContentArea } from "./ContentArea";
65
import { useAppStore } from "@/stores";
76
import { useThemeStore } from "@/stores/theme-store";
87
import { settingsIpc } from "@/lib/ipc";
98
import { cn } from "@/lib/utils";
9+
import { i18n } from "@/locales/i18n";
1010

1111
const NARROW_BREAKPOINT = 960;
1212

@@ -22,6 +22,14 @@ export function AppShell() {
2222
return cleanupTheme;
2323
}, [initializeTheme, cleanupTheme]);
2424

25+
useEffect(() => {
26+
void settingsIpc.getAppConfig().then((config) => {
27+
if (config.language && config.language !== i18n.language) {
28+
i18n.changeLanguage(config.language);
29+
}
30+
});
31+
}, []);
32+
2533
useEffect(() => {
2634
void settingsIpc.getSystemInfo().then((info) => {
2735
setIsWindows(info.os.toLowerCase() === "windows");

src/components/layout/Sidebar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useTranslation } from "react-i18next";
22
import { MessageSquare, Sparkles, BookOpen, LayoutDashboard } from "lucide-react";
33
import { cn } from "@/lib/utils";
44
import { useAppStore } from "@/stores";
5-
import { SidebarHeader } from "./SidebarHeader";
65
import { SidebarFooter } from "./SidebarFooter";
76
import { NavItem } from "./NavItem";
87

0 commit comments

Comments
 (0)