platform onboarding card
This commit is contained in:
parent
b01a97ebef
commit
a57b5efa26
7 changed files with 145 additions and 6 deletions
|
|
@ -48,6 +48,3 @@ export const controlPlaneEnv =
|
|||
: process.env.CONTROL_PLANE_ENV === "staging"
|
||||
? STAGING_ENV
|
||||
: PRODUCTION_ENV;
|
||||
|
||||
export const USE_PLATFORM =
|
||||
process.env.CONTROL_PLANE_ENV === "local" ? true : false;
|
||||
|
|
|
|||
1
core/control-plane/flags.ts
Normal file
1
core/control-plane/flags.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export const USE_PLATFORM = true;
|
||||
|
|
@ -42,7 +42,7 @@ import { TTS } from "./util/tts";
|
|||
|
||||
import { type ContextItemId, type IDE, type IndexingProgressUpdate } from ".";
|
||||
import { SYSTEM_PROMPT_DOT_FILE } from "./config/getSystemPromptDotFile";
|
||||
import { USE_PLATFORM } from "./control-plane/env";
|
||||
import { USE_PLATFORM } from "./control-plane/flags";
|
||||
import type { FromCoreProtocol, ToCoreProtocol } from "./protocol";
|
||||
import type { IMessenger, Message } from "./protocol/messenger";
|
||||
import { localPathToUri } from "./util/pathToUri";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,63 @@
|
|||
import { XMarkIcon } from "@heroicons/react/24/outline";
|
||||
import { useState } from "react";
|
||||
import styled from "styled-components";
|
||||
import { CloseButton, defaultBorderRadius, vscInputBackground } from "../..";
|
||||
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
|
||||
import Alert from "../../gui/Alert";
|
||||
import { TabTitle } from "../components/OnboardingCardTabs";
|
||||
import { useOnboardingCard } from "../hooks";
|
||||
import OnboardingLocalTab from "../tabs/OnboardingLocalTab";
|
||||
import MainTab from "./tabs/main";
|
||||
|
||||
const StyledCard = styled.div`
|
||||
margin: auto;
|
||||
border-radius: ${defaultBorderRadius};
|
||||
background-color: ${vscInputBackground};
|
||||
box-shadow:
|
||||
0 20px 25px -5px rgb(0 0 0 / 0.1),
|
||||
0 8px 10px -6px rgb(0 0 0 / 0.1);
|
||||
`;
|
||||
|
||||
export interface OnboardingCardState {
|
||||
show?: boolean;
|
||||
activeTab?: TabTitle;
|
||||
}
|
||||
|
||||
export function PlatformOnboardingCard() {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
|
||||
if (getLocalStorage("onboardingStatus") === undefined) {
|
||||
setLocalStorage("onboardingStatus", "Started");
|
||||
}
|
||||
|
||||
const [currentTab, setCurrentTab] = useState<"main" | "local">("main");
|
||||
|
||||
return (
|
||||
<StyledCard className="xs:py-4 xs:px-4 relative px-2 py-3">
|
||||
<CloseButton onClick={onboardingCard.close}>
|
||||
<XMarkIcon className="mt-1.5 hidden h-5 w-5 hover:brightness-125 sm:flex" />
|
||||
</CloseButton>
|
||||
<div className="content py-4">
|
||||
<div className="flex h-full w-full items-center justify-center">
|
||||
{currentTab === "main" ? (
|
||||
<MainTab onRemainLocal={() => setCurrentTab("local")} />
|
||||
) : (
|
||||
<div className="mt-4">
|
||||
<Alert type="info">
|
||||
By choosing this option, Continue will be configured by a local{" "}
|
||||
<code>config.yaml</code> file. If you're just looking to use
|
||||
Ollama and still want to manage your configuration through
|
||||
Continue, click{" "}
|
||||
<a href="#" onClick={() => setCurrentTab("main")}>
|
||||
here
|
||||
</a>
|
||||
</Alert>
|
||||
|
||||
<OnboardingLocalTab />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</StyledCard>
|
||||
);
|
||||
}
|
||||
26
gui/src/components/OnboardingCard/platform/tabs/local.tsx
Normal file
26
gui/src/components/OnboardingCard/platform/tabs/local.tsx
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { useAuth } from "../../../../context/Auth";
|
||||
import ContinueLogo from "../../../gui/ContinueLogo";
|
||||
import { useOnboardingCard } from "../../hooks";
|
||||
|
||||
export default function LocalTab() {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const auth = useAuth();
|
||||
|
||||
return (
|
||||
<div className="xs:px-0 flex w-full max-w-full flex-col items-center justify-center px-4 text-center">
|
||||
<div className="xs:flex hidden">
|
||||
<ContinueLogo height={75} />
|
||||
</div>
|
||||
|
||||
<p className="xs:w-3/4 w-full text-sm">
|
||||
Log in to quickly build your first custom AI code assistant
|
||||
</p>
|
||||
|
||||
{/* <p className="xs:w-3/4 w-full text-sm">
|
||||
To prevent abuse, we'll ask you to sign in to GitHub.
|
||||
</p> */}
|
||||
|
||||
<div className="mt-4 w-full"></div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
46
gui/src/components/OnboardingCard/platform/tabs/main.tsx
Normal file
46
gui/src/components/OnboardingCard/platform/tabs/main.tsx
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
import { ChevronRightIcon } from "@heroicons/react/24/outline";
|
||||
import { Button, ButtonSubtext } from "../../..";
|
||||
import { useAuth } from "../../../../context/Auth";
|
||||
import ContinueLogo from "../../../gui/ContinueLogo";
|
||||
import { useOnboardingCard } from "../../hooks";
|
||||
|
||||
export default function MainTab({
|
||||
onRemainLocal,
|
||||
}: {
|
||||
onRemainLocal: () => void;
|
||||
}) {
|
||||
const onboardingCard = useOnboardingCard();
|
||||
const auth = useAuth();
|
||||
|
||||
function onGetStarted() {
|
||||
auth.login(true);
|
||||
onboardingCard.close();
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="xs:px-0 flex w-full max-w-full flex-col items-center justify-center px-4 text-center">
|
||||
<div className="xs:flex hidden">
|
||||
<ContinueLogo height={75} />
|
||||
</div>
|
||||
|
||||
<p className="xs:w-3/4 w-full text-sm">
|
||||
Log in to quickly build your first custom AI code assistant
|
||||
</p>
|
||||
|
||||
<div className="mt-4 w-full">
|
||||
<Button
|
||||
onClick={onGetStarted}
|
||||
className="grid w-full grid-flow-col items-center gap-2"
|
||||
>
|
||||
Get started
|
||||
</Button>
|
||||
<ButtonSubtext onClick={onRemainLocal}>
|
||||
<div className="mt-4 flex cursor-pointer items-center justify-center gap-1">
|
||||
<span>Or, remain local</span>
|
||||
<ChevronRightIcon className="h-3 w-3" />
|
||||
</div>
|
||||
</ButtonSubtext>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import {
|
|||
} from "@heroicons/react/24/outline";
|
||||
import { Editor, JSONContent } from "@tiptap/react";
|
||||
import { InputModifiers, RangeInFileWithContents, ToolCallState } from "core";
|
||||
import { USE_PLATFORM } from "core/control-plane/flags";
|
||||
import { streamResponse } from "core/llm/stream";
|
||||
import { stripImages } from "core/util/messageContent";
|
||||
import { usePostHog } from "posthog-js/react";
|
||||
|
|
@ -32,6 +33,7 @@ import {
|
|||
OnboardingCard,
|
||||
useOnboardingCard,
|
||||
} from "../../components/OnboardingCard";
|
||||
import { PlatformOnboardingCard } from "../../components/OnboardingCard/platform/PlatformOnboardingCard";
|
||||
import PageHeader from "../../components/PageHeader";
|
||||
import StepContainer from "../../components/StepContainer";
|
||||
import AcceptRejectAllButtons from "../../components/StepContainer/AcceptRejectAllButtons";
|
||||
|
|
@ -57,6 +59,7 @@ import {
|
|||
import { RootState } from "../../redux/store";
|
||||
import { cancelStream } from "../../redux/thunks/cancelStream";
|
||||
import { exitEditMode } from "../../redux/thunks/exitEditMode";
|
||||
import { loadLastSession } from "../../redux/thunks/session";
|
||||
import { streamResponseThunk } from "../../redux/thunks/streamResponse";
|
||||
import {
|
||||
getFontSize,
|
||||
|
|
@ -70,7 +73,6 @@ import ConfigErrorIndicator from "./ConfigError";
|
|||
import { ToolCallDiv } from "./ToolCallDiv";
|
||||
import { ToolCallButtons } from "./ToolCallDiv/ToolCallButtonsDiv";
|
||||
import ToolOutput from "./ToolCallDiv/ToolOutput";
|
||||
import { loadLastSession } from "../../redux/thunks/session";
|
||||
|
||||
const StopButton = styled.div`
|
||||
background-color: ${vscBackground};
|
||||
|
|
@ -540,7 +542,11 @@ export function Chat() {
|
|||
<>
|
||||
{onboardingCard.show && (
|
||||
<div className="mx-2 mt-10">
|
||||
<OnboardingCard />
|
||||
{USE_PLATFORM ? (
|
||||
<PlatformOnboardingCard />
|
||||
) : (
|
||||
<OnboardingCard />
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue