Changesets · Branches · Tags · Compare
| Changeset | 826666adffd2ca4fb4473480017d59ccafb1333684b478676d7e253d9ddb580e |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-07-03 19:06 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-07-03 19:06 -07:00 |
| Parents | c2565dc27945, c8c20a430667 |
8 files changed
added .continue/rules/migrate-styled-components-to-tailwind.md +5 −0
| @@ -0,0 +1,5 @@ | ||
| 1 | +--- | |
| 2 | +alwaysApply: false | |
| 3 | +--- | |
| 4 | + | |
| 5 | +Convert all of the styled components in this file into tailwind CSS. If a variable is used that is not already in @theme.ts and @tailwind.config.cjs, then you should figure out where it comes from and try adding that so it can be used. Wherever a function is called to interpolate a value, you can just use inline `styles={{ ... }}`. For ternaries, you could use @cn.ts. |
modified gui/src/components/AssistantAndOrgListbox/shared.tsx +76 −31
| @@ -6,11 +6,8 @@ | ||
| 6 | 6 | } from "@heroicons/react/24/outline"; |
| 7 | 7 | import { useState } from "react"; |
| 8 | 8 | import styled from "styled-components"; |
| 9 | -import { | |
| 10 | - defaultBorderRadius, | |
| 11 | - lightGray, | |
| 12 | - vscCommandCenterInactiveBorder, | |
| 13 | -} from ".."; | |
| 9 | +import { lightGray } from ".."; | |
| 10 | +import { cn } from "../../util/cn"; | |
| 14 | 11 | import { ToolTip } from "../gui/Tooltip"; |
| 15 | 12 | |
| 16 | 13 | export const OptionDiv = styled.div<{ |
| @@ -47,11 +44,6 @@ | ||
| 47 | 44 | |
| 48 | 45 | export const MAX_HEIGHT_PX = 300; |
| 49 | 46 | |
| 50 | -export const Divider = styled.div` | |
| 51 | - height: 0.5px; | |
| 52 | - background-color: ${vscCommandCenterInactiveBorder}; | |
| 53 | -`; | |
| 54 | - | |
| 55 | 47 | interface ModelOptionProps { |
| 56 | 48 | children: React.ReactNode; |
| 57 | 49 | idx: number; |
| @@ -64,28 +56,81 @@ | ||
| 64 | 56 | onClickError?: (e: any) => void; |
| 65 | 57 | } |
| 66 | 58 | |
| 67 | -const IconBase = styled.div<{ $hovered: boolean }>` | |
| 68 | - width: 1.2em; | |
| 69 | - height: 1.2em; | |
| 70 | - cursor: pointer; | |
| 71 | - padding: 4px; | |
| 72 | - border-radius: ${defaultBorderRadius}; | |
| 73 | - opacity: ${(props) => (props.$hovered ? 0.75 : 0)}; | |
| 74 | - visibility: ${(props) => (props.$hovered ? "visible" : "hidden")}; | |
| 75 | - | |
| 76 | - &:hover { | |
| 77 | - opacity: 1; | |
| 78 | - background-color: ${lightGray}33; | |
| 79 | - } | |
| 80 | -`; | |
| 59 | +interface IconBaseProps { | |
| 60 | + $hovered: boolean; | |
| 61 | + onClick?: (e: any) => void; | |
| 62 | + className?: string; | |
| 63 | + children?: React.ReactNode; | |
| 64 | + [key: string]: any; | |
| 65 | +} | |
| 66 | + | |
| 67 | +function IconBase({ | |
| 68 | + $hovered, | |
| 69 | + onClick, | |
| 70 | + className, | |
| 71 | + children, | |
| 72 | + ...props | |
| 73 | +}: IconBaseProps) { | |
| 74 | + return ( | |
| 75 | + <div | |
| 76 | + className={cn( | |
| 77 | + "rounded-default h-[1.2em] w-[1.2em] cursor-pointer p-1", | |
| 78 | + $hovered ? "visible opacity-75" : "invisible opacity-0", | |
| 79 | + "hover:bg-lightgray/20 hover:opacity-100", | |
| 80 | + className, | |
| 81 | + )} | |
| 82 | + onClick={onClick} | |
| 83 | + {...props} | |
| 84 | + > | |
| 85 | + {children} | |
| 86 | + </div> | |
| 87 | + ); | |
| 88 | +} | |
| 81 | 89 | |
| 82 | -const StyledCog6ToothIcon = styled(IconBase).attrs({ as: Cog6ToothIcon })``; | |
| 83 | -const StyledArrowTopRightOnSquareIcon = styled(IconBase).attrs({ | |
| 84 | - as: ArrowTopRightOnSquareIcon, | |
| 85 | -})``; | |
| 86 | -const StyledExclamationTriangleIcon = styled(IconBase).attrs({ | |
| 87 | - as: ExclamationTriangleIcon, | |
| 88 | -})``; | |
| 90 | +const StyledCog6ToothIcon = ({ | |
| 91 | + $hovered, | |
| 92 | + onClick, | |
| 93 | +}: { | |
| 94 | + $hovered: boolean; | |
| 95 | + onClick?: (e: any) => void; | |
| 96 | +}) => ( | |
| 97 | + <IconBase $hovered={$hovered} onClick={onClick}> | |
| 98 | + <Cog6ToothIcon /> | |
| 99 | + </IconBase> | |
| 100 | +); | |
| 101 | + | |
| 102 | +const StyledArrowTopRightOnSquareIcon = ({ | |
| 103 | + $hovered, | |
| 104 | + onClick, | |
| 105 | +}: { | |
| 106 | + $hovered: boolean; | |
| 107 | + onClick?: (e: any) => void; | |
| 108 | +}) => ( | |
| 109 | + <IconBase $hovered={$hovered} onClick={onClick}> | |
| 110 | + <ArrowTopRightOnSquareIcon /> | |
| 111 | + </IconBase> | |
| 112 | +); | |
| 113 | + | |
| 114 | +const StyledExclamationTriangleIcon = ({ | |
| 115 | + $hovered, | |
| 116 | + onClick, | |
| 117 | + className, | |
| 118 | + ...props | |
| 119 | +}: { | |
| 120 | + $hovered: boolean; | |
| 121 | + onClick?: (e: any) => void; | |
| 122 | + className?: string; | |
| 123 | + [key: string]: any; | |
| 124 | +}) => ( | |
| 125 | + <IconBase | |
| 126 | + $hovered={$hovered} | |
| 127 | + onClick={onClick} | |
| 128 | + className={className} | |
| 129 | + {...props} | |
| 130 | + > | |
| 131 | + <ExclamationTriangleIcon /> | |
| 132 | + </IconBase> | |
| 133 | +); | |
| 89 | 134 | |
| 90 | 135 | export function Option({ |
| 91 | 136 | children, |
deleted gui/src/components/Footer.tsx +0 −21
| @@ -1,21 +0,0 @@ | ||
| 1 | -import { useAppSelector } from "../redux/hooks"; | |
| 2 | -import { selectSelectedChatModel } from "../redux/slices/configSlice"; | |
| 3 | - | |
| 4 | -function Footer() { | |
| 5 | - const defaultModel = useAppSelector(selectSelectedChatModel); | |
| 6 | - | |
| 7 | - // TODO hook hub up to free trial | |
| 8 | - // if (defaultModel?.provider === "free-trial") { | |
| 9 | - // return ( | |
| 10 | - // <footer className="flex flex-col border-0 border-t border-solid border-t-zinc-700 px-2 py-2"> | |
| 11 | - // <FreeTrialProgressBar | |
| 12 | - // completed={getLocalStorage("ftc") ?? 0} | |
| 13 | - // total={FREE_TRIAL_LIMIT_REQUESTS} | |
| 14 | - // /> | |
| 15 | - // </footer> | |
| 16 | - // ); | |
| 17 | - // } | |
| 18 | - return null; | |
| 19 | -} | |
| 20 | - | |
| 21 | -export default Footer; |
modified gui/src/components/Layout.tsx +0 −2
| @@ -17,7 +17,6 @@ | ||
| 17 | 17 | import { ROUTES } from "../util/navigation"; |
| 18 | 18 | import { FatalErrorIndicator } from "./config/FatalErrorNotice"; |
| 19 | 19 | import TextDialog from "./dialogs"; |
| 20 | -import Footer from "./Footer"; | |
| 21 | 20 | import { GenerateRuleDialog } from "./GenerateRuleDialog"; |
| 22 | 21 | import { LumpProvider } from "./mainInput/Lump/LumpContext"; |
| 23 | 22 | import { useMainEditor } from "./mainInput/TipTapEditor"; |
| @@ -261,7 +260,6 @@ | ||
| 261 | 260 | <PostHogPageView /> |
| 262 | 261 | <Outlet /> |
| 263 | 262 | <FatalErrorIndicator /> |
| 264 | - <Footer /> | |
| 265 | 263 | </GridDiv> |
| 266 | 264 | </div> |
| 267 | 265 | <div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" /> |
modified gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/ToolbarButtonWithTooltip.tsx +6 −22
| @@ -1,25 +1,7 @@ | ||
| 1 | 1 | import { ReactNode, useMemo } from "react"; |
| 2 | 2 | import { Tooltip } from "react-tooltip"; |
| 3 | -import styled from "styled-components"; | |
| 4 | -import { lightGray, vscForeground } from "../.."; | |
| 5 | 3 | import { getFontSize } from "../../../util"; |
| 6 | 4 | |
| 7 | -export const ToolbarButton = styled.button` | |
| 8 | - display: flex; | |
| 9 | - align-items: center; | |
| 10 | - border: none; | |
| 11 | - outline: none; | |
| 12 | - background: transparent; | |
| 13 | - | |
| 14 | - color: ${vscForeground}; | |
| 15 | - font-size: ${getFontSize() - 2}px; | |
| 16 | - | |
| 17 | - &:hover { | |
| 18 | - cursor: pointer; | |
| 19 | - filter: brightness(1.25); | |
| 20 | - } | |
| 21 | -`; | |
| 22 | - | |
| 23 | 5 | interface ToolbarButtonWithTooltipProps { |
| 24 | 6 | onClick: () => void; |
| 25 | 7 | children: ReactNode; |
| @@ -40,15 +22,17 @@ | ||
| 40 | 22 | |
| 41 | 23 | return ( |
| 42 | 24 | <> |
| 43 | - <ToolbarButton | |
| 25 | + <button | |
| 44 | 26 | onClick={onClick} |
| 45 | - style={{ color: lightGray }} | |
| 27 | + style={{ | |
| 28 | + fontSize: `${getFontSize() - 2}px`, | |
| 29 | + }} | |
| 46 | 30 | data-tooltip-id={tooltipId} |
| 47 | 31 | data-testid={testId} |
| 48 | - className="px-0.5" | |
| 32 | + className="text-foreground flex items-center border-none bg-transparent px-0.5 outline-none hover:cursor-pointer hover:brightness-125" | |
| 49 | 33 | > |
| 50 | 34 | {children} |
| 51 | - </ToolbarButton> | |
| 35 | + </button> | |
| 52 | 36 | <Tooltip id={tooltipId} place="top"> |
| 53 | 37 | {tooltipContent} |
| 54 | 38 | </Tooltip> |
modified gui/src/components/StyledMarkdownPreview/StepContainerPreToolbar/index.tsx +8 −34
| @@ -1,12 +1,6 @@ | ||
| 1 | 1 | import { ChevronDownIcon } from "@heroicons/react/24/outline"; |
| 2 | 2 | import { inferResolvedUriFromRelativePath } from "core/util/ideUtils"; |
| 3 | 3 | import { useContext, useEffect, useMemo, useState } from "react"; |
| 4 | -import styled from "styled-components"; | |
| 5 | -import { | |
| 6 | - defaultBorderRadius, | |
| 7 | - vscCommandCenterInactiveBorder, | |
| 8 | - vscEditorBackground, | |
| 9 | -} from "../.."; | |
| 10 | 4 | import { IdeMessengerContext } from "../../../context/IdeMessenger"; |
| 11 | 5 | import { useIdeMessengerRequest } from "../../../hooks/useIdeMessengerRequest"; |
| 12 | 6 | import { useWebviewListener } from "../../../hooks/useWebviewListener"; |
| @@ -25,29 +19,6 @@ | ||
| 25 | 19 | import { InsertButton } from "./InsertButton"; |
| 26 | 20 | import { RunInTerminalButton } from "./RunInTerminalButton"; |
| 27 | 21 | |
| 28 | -const TopDiv = styled.div` | |
| 29 | - display: flex; | |
| 30 | - flex-direction: column; | |
| 31 | - outline: 1px solid ${vscCommandCenterInactiveBorder}; | |
| 32 | - outline-offset: -0.5px; | |
| 33 | - border-radius: ${defaultBorderRadius}; | |
| 34 | - margin-bottom: 8px !important; | |
| 35 | - margin-top: 8px !important; | |
| 36 | - background-color: ${vscEditorBackground}; | |
| 37 | - min-width: 0; | |
| 38 | -`; | |
| 39 | - | |
| 40 | -const ToolbarDiv = styled.div<{ isExpanded: boolean }>` | |
| 41 | - display: flex; | |
| 42 | - justify-content: space-between; | |
| 43 | - align-items: center; | |
| 44 | - font-size: ${getFontSize() - 2}px; | |
| 45 | - padding: 4px 6px; | |
| 46 | - margin: 0; | |
| 47 | - border-bottom: ${({ isExpanded }) => | |
| 48 | - isExpanded ? `1px solid ${vscCommandCenterInactiveBorder}` : "inherit"}; | |
| 49 | -`; | |
| 50 | - | |
| 51 | 22 | export interface StepContainerPreToolbarProps { |
| 52 | 23 | codeBlockContent: string; |
| 53 | 24 | language: string | null; |
| @@ -290,9 +261,12 @@ | ||
| 290 | 261 | } |
| 291 | 262 | |
| 292 | 263 | return ( |
| 293 | - <TopDiv> | |
| 294 | - <ToolbarDiv isExpanded={isExpanded} className="find-widget-skip gap-3"> | |
| 295 | - <div className="max-w-[50% flex flex-row items-center"> | |
| 264 | + <div className="outline-command-border -outline-offset-0.5 rounded-default bg-editor mb-2 mt-2 flex min-w-0 flex-col outline outline-1"> | |
| 265 | + <div | |
| 266 | + className={`find-widget-skip m-0 flex items-center justify-between gap-3 px-1.5 py-1 ${isExpanded ? "border-command-border border-b" : ""}`} | |
| 267 | + style={{ fontSize: `${getFontSize() - 2}px` }} | |
| 268 | + > | |
| 269 | + <div className="flex max-w-[50%] flex-row items-center"> | |
| 296 | 270 | <ChevronDownIcon |
| 297 | 271 | data-testid="toggle-codeblock" |
| 298 | 272 | onClick={() => setIsExpanded(!isExpanded)} |
| @@ -323,11 +297,11 @@ | ||
| 323 | 297 | |
| 324 | 298 | {renderActionButtons()} |
| 325 | 299 | </div> |
| 326 | - </ToolbarDiv> | |
| 300 | + </div> | |
| 327 | 301 | |
| 328 | 302 | {isExpanded && ( |
| 329 | 303 | <div className="overflow-hidden overflow-y-auto">{children}</div> |
| 330 | 304 | )} |
| 331 | - </TopDiv> | |
| 305 | + </div> | |
| 332 | 306 | ); |
| 333 | 307 | } |
modified gui/src/util/cn.ts +14 −0
| @@ -1,6 +1,20 @@ | ||
| 1 | 1 | import { clsx, type ClassValue } from "clsx"; |
| 2 | 2 | import { twMerge } from "tailwind-merge"; |
| 3 | 3 | |
| 4 | +/** | |
| 5 | + * Combines multiple class values and merges Tailwind CSS classes. | |
| 6 | + * | |
| 7 | + * This utility function combines the functionality of clsx (for conditional class names) | |
| 8 | + * and tailwind-merge (for intelligently merging Tailwind CSS classes, removing duplicates | |
| 9 | + * and conflicts). | |
| 10 | + * | |
| 11 | + * @param inputs - Class values that can be strings, objects, arrays, or conditional expressions | |
| 12 | + * @returns A merged string of class names with Tailwind conflicts resolved | |
| 13 | + * | |
| 14 | + * @example | |
| 15 | + * cn('px-2 py-1', 'px-4') // Returns 'py-1 px-4' (px-2 is overridden by px-4) | |
| 16 | + * cn('text-red-500', { 'text-blue-500': isActive }) // Conditionally applies classes | |
| 17 | + */ | |
| 4 | 18 | export function cn(...inputs: ClassValue[]) { |
| 5 | 19 | return twMerge(clsx(inputs)); |
| 6 | 20 | } |
modified gui/tailwind.config.cjs +3 −0
| @@ -29,6 +29,9 @@ | ||
| 29 | 29 | borderRadius: { |
| 30 | 30 | default: "0.5rem", |
| 31 | 31 | }, |
| 32 | + outlineOffset: { | |
| 33 | + 0.5: "0.5px", | |
| 34 | + }, | |
| 32 | 35 | colors: { |
| 33 | 36 | background: varWithFallback("background"), |
| 34 | 37 | foreground: varWithFallback("foreground"), |