Merge pull request #6024 from continuedev/pe/onboarding-card-refactor-pt1

feat: skip hub onboarding in free trial
This commit is contained in:
Nate Sesti 2025-06-06 16:39:43 -07:00 • committed by GitHub
commit dac90091ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 85 additions and 31 deletions

View file

@ -174,7 +174,7 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable {
get redirectUri() {
if (WorkOsAuthProvider.useOnboardingUri) {
const url = new URL(controlPlaneEnv.APP_URL);
url.pathname = `/onboarding/redirect/${env.uriScheme}`;
url.pathname = `/auth/${env.uriScheme}-redirect`;
return url.toString();
}
return this.ideRedirectUri;

View file

@ -72,7 +72,7 @@ export function ModeSelect() {
<div className="relative">
<ListboxButton
data-testid="mode-select-button"
className="xs:px-2 text-description gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110"
className="xs:px-2 text-description bg-lightgray/20 gap-1 rounded-full border-none px-1.5 py-0.5 transition-colors duration-200 hover:brightness-110"
>
<ModeIcon mode={mode} />
<span className="hidden sm:block">

View file

@ -1,12 +1,13 @@
import { ChevronRightIcon } from "@heroicons/react/24/outline";
import { useContext } from "react";
import { Button, ButtonSubtext } from "../../..";
import { ButtonSubtext } from "../../..";
import { useAuth } from "../../../../context/Auth";
import { IdeMessengerContext } from "../../../../context/IdeMessenger";
import { selectCurrentOrg } from "../../../../redux";
import { useAppSelector } from "../../../../redux/hooks";
import { hasPassedFTL } from "../../../../util/freeTrial";
import ContinueLogo from "../../../gui/ContinueLogo";
import { Button } from "../../../ui/Button";
import { useOnboardingCard } from "../../hooks";
export default function MainTab({
@ -22,7 +23,7 @@ export default function MainTab({
const currentOrg = useAppSelector(selectCurrentOrg);
function onGetStarted() {
auth.login(true).then((success) => {
void auth.login(true).then((success) => {
if (success) {
onboardingCard.close(isDialog);
}
@ -69,7 +70,7 @@ export default function MainTab({
onClick={onGetStarted}
className="mt-4 grid w-full grid-flow-col items-center gap-2"
>
Get started
Get started with Free Trial
</Button>
</>
) : (
@ -82,21 +83,21 @@ export default function MainTab({
onClick={onGetStarted}
className="mt-4 grid w-full grid-flow-col items-center gap-2"
>
Get started
Get started with Free Trial
</Button>
</>
)}
{onboardingCard.activeTab === "ExistingUserHubIntro" ? (
<ButtonSubtext onClick={() => onboardingCard.close(isDialog)}>
<div className="mt-4 flex cursor-pointer items-center justify-center gap-1">
<div className="mt-1 flex cursor-pointer items-center justify-center gap-1">
<span>Or, use Continue as usual</span>
<ChevronRightIcon className="h-3 w-3" />
</div>
</ButtonSubtext>
) : (
<ButtonSubtext onClick={onRemainLocal}>
<div className="flex cursor-pointer items-center justify-center gap-1 hover:brightness-125">
<div className="mt-1 flex cursor-pointer items-center justify-center gap-1 hover:brightness-125">
<span>Or, remain local</span>
<ChevronRightIcon className="h-3 w-3" />
</div>

View file

@ -1,5 +1,5 @@
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
import { fontSize } from "../util";
import { useFontSize } from "./ui/font";
export interface PageHeaderProps {
onTitleClick?: () => void;
@ -14,9 +14,11 @@ export function PageHeader({
rightContent,
showBorder,
}: PageHeaderProps) {
const fontSize = useFontSize(-1);
return (
<div
className={`bg-vsc-background sticky top-0 z-20 m-0 flex items-center justify-between bg-inherit ${
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"
: ""
@ -24,14 +26,14 @@ export function PageHeader({
>
{title ? (
<div
className="flex cursor-pointer items-center transition-colors duration-200 hover:text-zinc-100"
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-base font-bold"
className="mx-2 inline-block text-lg font-bold"
style={{
fontSize: fontSize(-2),
fontSize,
}}
>
{title}

View file

@ -1,7 +1,6 @@
import { useDispatch } from "react-redux";
import styled from "styled-components";
import { Button, SecondaryButton } from "..";
import { setDialogMessage, setShowDialog } from "../../redux/slices/uiSlice";
import { Button } from "../ui/Button";
interface ConfirmationDialogProps {
onConfirm: () => void;
@ -26,8 +25,8 @@ function ConfirmationDialog(props: ConfirmationDialogProps) {
<div className="w/1/2 flex justify-end gap-2">
{!!props.hideCancelButton || (
<SecondaryButton
className="text-lightgray"
<Button
variant="outline"
onClick={() => {
dispatch(setShowDialog(false));
dispatch(setDialogMessage(undefined));
@ -35,7 +34,7 @@ function ConfirmationDialog(props: ConfirmationDialogProps) {
}}
>
Cancel
</SecondaryButton>
</Button>
)}
<Button
onClick={() => {

View file

@ -69,7 +69,6 @@ export const SecondaryButton = styled.button`
export const GhostButton = styled.button`
padding: 6px 8px;
margin: 6px 0;
border-radius: ${defaultBorderRadius};
border: none;

View file

@ -0,0 +1,49 @@
import * as React from "react";
import { cn } from "../../util/cn";
import { FontSizeModifier, useFontSize } from "./font";
type ButtonVariant = "ghost" | "primary" | "secondary" | "outline";
type ButtonProps = React.ComponentProps<"button"> & {
variant?: ButtonVariant;
fontSizeModifier?: FontSizeModifier;
};
const buttonVariants = {
primary:
"px-3 py-1.5 border-none text-background bg-foreground hover:enabled:brightness-125",
secondary:
"px-3 py-1.5 border border-input-border text-foreground bg-input hover:enabled:bg-background hover:enabled:opacity-90",
outline:
"px-3 py-1.5 border-[0.5px] border-foreground text-foreground bg-transparent hover:enabled:bg-foreground/10",
ghost:
"px-2 py-1.5 border-none text-foreground bg-gray-500/40 hover:enabled:brightness-125",
};
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
({ variant = "primary", fontSizeModifier = 0, className, ...props }, ref) => {
const fontSize = useFontSize(fontSizeModifier);
return (
<button
ref={ref}
className={cn(
"my-1.5 cursor-pointer rounded transition-all duration-200",
"hover:enabled:cursor-pointer",
"disabled:text-description-muted disabled:pointer-events-none disabled:opacity-50",
buttonVariants[variant],
className,
)}
style={{
fontSize,
...props.style,
}}
{...props}
/>
);
},
);
Button.displayName = "Button";
export { Button };

View file

@ -21,7 +21,7 @@ const ListboxButton = React.forwardRef<HTMLButtonElement, ListboxButtonProps>(
ref={ref}
{...props}
className={cn(
"border-vsc-input-border bg-vsc-input-background text-vsc-foreground m-0 flex flex-1 cursor-pointer flex-row items-center gap-1 border border-solid px-1 py-0.5 text-left transition-colors duration-200",
"bg-vsc-input-background text-vsc-foreground border-border m-0 flex flex-1 cursor-pointer flex-row items-center gap-1 border border-solid px-1 py-0.5 text-left transition-colors duration-200",
props.className,
)}
style={{

View file

@ -1,13 +1,12 @@
import { UserCircleIcon } from "@heroicons/react/24/solid";
import { isOnPremSession } from "core/control-plane/AuthTypes";
import { SecondaryButton } from "../../components";
import {
Popover,
PopoverButton,
PopoverPanel,
Transition,
} from "../../components/ui";
import { Button } from "../../components/ui/Button";
import { useAuth } from "../../context/Auth";
import { selectCurrentOrg } from "../../redux";
import { useAppSelector } from "../../redux/hooks";
@ -19,12 +18,13 @@ export function AccountButton() {
if (!session) {
return (
<SecondaryButton
className="whitespace-nowrap"
<Button
variant="outline"
className="mb-1 whitespace-nowrap py-1"
onClick={() => login(false)}
>
Sign in
</SecondaryButton>
</Button>
);
}
@ -42,7 +42,7 @@ export function AccountButton() {
<span className="font-medium">
{selectedOrg === null ? "Personal" : selectedOrg.name}
</span>
<UserCircleIcon className="h-6 w-6" />{" "}
<UserCircleIcon className="h-6 w-6" />
</div>
</PopoverButton>
@ -65,9 +65,13 @@ export function AccountButton() {
</div>
)}
<SecondaryButton onClick={logout} className="!mx-0 w-full">
<Button
variant="ghost"
onClick={logout}
className="!mx-0 w-full"
>
Sign out
</SecondaryButton>
</Button>
</div>
</PopoverPanel>
</Transition>

View file

@ -11,7 +11,7 @@ interface KeyboardShortcutProps {
function KeyboardShortcut(props: KeyboardShortcutProps) {
return (
<div
className={`flex flex-col items-start p-2 py-2 sm:flex-row sm:items-center ${props.isEven ? "" : "bg-table-oddRow"}`}
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>
@ -132,8 +132,8 @@ function KeyboardShortcuts() {
}, []);
return (
<div className="h-full overflow-auto p-5">
<h3 className="mb-5 text-xl">Keyboard shortcuts</h3>
<div className="h-full overflow-auto">
<h3 className="mb-3 text-xl">Keyboard shortcuts</h3>
<div>
{shortcuts.map((shortcut, i) => {
return (