Elffuss BraidHub

kikocis/continue public

a36aa2a5e5e6 · 2.8 KiBRawPermalink
1import {
2 BoltIcon,
3 CircleStackIcon,
4 Cog6ToothIcon,
5 QuestionMarkCircleIcon,
6} from "@heroicons/react/24/outline";
7import { useState } from "react";
8import { useNavigate } from "react-router-dom";
9import { PageHeader } from "../../components/PageHeader";
10import { useNavigationListener } from "../../hooks/useNavigationListener";
11import { fontSize } from "../../util";
12import { HelpCenterSection } from "./HelpCenterSection";
13import { IndexingSettingsSection } from "./IndexingSettingsSection";
14import KeyboardShortcuts from "./KeyboardShortcuts";
15import { UserSettingsForm } from "./UserSettingsForm";
16
17type TabOption = {
18 id: string;
19 label: string;
20 component: React.ReactNode;
21 icon: React.ReactNode;
22};
23
24function ConfigPage() {
25 useNavigationListener();
26 const navigate = useNavigate();
27 const [activeTab, setActiveTab] = useState("settings");
28
29 const tabs: TabOption[] = [
30 {
31 id: "settings",
32 label: "Settings",
33 component: <UserSettingsForm />,
34 icon: <Cog6ToothIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
35 },
36 {
37 id: "indexing",
38 label: "Indexing",
39 component: <IndexingSettingsSection />,
40 icon: <CircleStackIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
41 },
42 {
43 id: "help",
44 label: "Help",
45 component: <HelpCenterSection />,
46 icon: (
47 <QuestionMarkCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />
48 ),
49 },
50 {
51 id: "shortcuts",
52 label: "Shortcuts",
53 component: <KeyboardShortcuts />,
54 icon: <BoltIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
55 },
56 ];
57
58 return (
59 <div className="flex h-full flex-col overflow-y-auto">
60 <div className="bg-vsc-background sticky top-0 z-10">
61 <PageHeader
62 showBorder
63 onTitleClick={() => navigate("/")}
64 title="Chat"
65 />
66
67 {/* Tab Headers */}
68 <div className="bg-vsc-input-background grid cursor-pointer grid-cols-2 border-0 border-b-[1px] border-solid border-b-zinc-700 p-0.5 sm:flex sm:justify-center md:gap-x-2">
69 {tabs.map((tab) => (
70 <div
71 style={{
72 fontSize: fontSize(-2),
73 }}
74 key={tab.id}
75 className={`flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-2 py-2 hover:brightness-125 ${
76 activeTab === tab.id ? "" : "text-gray-400"
77 }`}
78 onClick={() => setActiveTab(tab.id)}
79 >
80 {tab.icon}
81 {tab.label}
82 </div>
83 ))}
84 </div>
85 </div>
86
87 {/* Tab Content */}
88 <div className="flex-1 overflow-y-auto px-4">
89 {tabs.find((tab) => tab.id === activeTab)?.component}
90 </div>
91 </div>
92 );
93}
94
95export default ConfigPage;