sidebar polish
This commit is contained in:
parent
1de8b3d8f5
commit
67be581267
13 changed files with 559 additions and 316 deletions
|
|
@ -31,7 +31,7 @@ function getOrgIcon(org: { name: string; iconUrl?: string | null }) {
|
|||
|
||||
const IconComponent =
|
||||
org.name === "Personal" ? UserCircleIcon : BuildingOfficeIcon;
|
||||
return <IconComponent className="h-3.5 w-3.5" />;
|
||||
return <IconComponent className="h-3.5 w-3.5 shrink-0" />;
|
||||
}
|
||||
|
||||
export function ScopeSelect({ onSelect }: ScopeSelectProps) {
|
||||
|
|
@ -52,35 +52,67 @@ export function ScopeSelect({ onSelect }: ScopeSelectProps) {
|
|||
onSelect?.();
|
||||
};
|
||||
|
||||
const handleConfigClick = () => {
|
||||
ideMessenger.post("config/openProfile", {
|
||||
profileId: undefined,
|
||||
});
|
||||
};
|
||||
|
||||
const selectedDisplay = currentOrg ?? {
|
||||
name: "Personal",
|
||||
iconUrl: null,
|
||||
};
|
||||
|
||||
return (
|
||||
<Listbox value={selectedOrgId} onChange={handleChange}>
|
||||
<div className="relative">
|
||||
<ListboxButton className="hover:bg-list-active hover:text-list-active-foreground w-full min-w-[140px] justify-between px-4 py-2 sm:min-w-[200px]">
|
||||
<div className="flex items-center gap-2">
|
||||
{getOrgIcon(selectedDisplay)}
|
||||
<span className="truncate">
|
||||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronUpDownIcon className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</ListboxButton>
|
||||
const isPersonalSelected =
|
||||
!selectedOrgId || selectedDisplay?.name === "Personal";
|
||||
|
||||
<ListboxOptions className="z-[1000] min-w-[140px] pt-0.5 sm:min-w-[200px]">
|
||||
{organizations.map((org) => (
|
||||
<ListboxOption key={org.id} value={org.id} className="py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
{getOrgIcon(org)}
|
||||
<span>{org.name}</span>
|
||||
</div>
|
||||
</ListboxOption>
|
||||
))}
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
return (
|
||||
<div>
|
||||
<Listbox value={selectedOrgId} onChange={handleChange}>
|
||||
<div className="relative">
|
||||
<ListboxButton className="hover:bg-list-active hover:text-list-active-foreground w-full min-w-[140px] justify-between px-4 py-2 sm:min-w-[200px]">
|
||||
<div className="flex items-center gap-2">
|
||||
{getOrgIcon(selectedDisplay)}
|
||||
<span className="truncate">
|
||||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronUpDownIcon className="h-3.5 w-3.5" aria-hidden="true" />
|
||||
</ListboxButton>
|
||||
|
||||
<ListboxOptions
|
||||
className="z-[1000] !w-[--button-width] pt-0.5"
|
||||
anchor="bottom start"
|
||||
>
|
||||
{organizations.map((org) => (
|
||||
<ListboxOption key={org.id} value={org.id} className="py-2">
|
||||
<div className="flex items-center gap-2">
|
||||
{getOrgIcon(org)}
|
||||
<div className="flex flex-col">
|
||||
<span>{org.name}</span>
|
||||
{org.name === "Personal" && (
|
||||
<span className="text-2xs text-description">
|
||||
Includes your local config.yaml
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</ListboxOption>
|
||||
))}
|
||||
</ListboxOptions>
|
||||
</div>
|
||||
</Listbox>
|
||||
{isPersonalSelected && (
|
||||
<p className="text-description !mt-1 ml-1 text-xs">
|
||||
Includes your local{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:brightness-125"
|
||||
onClick={handleConfigClick}
|
||||
>
|
||||
config.yaml
|
||||
</span>
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import {
|
|||
} from "../../redux/slices/profilesSlice";
|
||||
import { getMetaKeyLabel, isMetaEquivalentKeyPressed } from "../../util";
|
||||
import { cn } from "../../util/cn";
|
||||
import { useLump } from "../mainInput/Lump/LumpContext";
|
||||
import {
|
||||
Listbox,
|
||||
ListboxOption,
|
||||
|
|
@ -27,7 +26,6 @@ export function AssistantAndOrgListbox() {
|
|||
const listboxRef = useRef<HTMLDivElement>(null);
|
||||
const currentOrg = useAppSelector(selectCurrentOrg);
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const { isToolbarExpanded } = useLump();
|
||||
const {
|
||||
profiles,
|
||||
selectedProfile,
|
||||
|
|
@ -38,7 +36,6 @@ export function AssistantAndOrgListbox() {
|
|||
refreshProfiles,
|
||||
} = useAuth();
|
||||
const configLoading = useAppSelector((store) => store.config.loading);
|
||||
const smallFont = useFontSize(-3);
|
||||
const tinyFont = useFontSize(-4);
|
||||
const shouldRenderOrgInfo =
|
||||
session && organizations.length > 1 && !isOnPremSession(session);
|
||||
|
|
|
|||
|
|
@ -1,49 +1,21 @@
|
|||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import { useFontSize } from "./ui/font";
|
||||
|
||||
export interface PageHeaderProps {
|
||||
onTitleClick?: () => void;
|
||||
title?: string;
|
||||
rightContent?: React.ReactNode;
|
||||
showBorder?: boolean;
|
||||
}
|
||||
|
||||
export function PageHeader({
|
||||
onTitleClick,
|
||||
title,
|
||||
rightContent,
|
||||
showBorder,
|
||||
}: PageHeaderProps) {
|
||||
const fontSize = useFontSize(-1);
|
||||
|
||||
export function PageHeader({ onTitleClick, title }: PageHeaderProps) {
|
||||
return (
|
||||
<div
|
||||
className={`sticky top-0 z-20 m-0 flex items-center justify-between bg-inherit py-1 ${
|
||||
showBorder
|
||||
? "border-0 border-b-[1px] border-solid border-b-zinc-700"
|
||||
: ""
|
||||
}`}
|
||||
>
|
||||
{title ? (
|
||||
<div
|
||||
className="flex cursor-pointer items-center transition-colors duration-200 hover:brightness-125"
|
||||
onClick={onTitleClick}
|
||||
>
|
||||
<ArrowLeftIcon className="ml-3 inline-block h-3 w-3" />
|
||||
<span
|
||||
className="mx-2 inline-block text-lg font-bold"
|
||||
style={{
|
||||
fontSize,
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div />
|
||||
)}
|
||||
|
||||
{rightContent && <div className="pr-2">{rightContent}</div>}
|
||||
<div className="sticky top-0 z-20 m-0 flex items-center justify-between bg-inherit py-1">
|
||||
<div
|
||||
className="flex cursor-pointer items-center transition-colors duration-200 hover:brightness-125"
|
||||
onClick={onTitleClick}
|
||||
>
|
||||
<ArrowLeftIcon className="ml-3 inline-block h-3 w-3" />
|
||||
{title && <span className="mx-2 inline-block font-bold">{title}</span>}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ type AlertConfig = {
|
|||
const ALERT_CONFIGS: AlertConfig = {
|
||||
info: {
|
||||
Icon: InformationCircleIcon,
|
||||
background: "bg-background",
|
||||
border: "border-foreground",
|
||||
iconColor: "text-foreground",
|
||||
background: "bg-blue-600/20",
|
||||
border: "border-blue-500",
|
||||
iconColor: "text-blue-500",
|
||||
text: "text-foreground",
|
||||
},
|
||||
success: {
|
||||
|
|
@ -56,18 +56,18 @@ const ALERT_CONFIGS: AlertConfig = {
|
|||
};
|
||||
|
||||
const alertSizes = {
|
||||
sm: "px-3 py-1.5 rounded-md border",
|
||||
lg: "px-4 py-3 rounded-md border",
|
||||
sm: "px-3 py-2 rounded-md",
|
||||
lg: "px-3 py-2.5 rounded-md",
|
||||
};
|
||||
|
||||
const iconSizes = {
|
||||
sm: "h-4 w-4 mt-1",
|
||||
lg: "h-5 w-5 mt-0.5",
|
||||
sm: "h-4 w-4",
|
||||
lg: "h-4 w-4",
|
||||
};
|
||||
|
||||
const spacingSizes = {
|
||||
sm: "ml-2",
|
||||
lg: "ml-3",
|
||||
lg: "ml-2",
|
||||
};
|
||||
|
||||
function Alert({ type = "info", size = "lg", ...props }: AlertProps) {
|
||||
|
|
@ -76,7 +76,7 @@ function Alert({ type = "info", size = "lg", ...props }: AlertProps) {
|
|||
return (
|
||||
<div
|
||||
className={cn(
|
||||
`flex flex-row items-start ${background} border-[0.5px] border-solid ${border} shadow-sm ${alertSizes[size]}`,
|
||||
`flex flex-row items-center ${background} border-[0.5px] ${border} border-solid shadow-sm ${alertSizes[size]}`,
|
||||
props.className,
|
||||
)}
|
||||
>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ const buttonVariants = {
|
|||
secondary:
|
||||
"border-none text-foreground bg-border hover:enabled:brightness-125",
|
||||
outline:
|
||||
"border border-solid border-badge border-border text-foreground bg-transparent hover:enabled:bg-input",
|
||||
"border border-solid border-description text-foreground bg-transparent hover:enabled:bg-input",
|
||||
ghost:
|
||||
"border-none text-foreground bg-inherit hover:enabled:brightness-125 hover:enabled:bg-input",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,26 +1,28 @@
|
|||
import { UserCircleIcon } from "@heroicons/react/24/solid";
|
||||
import { ArrowRightStartOnRectangleIcon } from "@heroicons/react/24/outline";
|
||||
import { isOnPremSession } from "core/control-plane/AuthTypes";
|
||||
import { useContext } from "react";
|
||||
import { ScopeSelect } from "../../components/AssistantAndOrgListbox/ScopeSelect";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
import { Button } from "../../components/ui";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useAppSelector } from "../../redux/hooks";
|
||||
import { selectCurrentOrg } from "../../redux/slices/profilesSlice";
|
||||
|
||||
export function AccountSection() {
|
||||
const { session, logout, login, organizations } = useAuth();
|
||||
const selectedOrg = useAppSelector(selectCurrentOrg);
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
|
||||
if (!session) {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center h-64 gap-4">
|
||||
<UserCircleIcon className="h-16 w-16 text-gray-400" />
|
||||
<div className="flex h-64 flex-col items-center justify-center gap-4">
|
||||
<div className="text-center">
|
||||
<p className="text-lg font-medium mb-2">Not signed in</p>
|
||||
<p className="text-gray-400 mb-4">Sign in to access your account settings</p>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => login(false)}
|
||||
>
|
||||
<p className="mb-2 text-lg font-medium">Not signed in</p>
|
||||
<p className="mb-4 text-gray-400">
|
||||
Sign in to access your account settings
|
||||
</p>
|
||||
<Button variant="outline" onClick={() => login(false)}>
|
||||
Sign in
|
||||
</Button>
|
||||
</div>
|
||||
|
|
@ -32,17 +34,16 @@ export function AccountSection() {
|
|||
if (isOnPremSession(session)) {
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<UserCircleIcon className="h-16 w-16 text-gray-400" />
|
||||
<div>
|
||||
<h2 className="text-xl font-medium">Account</h2>
|
||||
<p className="text-gray-400">On-premise deployment</p>
|
||||
</div>
|
||||
<div>
|
||||
<h2 className="text-xl font-medium">Account</h2>
|
||||
<p className="text-gray-400">On-premise deployment</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div className="bg-vsc-input-background rounded-md p-4">
|
||||
<h3 className="font-medium mb-2">Account Information</h3>
|
||||
<p className="text-gray-400">Account details not available for on-premise deployments</p>
|
||||
<h3 className="mb-2 font-medium">Account Information</h3>
|
||||
<p className="text-gray-400">
|
||||
Account details not available for on-premise deployments
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
@ -50,47 +51,48 @@ export function AccountSection() {
|
|||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<div className="flex items-center gap-4">
|
||||
<UserCircleIcon className="h-16 w-16 text-gray-400" />
|
||||
<div className="my-3 flex items-center justify-between">
|
||||
<div>
|
||||
<h2 className="text-xl font-medium">Account</h2>
|
||||
<p className="text-gray-400">Manage your account settings</p>
|
||||
<h2 className="my-0 text-xl font-medium">{session.account.label}</h2>
|
||||
<p className="my-0 text-gray-400">{session.account.id}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-vsc-input-background rounded-md p-4">
|
||||
<h3 className="font-medium mb-4">Account Information</h3>
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<span className="font-medium">{session.account.label}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span className="text-gray-400 text-sm">{session.account.id}</span>
|
||||
</div>
|
||||
|
||||
{organizations.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<label className="text-vsc-foreground text-sm font-medium">
|
||||
Organization
|
||||
</label>
|
||||
<div className="max-w-xs">
|
||||
<ScopeSelect />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="bg-vsc-input-background rounded-md p-4">
|
||||
<h3 className="font-medium mb-4">Actions</h3>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={logout}
|
||||
className="w-full"
|
||||
className="p-1"
|
||||
data-tooltip-id="logout-tooltip"
|
||||
>
|
||||
Sign out
|
||||
<ArrowRightStartOnRectangleIcon className="h-4 w-4" />
|
||||
</Button>
|
||||
<ToolTip id="logout-tooltip">Sign out</ToolTip>
|
||||
</div>
|
||||
|
||||
{organizations.length > 0 && (
|
||||
<div className="space-y-2">
|
||||
<label className="text-vsc-foreground text-sm font-medium">
|
||||
Current organization
|
||||
</label>
|
||||
<p className="!mt-1 text-xs text-gray-400">
|
||||
Determines what{" "}
|
||||
<span
|
||||
className="cursor-pointer underline hover:brightness-125"
|
||||
onClick={() =>
|
||||
ideMessenger.post(
|
||||
"openUrl",
|
||||
"https://docs.continue.dev/hub/assistants/intro",
|
||||
)
|
||||
}
|
||||
>
|
||||
agents
|
||||
</span>{" "}
|
||||
are available for you to use
|
||||
</p>
|
||||
<div className="!my-4 max-w-xs">
|
||||
<ScopeSelect />
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,15 +5,145 @@ import {
|
|||
PaintBrushIcon,
|
||||
TableCellsIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useContext } from "react";
|
||||
import { useContext, useMemo } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import Shortcut from "../../components/gui/Shortcut";
|
||||
import { IdeMessengerContext } from "../../context/IdeMessenger";
|
||||
import { useAppDispatch, useAppSelector } from "../../redux/hooks";
|
||||
import { setOnboardingCard } from "../../redux/slices/uiSlice";
|
||||
import { saveCurrentSession } from "../../redux/thunks/session";
|
||||
import { isJetBrains } from "../../util";
|
||||
import { ROUTES } from "../../util/navigation";
|
||||
import MoreHelpRow from "./MoreHelpRow";
|
||||
|
||||
interface KeyboardShortcutProps {
|
||||
shortcut: string;
|
||||
description: string;
|
||||
isEven: boolean;
|
||||
}
|
||||
|
||||
function KeyboardShortcut(props: KeyboardShortcutProps) {
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col items-start p-2 sm:flex-row sm:items-center ${props.isEven ? "" : "bg-table-oddRow"}`}
|
||||
>
|
||||
<div className="w-full flex-grow pb-1 pr-4 sm:w-auto sm:pb-0">
|
||||
<span className="block break-words text-xs">{props.description}:</span>
|
||||
</div>
|
||||
<div className="flex-shrink-0 whitespace-nowrap">
|
||||
<Shortcut>{props.shortcut}</Shortcut>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Shortcut strings will be rendered correctly based on the platform by the Shortcut component
|
||||
const vscodeShortcuts: Omit<KeyboardShortcutProps, "isEven">[] = [
|
||||
{
|
||||
shortcut: "cmd '",
|
||||
description: "Toggle Selected Model",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd I",
|
||||
description: "Edit highlighted code",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd L",
|
||||
description:
|
||||
"New Chat / New Chat With Selected Code / Close Continue Sidebar If Chat Already In Focus",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd backspace",
|
||||
description: "Cancel response",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift I",
|
||||
description: "Toggle inline edit focus",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift L",
|
||||
description:
|
||||
"Focus Current Chat / Add Selected Code To Current Chat / Close Continue Sidebar If Chat Already In Focus",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift R",
|
||||
description: "Debug Terminal",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift backspace",
|
||||
description: "Reject Diff",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift enter",
|
||||
description: "Accept Diff",
|
||||
},
|
||||
{
|
||||
shortcut: "alt cmd N",
|
||||
description: "Reject Top Change in Diff",
|
||||
},
|
||||
{
|
||||
shortcut: "alt cmd Y",
|
||||
description: "Accept Top Change in Diff",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd K cmd A",
|
||||
description: "Toggle Autocomplete Enabled",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd alt space",
|
||||
description: "Force an Autocomplete Trigger",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd K cmd M",
|
||||
description: "Toggle Full Screen",
|
||||
},
|
||||
];
|
||||
|
||||
const jetbrainsShortcuts: Omit<KeyboardShortcutProps, "isEven">[] = [
|
||||
{
|
||||
shortcut: "cmd '",
|
||||
description: "Toggle Selected Model",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd I",
|
||||
description: "Edit highlighted code",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd J",
|
||||
description:
|
||||
"New Chat / New Chat With Selected Code / Close Continue Sidebar If Chat Already In Focus",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd backspace",
|
||||
description: "Cancel response",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift I",
|
||||
description: "Toggle inline edit focus",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift J",
|
||||
description:
|
||||
"Focus Current Chat / Add Selected Code To Current Chat / Close Continue Sidebar If Chat Already In Focus",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift backspace",
|
||||
description: "Reject Diff",
|
||||
},
|
||||
{
|
||||
shortcut: "cmd shift enter",
|
||||
description: "Accept Diff",
|
||||
},
|
||||
{
|
||||
shortcut: "alt shift J",
|
||||
description: "Quick Input",
|
||||
},
|
||||
{
|
||||
shortcut: "alt cmd J",
|
||||
description: "Toggle Sidebar",
|
||||
},
|
||||
];
|
||||
|
||||
export function HelpCenterSection() {
|
||||
const ideMessenger = useContext(IdeMessengerContext);
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -21,6 +151,10 @@ export function HelpCenterSection() {
|
|||
|
||||
const currentSession = useAppSelector((state) => state.session);
|
||||
|
||||
const shortcuts = useMemo(() => {
|
||||
return isJetBrains() ? jetbrainsShortcuts : vscodeShortcuts;
|
||||
}, []);
|
||||
|
||||
const handleViewSessionData = async () => {
|
||||
const sessionData = await ideMessenger.request("history/load", {
|
||||
id: currentSession.id,
|
||||
|
|
@ -126,6 +260,23 @@ export function HelpCenterSection() {
|
|||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* Keyboard Shortcuts Section */}
|
||||
<div className="mt-8">
|
||||
<h3 className="mb-3 text-xl">Keyboard shortcuts</h3>
|
||||
<div>
|
||||
{shortcuts.map((shortcut, i) => {
|
||||
return (
|
||||
<KeyboardShortcut
|
||||
key={i}
|
||||
shortcut={shortcut.shortcut}
|
||||
description={shortcut.description}
|
||||
isEven={i % 2 === 0}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
44
gui/src/pages/config/TabButton.tsx
Normal file
44
gui/src/pages/config/TabButton.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { v4 as uuidv4 } from "uuid";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
import { fontSize } from "../../util";
|
||||
|
||||
interface TabButtonProps {
|
||||
id: string;
|
||||
label: string;
|
||||
icon: React.ReactNode;
|
||||
isActive: boolean;
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
export function TabButton({ id, label, icon, isActive, onClick }: TabButtonProps) {
|
||||
const tooltipId = `tab-tooltip-${uuidv4()}`;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
className={`flex cursor-pointer items-center justify-center gap-1.5 rounded-md hover:brightness-125 md:justify-start ${
|
||||
isActive
|
||||
? "bg-vsc-input-background px-2 py-2"
|
||||
: "text-description px-2 py-2"
|
||||
}`}
|
||||
onClick={onClick}
|
||||
data-tooltip-id={tooltipId}
|
||||
>
|
||||
{icon}
|
||||
<span className="hidden md:inline">{label}</span>
|
||||
</div>
|
||||
|
||||
<ToolTip
|
||||
id={tooltipId}
|
||||
place="right"
|
||||
className="md:!hidden"
|
||||
style={{ fontSize: fontSize(-2) }}
|
||||
>
|
||||
{label}
|
||||
</ToolTip>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
57
gui/src/pages/config/TabGroup.tsx
Normal file
57
gui/src/pages/config/TabGroup.tsx
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
import { TabButton } from "./TabButton";
|
||||
|
||||
interface TabOption {
|
||||
id: string;
|
||||
label: string;
|
||||
component: React.ReactNode;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
|
||||
interface TabGroupProps {
|
||||
tabs: TabOption[];
|
||||
activeTab: string;
|
||||
onTabClick: (tabId: string) => void;
|
||||
label?: string;
|
||||
showTopDivider?: boolean;
|
||||
showBottomDivider?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function TabGroup({
|
||||
tabs,
|
||||
activeTab,
|
||||
onTabClick,
|
||||
label,
|
||||
showTopDivider = false,
|
||||
showBottomDivider = false,
|
||||
className = "",
|
||||
}: TabGroupProps) {
|
||||
return (
|
||||
<div className={className}>
|
||||
{showTopDivider && (
|
||||
<div className="mx-1 my-2 border-gray-600 border-b border-solid border-[0.5px] opacity-30" />
|
||||
)}
|
||||
|
||||
{label && (
|
||||
<div className="text-description-muted text-2xs mb-2 ml-1.5 hidden font-medium md:block md:pt-1">
|
||||
{label}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{tabs.map((tab) => (
|
||||
<TabButton
|
||||
key={tab.id}
|
||||
id={tab.id}
|
||||
label={tab.label}
|
||||
icon={tab.icon}
|
||||
isActive={activeTab === tab.id}
|
||||
onClick={() => onTabClick(tab.id)}
|
||||
/>
|
||||
))}
|
||||
|
||||
{showBottomDivider && (
|
||||
<div className="md:border-description-muted mx-1 my-4 md:!border-[0.5px] md:border-b md:border-solid" />
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
134
gui/src/pages/config/configTabs.tsx
Normal file
134
gui/src/pages/config/configTabs.tsx
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
import {
|
||||
CircleStackIcon,
|
||||
Cog6ToothIcon,
|
||||
CubeIcon,
|
||||
PencilIcon,
|
||||
QuestionMarkCircleIcon,
|
||||
Squares2X2Icon,
|
||||
WrenchScrewdriverIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { UserCircleIcon } from "@heroicons/react/24/solid";
|
||||
import MCPSection from "../../components/mainInput/Lump/sections/mcp/MCPSection";
|
||||
import { ModelsSection } from "../../components/mainInput/Lump/sections/ModelsSection";
|
||||
import { RulesSection } from "../../components/mainInput/Lump/sections/RulesSection";
|
||||
import { ToolPoliciesSection } from "../../components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection";
|
||||
import { AccountSection } from "./AccountSection";
|
||||
import { HelpCenterSection } from "./HelpCenterSection";
|
||||
import { IndexingSettingsSection } from "./IndexingSettingsSection";
|
||||
import { UserSettingsForm } from "./UserSettingsForm";
|
||||
|
||||
interface TabOption {
|
||||
id: string;
|
||||
label: string;
|
||||
component: React.ReactNode;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
|
||||
interface TabSection {
|
||||
id: string;
|
||||
tabs: TabOption[];
|
||||
label?: string;
|
||||
showTopDivider?: boolean;
|
||||
showBottomDivider?: boolean;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export const topTabSections: TabSection[] = [
|
||||
{
|
||||
id: "top",
|
||||
tabs: [
|
||||
{
|
||||
id: "account",
|
||||
label: "Account",
|
||||
component: <AccountSection />,
|
||||
icon: <UserCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "blocks",
|
||||
label: "Blocks",
|
||||
showTopDivider: true,
|
||||
tabs: [
|
||||
{
|
||||
id: "models",
|
||||
label: "Models",
|
||||
component: (
|
||||
<div className="mt-4">
|
||||
<h3 className="mb-4 mt-0 text-xl">Models</h3>
|
||||
<ModelsSection />
|
||||
</div>
|
||||
),
|
||||
icon: <CubeIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "rules",
|
||||
label: "Rules",
|
||||
component: (
|
||||
<div className="mt-4">
|
||||
<h3 className="mb-4 mt-0 text-xl">Rules</h3>
|
||||
<RulesSection />
|
||||
</div>
|
||||
),
|
||||
icon: <PencilIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "mcp",
|
||||
label: "MCP",
|
||||
component: <MCPSection />,
|
||||
icon: <Squares2X2Icon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "tools",
|
||||
label: "Tools",
|
||||
component: (
|
||||
<div className="mt-4">
|
||||
<h3 className="mb-4 mt-0 text-xl">Tool Policies</h3>
|
||||
<ToolPoliciesSection />
|
||||
</div>
|
||||
),
|
||||
icon: (
|
||||
<WrenchScrewdriverIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "indexing",
|
||||
showTopDivider: true,
|
||||
tabs: [
|
||||
{
|
||||
id: "indexing",
|
||||
label: "Indexing",
|
||||
component: <IndexingSettingsSection />,
|
||||
icon: <CircleStackIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export const bottomTabSections: TabSection[] = [
|
||||
{
|
||||
id: "bottom",
|
||||
tabs: [
|
||||
{
|
||||
id: "settings",
|
||||
label: "Settings",
|
||||
component: <UserSettingsForm />,
|
||||
icon: <Cog6ToothIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "help",
|
||||
label: "Help",
|
||||
component: <HelpCenterSection />,
|
||||
icon: (
|
||||
<QuestionMarkCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export const getAllTabs = (): TabOption[] => {
|
||||
return [...topTabSections, ...bottomTabSections].flatMap((section) => section.tabs);
|
||||
};
|
||||
|
|
@ -1,193 +1,59 @@
|
|||
import {
|
||||
ArrowLeftIcon,
|
||||
BoltIcon,
|
||||
CircleStackIcon,
|
||||
Cog6ToothIcon,
|
||||
CubeIcon,
|
||||
PencilIcon,
|
||||
QuestionMarkCircleIcon,
|
||||
Squares2X2Icon,
|
||||
WrenchScrewdriverIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { UserCircleIcon } from "@heroicons/react/24/solid";
|
||||
import { useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
import MCPSection from "../../components/mainInput/Lump/sections/mcp/MCPSection";
|
||||
import { ModelsSection } from "../../components/mainInput/Lump/sections/ModelsSection";
|
||||
import { RulesSection } from "../../components/mainInput/Lump/sections/RulesSection";
|
||||
import { ToolPoliciesSection } from "../../components/mainInput/Lump/sections/tool-policies/ToolPoliciesSection";
|
||||
import { PageHeader } from "../../components/PageHeader";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { fontSize } from "../../util";
|
||||
import { AccountSection } from "./AccountSection";
|
||||
import { HelpCenterSection } from "./HelpCenterSection";
|
||||
import { IndexingSettingsSection } from "./IndexingSettingsSection";
|
||||
import KeyboardShortcuts from "./KeyboardShortcuts";
|
||||
import { UserSettingsForm } from "./UserSettingsForm";
|
||||
|
||||
type TabOption = {
|
||||
id: string;
|
||||
label: string;
|
||||
component: React.ReactNode;
|
||||
icon: React.ReactNode;
|
||||
};
|
||||
import { topTabSections, bottomTabSections, getAllTabs } from "./configTabs";
|
||||
import { TabGroup } from "./TabGroup";
|
||||
|
||||
function ConfigPage() {
|
||||
useNavigationListener();
|
||||
const navigate = useNavigate();
|
||||
const [activeTab, setActiveTab] = useState("settings");
|
||||
|
||||
const tabs: TabOption[] = [
|
||||
{
|
||||
id: "account",
|
||||
label: "Account",
|
||||
component: <AccountSection />,
|
||||
icon: <UserCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "settings",
|
||||
label: "Settings",
|
||||
component: <UserSettingsForm />,
|
||||
icon: <Cog6ToothIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "models",
|
||||
label: "Models",
|
||||
component: (
|
||||
<div className="mt-4">
|
||||
<h3 className="mb-4 mt-0 text-xl">Models</h3>
|
||||
<ModelsSection />
|
||||
</div>
|
||||
),
|
||||
icon: <CubeIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "rules",
|
||||
label: "Rules",
|
||||
component: (
|
||||
<div className="mt-4">
|
||||
<h3 className="mb-4 mt-0 text-xl">Rules</h3>
|
||||
<RulesSection />
|
||||
</div>
|
||||
),
|
||||
icon: <PencilIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "mcp",
|
||||
label: "MCP",
|
||||
component: <MCPSection />,
|
||||
icon: <Squares2X2Icon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "tools",
|
||||
label: "Tools",
|
||||
component: (
|
||||
<div className="mt-4">
|
||||
<h3 className="mb-4 mt-0 text-xl">Tool Policies</h3>
|
||||
<ToolPoliciesSection />
|
||||
</div>
|
||||
),
|
||||
icon: (
|
||||
<WrenchScrewdriverIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "indexing",
|
||||
label: "Indexing",
|
||||
component: <IndexingSettingsSection />,
|
||||
icon: <CircleStackIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
{
|
||||
id: "help",
|
||||
label: "Help",
|
||||
component: <HelpCenterSection />,
|
||||
icon: (
|
||||
<QuestionMarkCircleIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />
|
||||
),
|
||||
},
|
||||
{
|
||||
id: "shortcuts",
|
||||
label: "Shortcuts",
|
||||
component: <KeyboardShortcuts />,
|
||||
icon: <BoltIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
|
||||
},
|
||||
];
|
||||
const allTabs = getAllTabs();
|
||||
|
||||
return (
|
||||
<div className="flex h-full flex-row overflow-hidden">
|
||||
{/* Vertical Sidebar - full height */}
|
||||
<div className="bg-vsc-background flex w-12 flex-shrink-0 flex-col border-0 md:w-32">
|
||||
{/* Sidebar content */}
|
||||
<div className="border-r-border flex flex-1 flex-col gap-1 overflow-y-auto border-b-0 border-l-0 border-r-2 border-t-0 border-solid p-2">
|
||||
{/* Back Button */}
|
||||
<div
|
||||
className="-mx-1 flex cursor-pointer items-center justify-center gap-1.5 rounded-md px-2 py-2 hover:brightness-125 md:justify-start"
|
||||
onClick={() => navigate("/")}
|
||||
data-tooltip-id="back-tooltip"
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0 text-gray-400" />
|
||||
<span className="hidden text-gray-400 md:inline">Back</span>
|
||||
</div>
|
||||
|
||||
{/* Back button tooltip for small screens only */}
|
||||
<ToolTip
|
||||
id="back-tooltip"
|
||||
place="right"
|
||||
offset={10}
|
||||
className="md:!hidden"
|
||||
style={{ fontSize: fontSize(-2) }}
|
||||
>
|
||||
Back
|
||||
</ToolTip>
|
||||
|
||||
{/* Small gap between back button and tabs */}
|
||||
<div className="h-2"></div>
|
||||
|
||||
{/* Tab Headers */}
|
||||
{tabs.map((tab) => {
|
||||
const tooltipId = `tab-tooltip-${uuidv4()}`;
|
||||
return (
|
||||
<div key={tab.id}>
|
||||
<div
|
||||
style={{
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
className={`flex cursor-pointer items-center justify-center gap-1.5 rounded-md hover:brightness-125 md:justify-start ${
|
||||
activeTab === tab.id
|
||||
? "bg-vsc-input-background p-2 md:px-2 md:py-2"
|
||||
: "px-1 py-2 text-gray-400"
|
||||
}`}
|
||||
onClick={() => setActiveTab(tab.id)}
|
||||
data-tooltip-id={tooltipId}
|
||||
>
|
||||
{tab.icon}
|
||||
<span className="hidden md:inline">{tab.label}</span>
|
||||
</div>
|
||||
|
||||
{/* Tooltip for small screens only */}
|
||||
<ToolTip
|
||||
id={tooltipId}
|
||||
place="right"
|
||||
className="md:!hidden"
|
||||
style={{ fontSize: fontSize(-2) }}
|
||||
>
|
||||
{tab.label}
|
||||
</ToolTip>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<div className="border-r-border flex flex-1 flex-col overflow-y-auto border-b-0 border-l-0 border-r-2 border-t-0 border-solid p-2">
|
||||
{topTabSections.map((section) => (
|
||||
<TabGroup
|
||||
key={section.id}
|
||||
tabs={section.tabs}
|
||||
activeTab={activeTab}
|
||||
onTabClick={setActiveTab}
|
||||
label={section.label}
|
||||
showTopDivider={section.showTopDivider}
|
||||
showBottomDivider={section.showBottomDivider}
|
||||
className={section.className}
|
||||
/>
|
||||
))}
|
||||
|
||||
<div className="flex-1" />
|
||||
|
||||
<div className="md:border-description-muted hidden md:block md:border-t md:pt-2" />
|
||||
{bottomTabSections.map((section) => (
|
||||
<TabGroup
|
||||
key={section.id}
|
||||
tabs={section.tabs}
|
||||
activeTab={activeTab}
|
||||
onTabClick={setActiveTab}
|
||||
label={section.label}
|
||||
showTopDivider={section.showTopDivider}
|
||||
showBottomDivider={section.showBottomDivider}
|
||||
className={section.className}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Main content area */}
|
||||
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
|
||||
<PageHeader onTitleClick={() => navigate("/")} title="Back" />
|
||||
{/* Tab Content */}
|
||||
<div className="flex-1 overflow-y-auto px-4">
|
||||
{tabs.find((tab) => tab.id === activeTab)?.component}
|
||||
{allTabs.find((tab) => tab.id === activeTab)?.component}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ import { useNavigate } from "react-router-dom";
|
|||
import { History } from "../../components/History";
|
||||
import { PageHeader } from "../../components/PageHeader";
|
||||
import { getFontSize } from "../../util";
|
||||
import { AccountButton } from "../config/AccountButton";
|
||||
|
||||
export default function HistoryPage() {
|
||||
const navigate = useNavigate();
|
||||
|
|
@ -12,12 +11,7 @@ export default function HistoryPage() {
|
|||
className="flex flex-1 flex-col overflow-auto"
|
||||
style={{ fontSize: getFontSize() }}
|
||||
>
|
||||
<PageHeader
|
||||
showBorder
|
||||
onTitleClick={() => navigate("/")}
|
||||
title="Chat"
|
||||
rightContent={<AccountButton />}
|
||||
/>
|
||||
<PageHeader showBorder onTitleClick={() => navigate("/")} title="Chat" />
|
||||
<History />
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { table } from "table";
|
||||
import { lightGray, vscBackground, vscInputBackground } from "../components";
|
||||
import { CopyIconButton } from "../components/gui/CopyIconButton";
|
||||
import { PageHeader } from "../components/PageHeader";
|
||||
import { IdeMessengerContext } from "../context/IdeMessenger";
|
||||
import { useNavigationListener } from "../hooks/useNavigationListener";
|
||||
|
||||
|
|
@ -65,17 +65,11 @@ function Stats() {
|
|||
backgroundColor: vscBackground,
|
||||
}}
|
||||
>
|
||||
<div
|
||||
onClick={() => navigate(-1)}
|
||||
className="sticky top-0 m-0 flex cursor-pointer items-center p-0"
|
||||
style={{
|
||||
borderBottom: `0.5px solid ${lightGray}`,
|
||||
backgroundColor: vscBackground,
|
||||
}}
|
||||
>
|
||||
<ArrowLeftIcon className="ml-4 inline-block h-3 w-3 cursor-pointer" />
|
||||
<span className="m-2 inline-block text-base font-bold">More</span>
|
||||
</div>
|
||||
<PageHeader
|
||||
title="More"
|
||||
onTitleClick={() => navigate(-1)}
|
||||
showBorder
|
||||
/>
|
||||
|
||||
<div className="p-2">
|
||||
<div className="flex items-center gap-2">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue