move footer to view/title commands

This commit is contained in:
Dallin Romney 2024-11-13 00:25:16 -08:00
parent f5e63cffc7
commit e58ca61272
6 changed files with 140 additions and 20 deletions

View file

@ -1,7 +1,7 @@
import * as fs from "fs";
import * as os from "os";
import { pathToFileURL } from "url";
import * as path from "path";
import * as JSONC from "comment-json";
import dotenv from "dotenv";
@ -41,6 +41,9 @@ export function getGlobalContinueIgnorePath(): string {
return continueIgnorePath;
}
/*
Deprecated, replace with getContinueGlobalUri where possible
*/
export function getContinueGlobalPath(): string {
// This is ~/.continue on mac/linux
const continuePath = CONTINUE_GLOBAL_DIR;
@ -50,6 +53,10 @@ export function getContinueGlobalPath(): string {
return continuePath;
}
export function getContinueGlobalUri(): string {
return pathToFileURL(CONTINUE_GLOBAL_DIR).href;
}
export function getSessionsFolderPath(): string {
const sessionsPath = path.join(getContinueGlobalPath(), "sessions");
if (!fs.existsSync(sessionsPath)) {
@ -94,6 +101,10 @@ export function getConfigJsonPath(ideType: IdeType = "vscode"): string {
return p;
}
export function getConfigJsonUri(): string {
return getContinueGlobalUri() + "/config.json";
}
export function getConfigTsPath(): string {
const p = path.join(getContinueGlobalPath(), "config.ts");
if (!fs.existsSync(p)) {

View file

@ -257,6 +257,13 @@
"title": "Navigate to a path",
"group": "Continue"
},
{
"command": "continue.openMorePage",
"category": "Continue",
"title": "More",
"icon": "$(ellipsis)",
"group": "Continue"
},
{
"command": "continue.writeCommentsForCode",
"category": "Continue",
@ -316,6 +323,24 @@
"category": "Continue",
"title": "Focus Continue Chat",
"group": "Continue"
},
{
"command": "continue.signOut",
"title": "Sign Out",
"category": "Continue",
"group": "Continue"
},
{
"command": "continue.useLocalConfig",
"title": "Local Config",
"category": "Continue",
"group": "Continue"
},
{
"command": "continue.useTeamConfig",
"title": "Team Config",
"category": "Continue",
"group": "Continue"
}
],
"keybindings": [
@ -410,6 +435,11 @@
{
"id": "continue.continueSubMenu",
"label": "Continue"
},
{
"id": "continue.accountSubmenu",
"label": "Account",
"icon": "$(account)"
}
],
"menus": {
@ -504,6 +534,16 @@
"command": "continue.openConfig",
"group": "navigation@4",
"when": "view == continue.continueGUIView"
},
{
"submenu": "continue.accountSubmenu",
"group": "navigation@5",
"when": "view == continue.continueGUIView"
},
{
"command": "continue.openMorePage",
"group": "navigation@6",
"when": "view == continue.continueGUIView"
}
],
"editor/title": [
@ -523,6 +563,23 @@
"command": "continue.debugTerminal",
"group": "navigation@top"
}
],
"continue.accountSubmenu": [
{
"command": "continue.useLocalConfig",
"title": "Local Config",
"group": "Config@1"
},
{
"command": "continue.useTeamConfig",
"title": "Team Config",
"group": "Config@2"
},
{
"command": "continue.signOut",
"title": "Sign Out",
"group": "Other@1"
}
]
},
"viewsContainers": {

View file

@ -826,6 +826,9 @@ const commandsMap: (
client.sendFeedback(feedback, lastLines);
}
},
"continue.openMorePage": () => {
vscode.commands.executeCommand("continue.navigateTo", "/more");
},
"continue.navigateTo": (path: string) => {
sidebar.webviewProtocol?.request("navigateTo", { path });
focusGUI();

View file

@ -48,7 +48,7 @@ function Footer() {
if (defaultModel?.provider === "free-trial") {
return (
<footer className="flex flex-row border-0 border-t border-solid border-t-zinc-700 px-2 py-2">
<footer className="flex flex-col border-0 border-t border-solid border-t-zinc-700 px-2 py-2">
<FreeTrialProgressBar
completed={parseInt(localStorage.getItem("ftc") || "0")}
total={FREE_TRIAL_LIMIT_REQUESTS}
@ -58,6 +58,12 @@ function Footer() {
}
return null;
// vscode.commands.executeCommand(
// "setContext",
// "continue.streamingDiff",
// false,
// );
// return (
// <footer className="flex h-7 items-center justify-between overflow-hidden border-0 border-t border-solid border-t-zinc-700 p-2">
// <div className="flex max-w-[40vw] gap-2">

View file

@ -62,6 +62,10 @@ import {
} from "../../util";
import { FREE_TRIAL_LIMIT_REQUESTS } from "../../util/freeTrial";
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
import HeaderButtonWithToolTip from "../../components/gui/HeaderButtonWithToolTip";
import { useNavigate } from "react-router-dom";
import ConfigError from "./ConfigError";
import ConfigErrorIndicator from "./ConfigError";
const StopButton = styled.div`
background-color: ${vscBackground};
@ -458,37 +462,40 @@ export function Chat() {
pointerEvents: active ? "none" : "auto",
}}
>
{state.history.length > 0 ? (
<div className="xs:inline mt-2 hidden">
<NewSessionButton
onClick={() => {
saveSession();
}}
className="mr-auto"
>
<span className="xs:inline hidden">
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"})
</span>
</NewSessionButton>
</div>
) : (
<>
{getLastSessionId() ? (
<div className="xs:inline mt-2 hidden">
<div className="flex flex-row items-center justify-between pl-0.5 pr-2">
<div className="xs:inline hidden">
{state.history.length > 0 ? (
<NewSessionButton
onClick={() => {
saveSession();
}}
>
<span className="xs:inline hidden">
New Session ({getMetaKeyLabel()} {isJetBrains() ? "J" : "L"}
)
</span>
</NewSessionButton>
) : getLastSessionId() ? (
<div className="xs:inline hidden">
<NewSessionButton
onClick={async () => {
loadLastSession().catch((e) =>
console.error(`Failed to load last session: ${e}`),
);
}}
className="mr-auto flex items-center gap-2"
className="flex items-center gap-2"
>
<ArrowLeftIcon className="h-3 w-3" />
Last Session
</NewSessionButton>
</div>
) : null}
</div>
<ConfigErrorIndicator />
</div>
{state.history.length === 0 && (
<>
{onboardingCard.show && (
<div className="mx-2 mt-10">
<OnboardingCard activeTab={onboardingCard.activeTab} />

View file

@ -0,0 +1,36 @@
import { useLocation, useNavigate } from "react-router-dom";
import HeaderButtonWithToolTip from "../../components/gui/HeaderButtonWithToolTip";
import { useSelector } from "react-redux";
import { ROUTES } from "../../util/navigation";
import { RootState } from "../../redux/store";
import { ExclamationTriangleIcon } from "@heroicons/react/24/outline";
const ConfigErrorIndicator = () => {
const configError = useSelector(
(store: RootState) => store.state.configError,
);
const navigate = useNavigate();
const { pathname } = useLocation();
function onClickError() {
navigate(pathname === ROUTES.CONFIG_ERROR ? "/" : ROUTES.CONFIG_ERROR);
}
if (!configError) {
return null;
}
// TODO: add a tooltip
return (
<HeaderButtonWithToolTip
tooltipPlacement="top-end"
text="Config error"
onClick={onClickError}
>
<ExclamationTriangleIcon className="h-4 w-4 text-red-600" />
</HeaderButtonWithToolTip>
);
};
export default ConfigErrorIndicator;