improv: ui

This commit is contained in:
tomasz-io 2025-03-10 11:46:48 -07:00
parent 3c0e6d453f
commit f2900ec12e
2 changed files with 29 additions and 46 deletions

View file

@ -1,7 +1,7 @@
import { useAppSelector } from "../../redux/hooks";
import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
import { ReusableCard } from "../ReusableCard";
import { OnboardingCardTabs, TabTitle } from "./components/OnboardingCardTabs";
import { ReusableCard } from "./components/ReusableCard";
import { useOnboardingCard } from "./hooks/useOnboardingCard";
import * as Tabs from "./tabs";

View file

@ -1,23 +1,12 @@
import { XMarkIcon } from "@heroicons/react/24/outline";
import { useState } from "react";
import styled from "styled-components";
import { CloseButton, defaultBorderRadius, vscInputBackground } from "../..";
import { useAppSelector } from "../../../redux/hooks";
import { getLocalStorage, setLocalStorage } from "../../../util/localStorage";
import Alert from "../../gui/Alert";
import { ReusableCard } from "../../ReusableCard";
import { TabTitle } from "../components/OnboardingCardTabs";
import { useOnboardingCard } from "../hooks";
import OnboardingLocalTab from "../tabs/OnboardingLocalTab";
import MainTab from "./tabs/main";
import { useAppSelector } from "../../../redux/hooks";
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;
@ -31,44 +20,38 @@ interface OnboardingCardProps {
export function PlatformOnboardingCard({ isDialog }: OnboardingCardProps) {
const onboardingCard = useOnboardingCard();
const config = useAppSelector((store) => store.config.config);
const [currentTab, setCurrentTab] = useState<"main" | "local">("main");
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">
{!isDialog && !!config.models.length && (
<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")}
isDialog={isDialog}
/>
) : (
<div className="mt-4 flex flex-col">
<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 isDialog={isDialog} />
</div>
)}
</div>
<ReusableCard
showCloseButton={!isDialog && !!config.models.length}
onClose={() => onboardingCard.close()}
>
<div className="flex h-full w-full items-center justify-center">
{currentTab === "main" ? (
<MainTab
onRemainLocal={() => setCurrentTab("local")}
isDialog={isDialog}
/>
) : (
<div className="mt-4 flex flex-col">
<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 isDialog={isDialog} />
</div>
)}
</div>
</StyledCard>
</ReusableCard>
);
}