convert to sidebar

This commit is contained in:
Patrick Erichsen 2025-09-04 20:23:04 -07:00
parent 9b68dea372
commit 1de8b3d8f5
5 changed files with 174 additions and 101 deletions

View file

@ -1,20 +0,0 @@
#!/bin/bash
# Get file path from hook input
FILE_PATH=$(cat | jq -r '.tool_input.file_path // .tool_input.edits[].file_path // empty' | head -n1)
# Function to run lint and typecheck
run_checks() {
local dir=$1
cd "$dir"
npm run lint >&2 && npm run tsc:check >&2
}
# Run checks based on file location
if [[ "$FILE_PATH" == *"/core/"* ]]; then
run_checks core
elif [[ "$FILE_PATH" == *"/gui/"* ]]; then
run_checks gui
elif [[ "$FILE_PATH" == *"/extensions/vscode/"* ]]; then
run_checks extensions/vscode
fi

View file

@ -1,15 +0,0 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Write|Edit|MultiEdit",
"hooks": [
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/lint-check.sh"
}
]
}
]
}
}

View file

@ -9,7 +9,7 @@ import { fontSize } from "../../util";
const TooltipStyles: CSSProperties = {
fontSize: fontSize(-4),
backgroundColor: vscBackground,
outline: `0.5px solid ${varWithFallback("badge-background")}`,
outline: `0.5px solid ${varWithFallback("description")}`,
color: vscForeground,
padding: "4px 8px",
zIndex: 1000,

View file

@ -0,0 +1,96 @@
import { UserCircleIcon } from "@heroicons/react/24/solid";
import { isOnPremSession } from "core/control-plane/AuthTypes";
import { ScopeSelect } from "../../components/AssistantAndOrgListbox/ScopeSelect";
import { Button } from "../../components/ui";
import { useAuth } from "../../context/Auth";
import { useAppSelector } from "../../redux/hooks";
import { selectCurrentOrg } from "../../redux/slices/profilesSlice";
export function AccountSection() {
const { session, logout, login, organizations } = useAuth();
const selectedOrg = useAppSelector(selectCurrentOrg);
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="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)}
>
Sign in
</Button>
</div>
</div>
);
}
// For on-prem deployments, show basic account info
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>
<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>
</div>
</div>
);
}
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">Manage your account settings</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"
onClick={logout}
className="w-full"
>
Sign out
</Button>
</div>
</div>
);
}

View file

@ -1,4 +1,5 @@
import {
ArrowLeftIcon,
BoltIcon,
CircleStackIcon,
Cog6ToothIcon,
@ -8,16 +9,18 @@ import {
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 { AccountButton } from "./AccountButton";
import { AccountSection } from "./AccountSection";
import { HelpCenterSection } from "./HelpCenterSection";
import { IndexingSettingsSection } from "./IndexingSettingsSection";
import KeyboardShortcuts from "./KeyboardShortcuts";
@ -36,6 +39,12 @@ function ConfigPage() {
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",
@ -64,28 +73,6 @@ function ConfigPage() {
),
icon: <PencilIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
},
// {
// id: "docs",
// label: "Docs",
// component: (
// <div className="mt-4">
// <h3 className="mb-4 mt-0 text-xl">Documentation</h3>
// <DocsSection />
// </div>
// ),
// icon: <BookOpenIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
// },
// {
// id: "prompts",
// label: "Prompts",
// component: (
// <div className="mt-4">
// <h3 className="mb-4 mt-0 text-xl">Prompts</h3>
// <PromptsSection />
// </div>
// ),
// icon: <ChatBubbleLeftIcon className="xs:h-4 xs:w-4 h-3 w-3 flex-shrink-0" />,
// },
{
id: "mcp",
label: "MCP",
@ -128,53 +115,78 @@ function ConfigPage() {
];
return (
<div className="flex h-full flex-col lg:flex-row lg:overflow-hidden">
{/* Header and tabs section */}
<div className="bg-vsc-background lg:bg-transparent lg:w-48 lg:flex-shrink-0 lg:flex lg:flex-col lg:h-full">
{/* Header - only show on mobile/tablet */}
<div className="lg:hidden">
<PageHeader
showBorder
onTitleClick={() => navigate("/")}
title="Chat"
rightContent={<AccountButton />}
/>
</div>
<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>
{/* Tab Headers */}
<div className="bg-vsc-input-background lg:bg-vsc-background flex cursor-pointer flex-wrap justify-center gap-x-2 gap-y-1 border-0 border-b-[1px] lg:border-r-[1px] lg:border-b-0 border-solid border-b-zinc-700 lg:border-r-zinc-700 p-0.5 lg:flex-col lg:gap-1 lg:p-4 lg:justify-start lg:flex-1 lg:overflow-y-auto">
{tabs.map((tab) => (
<div
style={{
fontSize: fontSize(-2),
}}
key={tab.id}
className={`flex cursor-pointer items-center justify-center lg:justify-start gap-1.5 rounded-md px-2 py-2 hover:brightness-125 lg:w-full ${
activeTab === tab.id ? "" : "text-gray-400"
}`}
onClick={() => setActiveTab(tab.id)}
>
{tab.icon}
{tab.label}
</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>
</div>
{/* Main content area */}
<div className="flex-1 flex flex-col overflow-hidden lg:min-h-0">
{/* Header for desktop */}
<div className="hidden lg:block bg-vsc-background sticky top-0 z-10">
<PageHeader
showBorder
onTitleClick={() => navigate("/")}
title="Chat"
rightContent={<AccountButton />}
/>
</div>
<div className="flex min-h-0 flex-1 flex-col overflow-hidden">
{/* Tab Content */}
<div className="flex-1 overflow-y-auto px-4 lg:overflow-y-auto">
<div className="flex-1 overflow-y-auto px-4">
{tabs.find((tab) => tab.id === activeTab)?.component}
</div>
</div>