refactor config page sections

This commit is contained in:
Nate 2025-03-21 21:08:23 -07:00
parent 12a347b022
commit a8555efc28
5 changed files with 133 additions and 125 deletions

View file

@ -0,0 +1,80 @@
import {
ArrowTopRightOnSquareIcon,
DocumentArrowUpIcon,
TableCellsIcon,
} from "@heroicons/react/24/outline";
import { useContext } from "react";
import { useNavigate } from "react-router-dom";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useAppDispatch } from "../../redux/hooks";
import { setOnboardingCard } from "../../redux/slices/uiSlice";
import { saveCurrentSession } from "../../redux/thunks/session";
import MoreHelpRow from "./MoreHelpRow";
export function HelpCenterSection() {
const ideMessenger = useContext(IdeMessengerContext);
const navigate = useNavigate();
const dispatch = useAppDispatch();
return (
<div className="py-5">
<h3 className="mb-4 mt-0 text-xl">Help center</h3>
<div className="-mx-4 flex flex-col">
<MoreHelpRow
title="Documentation"
description="Learn how to configure and use Continue"
Icon={ArrowTopRightOnSquareIcon}
onClick={() =>
ideMessenger.post("openUrl", "https://docs.continue.dev/")
}
/>
<MoreHelpRow
title="Have an issue?"
description="Let us know on GitHub and we'll do our best to resolve it"
Icon={ArrowTopRightOnSquareIcon}
onClick={() =>
ideMessenger.post(
"openUrl",
"https://github.com/continuedev/continue/issues/new/choose",
)
}
/>
<MoreHelpRow
title="Join the community!"
description="Join us on Discord to stay up-to-date on the latest developments"
Icon={ArrowTopRightOnSquareIcon}
onClick={() =>
ideMessenger.post("openUrl", "https://discord.gg/vapESyrFmJ")
}
/>
<MoreHelpRow
title="Token usage"
description="Daily token usage across models"
Icon={TableCellsIcon}
onClick={() => navigate("/stats")}
/>
<MoreHelpRow
title="Quickstart"
description="Reopen the quickstart and tutorial file"
Icon={DocumentArrowUpIcon}
onClick={async () => {
navigate("/");
// Used to clear the chat panel before showing onboarding card
await dispatch(
saveCurrentSession({
openNewSession: true,
generateTitle: true,
}),
);
dispatch(setOnboardingCard({ show: true, activeTab: "Best" }));
ideMessenger.post("showTutorial", undefined);
}}
/>
</div>
</div>
);
}

View file

@ -0,0 +1,26 @@
import { useAppSelector } from "../../redux/hooks";
import IndexingProgress from "./IndexingProgress";
export function IndexingSettingsSection() {
const config = useAppSelector((state) => state.config.config);
return (
<div className="py-5">
<div>
<h3 className="mx-auto mb-1 mt-0 text-xl">@codebase index</h3>
<span className="w-3/4 text-xs text-stone-500">
Local embeddings of your codebase
</span>
</div>
{config.disableIndexing ? (
<div className="pb-2 pt-5">
<p className="py-1 text-center font-semibold">Indexing is disabled</p>
<p className="text-lightgray cursor-pointer text-center text-xs">
Open settings and toggle <code>Disable Indexing</code> to re-enable
</p>
</div>
) : (
<IndexingProgress />
)}
</div>
);
}

View file

@ -4,8 +4,8 @@ import {
lightGray,
vscForeground,
} from "../../components";
import { getPlatform, isJetBrains } from "../../util";
import { ToolTip } from "../../components/gui/Tooltip";
import { getPlatform, isJetBrains } from "../../util";
const GridDiv = styled.div`
display: grid;
@ -201,20 +201,23 @@ const jetbrainsShortcuts: KeyboardShortcutProps[] = [
function KeyboardShortcuts() {
return (
<GridDiv>
{(isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts).map(
(shortcut, i) => {
return (
<KeyboardShortcut
key={i}
mac={shortcut.mac}
windows={shortcut.windows}
description={shortcut.description}
/>
);
},
)}
</GridDiv>
<div>
<h3 className="mx-auto mb-1 text-lg">Keyboard shortcuts</h3>
<GridDiv>
{(isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts).map(
(shortcut, i) => {
return (
<KeyboardShortcut
key={i}
mac={shortcut.mac}
windows={shortcut.windows}
description={shortcut.description}
/>
);
},
)}
</GridDiv>
</div>
);
}

View file

@ -101,7 +101,7 @@ export function UserSettingsForm() {
}, [ideMessenger]);
return (
<div className="divide-x-0 divide-y-2 divide-solid divide-zinc-700 px-4">
<div className="divide-x-0 divide-y-2 divide-solid divide-zinc-700">
{!controlServerBetaEnabled || hubEnabled ? (
<div className="flex flex-col">
<div className="flex max-w-[400px] flex-col">

View file

@ -1,30 +1,16 @@
import {
ArrowTopRightOnSquareIcon,
DocumentArrowUpIcon,
TableCellsIcon,
} from "@heroicons/react/24/outline";
import { useContext } from "react";
import { useNavigate } from "react-router-dom";
import PageHeader from "../../components/PageHeader";
import { IdeMessengerContext } from "../../context/IdeMessenger";
import { useNavigationListener } from "../../hooks/useNavigationListener";
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
import { setOnboardingCard } from "../../redux/slices/uiSlice";
import { saveCurrentSession } from "../../redux/thunks/session";
import { AccountButton } from "./AccountButton";
import IndexingProgress from "./IndexingProgress";
import { HelpCenterSection } from "./HelpCenterSection";
import { IndexingSettingsSection } from "./IndexingSettingsSection";
import KeyboardShortcuts from "./KeyboardShortcuts";
import MCPServersPreview from "./MCPServersPreview";
import MoreHelpRow from "./MoreHelpRow";
import { UserSettingsForm } from "./UserSettingsForm";
function ConfigPage() {
useNavigationListener();
const dispatch = useAppDispatch();
const navigate = useNavigate();
const ideMessenger = useContext(IdeMessengerContext);
const config = useAppSelector((state) => state.config.config);
return (
<div className="overflow-y-scroll">
@ -35,99 +21,12 @@ function ConfigPage() {
rightContent={<AccountButton />}
/>
<UserSettingsForm />
<div className="gap-2 divide-x-0 divide-y-2 divide-solid divide-zinc-700 px-4">
<div className="py-5">
<div>
<h3 className="mx-auto mb-1 mt-0 text-xl">@codebase index</h3>
<span className="w-3/4 text-xs text-stone-500">
Local embeddings of your codebase
</span>
</div>
{config.disableIndexing ? (
<div className="pb-2 pt-5">
<p className="py-1 text-center font-semibold">
Indexing is disabled
</p>
<p className="text-lightgray cursor-pointer text-center text-xs">
Open settings and toggle <code>Disable Indexing</code> to
re-enable
</p>
</div>
) : (
<IndexingProgress />
)}
</div>
<div className="flex flex-col py-5">
<MCPServersPreview />
</div>
<div className="py-5">
<h3 className="mb-4 mt-0 text-xl">Help center</h3>
<div className="-mx-4 flex flex-col">
<MoreHelpRow
title="Documentation"
description="Learn how to configure and use Continue"
Icon={ArrowTopRightOnSquareIcon}
onClick={() =>
ideMessenger.post("openUrl", "https://docs.continue.dev/")
}
/>
<MoreHelpRow
title="Have an issue?"
description="Let us know on GitHub and we'll do our best to resolve it"
Icon={ArrowTopRightOnSquareIcon}
onClick={() =>
ideMessenger.post(
"openUrl",
"https://github.com/continuedev/continue/issues/new/choose",
)
}
/>
<MoreHelpRow
title="Join the community!"
description="Join us on Discord to stay up-to-date on the latest developments"
Icon={ArrowTopRightOnSquareIcon}
onClick={() =>
ideMessenger.post("openUrl", "https://discord.gg/vapESyrFmJ")
}
/>
<MoreHelpRow
title="Token usage"
description="Daily token usage across models"
Icon={TableCellsIcon}
onClick={() => navigate("/stats")}
/>
<MoreHelpRow
title="Quickstart"
description="Reopen the quickstart and tutorial file"
Icon={DocumentArrowUpIcon}
onClick={async () => {
navigate("/");
// Used to clear the chat panel before showing onboarding card
await dispatch(
saveCurrentSession({
openNewSession: true,
generateTitle: true,
}),
);
dispatch(setOnboardingCard({ show: true, activeTab: "Best" }));
ideMessenger.post("showTutorial", undefined);
}}
/>
</div>
</div>
<div>
<h3 className="mx-auto mb-1 text-lg">Keyboard shortcuts</h3>
<KeyboardShortcuts />
</div>
<div className="px-4">
<UserSettingsForm />
<IndexingSettingsSection />
<MCPServersPreview />
<HelpCenterSection />
<KeyboardShortcuts />
</div>
</div>
);