fontSize function
This commit is contained in:
parent
bc5ec28633
commit
45bbb79aaa
15 changed files with 79 additions and 78 deletions
|
|
@ -16,24 +16,22 @@ export function ConversationStarterCard({
|
|||
|
||||
return (
|
||||
<div
|
||||
className="mb-2 w-full shadow-md hover:brightness-110"
|
||||
className="mb-2 w-full shadow-md hover:cursor-pointer hover:brightness-110"
|
||||
style={{
|
||||
borderRadius: defaultBorderRadius,
|
||||
backgroundColor: vscInputBackground,
|
||||
}}
|
||||
onMouseEnter={() => setIsHovered(true)}
|
||||
onMouseLeave={() => setIsHovered(false)}
|
||||
onClick={() => onClick(command)}
|
||||
>
|
||||
<div className="flex items-center px-3 py-1.5">
|
||||
<div className="mr-3 flex-shrink-0">
|
||||
<div className="flex px-3 py-1.5">
|
||||
<div className="mr-3 flex-shrink-0 self-start pt-0.5">
|
||||
<ChatBubbleLeftIcon className="text-lightgray h-5 w-5" />
|
||||
</div>
|
||||
<div
|
||||
onClick={() => onClick(command)}
|
||||
className="flex flex-1 flex-col hover:cursor-pointer"
|
||||
>
|
||||
<div className="font-medium">{command.name}</div>
|
||||
<div className="text-lightgray text-sm">{command.description}</div>
|
||||
<div className="flex flex-1 flex-col">
|
||||
<div className="text-xs font-medium">{command.name}</div>
|
||||
<div className="text-lightgray text-xs">{command.description}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
import { setShowDialog } from "../redux/slices/uiSlice";
|
||||
import { exitEditMode } from "../redux/thunks";
|
||||
import { loadLastSession, saveCurrentSession } from "../redux/thunks/session";
|
||||
import { getFontSize, isMetaEquivalentKeyPressed } from "../util";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../util";
|
||||
import { incrementFreeTrialCount } from "../util/freeTrial";
|
||||
import { ROUTES } from "../util/navigation";
|
||||
import TextDialog from "./dialogs";
|
||||
|
|
@ -305,10 +305,7 @@ const Layout = () => {
|
|||
<Footer />
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div
|
||||
style={{ fontSize: `${getFontSize() - 4}px` }}
|
||||
id="tooltip-portal-div"
|
||||
/>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
</AuthProvider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import { getFontSize } from "../util";
|
||||
import { fontSize } from "../util";
|
||||
|
||||
export interface PageHeaderProps {
|
||||
onTitleClick?: () => void;
|
||||
|
|
@ -33,7 +33,7 @@ export default function PageHeader({
|
|||
<span
|
||||
className="mx-2 inline-block text-base font-bold"
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 2}px`,
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import ReactDOM from "react-dom";
|
||||
import { Tooltip } from "react-tooltip";
|
||||
import { vscBackground, vscForeground, vscInputBorder } from "..";
|
||||
import { getFontSize } from "../../util";
|
||||
import { fontSize } from "../../util";
|
||||
|
||||
const TooltipStyles = {
|
||||
fontSize: `${getFontSize() - 2}px`,
|
||||
fontSize: fontSize(-2),
|
||||
backgroundColor: vscBackground,
|
||||
outline: `0.5px solid ${vscInputBorder}`,
|
||||
color: vscForeground,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { toggleToolGroupSetting } from "../../../redux/slices/uiSlice";
|
|||
import ToggleSwitch from "../../gui/Switch";
|
||||
import ToolDropdownItem from "./ToolDropdownItem";
|
||||
|
||||
const ToolPermissionsDialog = () => {
|
||||
export const ToolPermissionsDialog = () => {
|
||||
const availableTools = useAppSelector((state) => state.config.config.tools);
|
||||
const toolGroupSettings = useAppSelector(
|
||||
(store) => store.ui.toolGroupSettings,
|
||||
|
|
@ -38,32 +38,34 @@ const ToolPermissionsDialog = () => {
|
|||
);
|
||||
}, [availableTools]);
|
||||
|
||||
return toolsByGroup.map(([groupName, tools]) => (
|
||||
<div key={groupName} className="mt-2 flex flex-col">
|
||||
<div className="mb-1 flex flex-row items-center justify-between px-1">
|
||||
<h3 className="m-0 p-0 text-xs font-bold">{groupName}</h3>
|
||||
<ToggleSwitch
|
||||
isToggled={toolGroupSettings[groupName] !== "exclude"}
|
||||
onToggle={() => dispatch(toggleToolGroupSetting(groupName))}
|
||||
text=""
|
||||
size={12}
|
||||
/>
|
||||
</div>
|
||||
<div className="relative flex flex-col p-1">
|
||||
{tools.map((tool) => (
|
||||
<ToolDropdownItem
|
||||
key={tool.uri + tool.function.name}
|
||||
tool={tool}
|
||||
duplicatesDetected={duplicateDetection[tool.function.name]}
|
||||
excluded={toolGroupSettings[groupName] === "exclude"}
|
||||
/>
|
||||
))}
|
||||
{toolGroupSettings[groupName] === "exclude" && (
|
||||
<div className="absolute right-0 top-0 h-full w-full cursor-not-allowed"></div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
));
|
||||
return (
|
||||
<>
|
||||
{toolsByGroup.map(([groupName, tools]) => (
|
||||
<div key={groupName} className="mt-2 flex flex-col">
|
||||
<div className="mb-1 flex flex-row items-center justify-between px-1">
|
||||
<h3 className="m-0 p-0 text-xs font-bold">{groupName}</h3>
|
||||
<ToggleSwitch
|
||||
isToggled={toolGroupSettings[groupName] !== "exclude"}
|
||||
onToggle={() => dispatch(toggleToolGroupSetting(groupName))}
|
||||
text=""
|
||||
size={12}
|
||||
/>
|
||||
</div>
|
||||
<div className="relative flex flex-col p-1">
|
||||
{tools.map((tool) => (
|
||||
<ToolDropdownItem
|
||||
key={tool.uri + tool.function.name}
|
||||
tool={tool}
|
||||
duplicatesDetected={duplicateDetection[tool.function.name]}
|
||||
excluded={toolGroupSettings[groupName] === "exclude"}
|
||||
/>
|
||||
))}
|
||||
{toolGroupSettings[groupName] === "exclude" && (
|
||||
<div className="absolute right-0 top-0 h-full w-full cursor-not-allowed"></div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default ToolPermissionsDialog;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {
|
|||
WrenchScrewdriverIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { vscBadgeBackground, vscBadgeForeground } from "../..";
|
||||
import { getFontSize } from "../../../util";
|
||||
import { fontSize } from "../../../util";
|
||||
import AssistantSelect from "../../modelSelection/platform/AssistantSelect";
|
||||
import HoverItem from "../InputToolbar/HoverItem";
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ function TopToolbarIcon(props: TopToolbarIconProps) {
|
|||
aria-hidden="true"
|
||||
/>
|
||||
<div
|
||||
style={{ fontSize: `${getFontSize() - 3}px` }}
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
className={`overflow-hidden transition-all duration-200 ${
|
||||
props.isSelected ? "ml-1 w-auto opacity-100" : "w-0 opacity-0"
|
||||
}`}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import {
|
|||
PencilIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { BookmarkIcon as BookmarkSolid } from "@heroicons/react/24/solid";
|
||||
import { getFontSize } from "../../../../util";
|
||||
import { fontSize } from "../../../../util";
|
||||
import { useBookmarkedSlashCommands } from "../../../ConversationStarters/useBookmarkedSlashCommands";
|
||||
|
||||
interface PromptRowProps {
|
||||
|
|
@ -25,7 +25,7 @@ function PromptRow({
|
|||
<div
|
||||
className="flex items-center justify-between"
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 3}px`,
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
>
|
||||
<div className="flex min-w-0 gap-2">
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import ToolPermissionsDialog from "../../InputToolbar/ToolPermissionsDialog";
|
||||
import { ToolPermissionsDialog } from "../../InputToolbar/ToolPermissionsDialog";
|
||||
|
||||
interface ToolsSectionProps {}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import {
|
|||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../../../../redux/slices/uiSlice";
|
||||
import { getFontSize } from "../../../../../util";
|
||||
import { fontSize } from "../../../../../util";
|
||||
import ConfirmationDialog from "../../../../dialogs/ConfirmationDialog";
|
||||
import { StatusIndicator } from "./StatusIndicator";
|
||||
interface IndexingStatusViewerProps {
|
||||
|
|
@ -134,7 +134,7 @@ function DocsIndexingStatus({
|
|||
) : null}
|
||||
<p
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 3}px`,
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
className={`lines lines-1 m-0 p-0 text-left ${status?.url ? "cursor-pointer hover:underline" : ""}`}
|
||||
>
|
||||
|
|
@ -149,7 +149,7 @@ function DocsIndexingStatus({
|
|||
<span
|
||||
className="text-xs"
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 3}px`,
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
>
|
||||
{progressPercentage}%
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import {
|
|||
setDialogMessage,
|
||||
setShowDialog,
|
||||
} from "../../../../../redux/slices/uiSlice";
|
||||
import { getFontSize } from "../../../../../util";
|
||||
import { fontSize } from "../../../../../util";
|
||||
import AddDocsDialog from "../../../../dialogs/AddDocsDialog";
|
||||
import DocsIndexingStatus from "./DocsIndexingStatus";
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ function DocsIndexingStatuses() {
|
|||
<div
|
||||
className="cursor-pointer rounded px-2 pb-1 text-center text-gray-400 hover:text-gray-300"
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 3}px`,
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import {
|
|||
selectCurrentMode,
|
||||
setMode,
|
||||
} from "../../redux/slices/sessionSlice";
|
||||
import { getFontSize, getMetaKeyLabel } from "../../util";
|
||||
import { fontSize, getFontSize, getMetaKeyLabel } from "../../util";
|
||||
|
||||
const StyledListboxButton = styled(Listbox.Button)`
|
||||
font-family: inherit;
|
||||
|
|
@ -97,8 +97,8 @@ function ModeSelect() {
|
|||
return (
|
||||
<Listbox
|
||||
value={mode}
|
||||
onChange={() => {
|
||||
dispatch(setMode(mode));
|
||||
onChange={(newMode) => {
|
||||
dispatch(setMode(newMode));
|
||||
}}
|
||||
>
|
||||
<div className="relative">
|
||||
|
|
@ -116,7 +116,7 @@ function ModeSelect() {
|
|||
{getModeIcon(mode)}
|
||||
<span>{mode.charAt(0).toUpperCase() + mode.slice(1)}</span>
|
||||
<ChevronDownIcon
|
||||
className="h-3 w-3 flex-shrink-0"
|
||||
className="h-2 w-2 flex-shrink-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
</div>
|
||||
|
|
@ -124,26 +124,26 @@ function ModeSelect() {
|
|||
<StyledListboxOptions
|
||||
className="z-50"
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 3}px`,
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
>
|
||||
<StyledListboxOption value="Agent">
|
||||
<StyledListboxOption value="agent">
|
||||
<SparklesIcon className="h-3 w-3" />
|
||||
<span>Agent</span>
|
||||
{/* <ShortcutText></ShortcutText> */}
|
||||
{mode === "agent" && <CheckIcon className="ml-2 h-3 w-3" />}
|
||||
{mode === "agent" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
<StyledListboxOption value="Chat">
|
||||
<StyledListboxOption value="chat">
|
||||
<ChatBubbleLeftIcon className="h-3 w-3" />
|
||||
<span>Chat</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}L</ShortcutText>
|
||||
{mode === "chat" && <CheckIcon className="ml-2 h-3 w-3" />}
|
||||
{mode === "chat" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
<StyledListboxOption value="Edit">
|
||||
<StyledListboxOption value="edit">
|
||||
<PencilIcon className="h-3 w-3" />
|
||||
<span>Edit</span>
|
||||
<ShortcutText>{getMetaKeyLabel()}I</ShortcutText>
|
||||
{mode === "edit" && <CheckIcon className="ml-2 h-3 w-3" />}
|
||||
{mode === "edit" && <CheckIcon className="ml-auto h-3 w-3" />}
|
||||
</StyledListboxOption>
|
||||
<div className="text-lightgray px-2 py-1">
|
||||
{getMetaKeyLabel()}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { useAuth } from "../../../context/Auth";
|
|||
import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
||||
import { cycleProfile } from "../../../redux";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { getFontSize, isMetaEquivalentKeyPressed } from "../../../util";
|
||||
import { fontSize, isMetaEquivalentKeyPressed } from "../../../util";
|
||||
import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
import { AssistantSelectOptions } from "./AssistantSelectOptions";
|
||||
|
|
@ -69,7 +69,7 @@ export default function AssistantSelect() {
|
|||
});
|
||||
}}
|
||||
className="hover:bg flex cursor-pointer select-none items-center gap-1 whitespace-nowrap text-gray-400"
|
||||
style={{ fontSize: `${getFontSize() - 3}px` }}
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<PlusIcon className="h-3 w-3 select-none" /> Create your first assistant
|
||||
</div>
|
||||
|
|
@ -83,7 +83,7 @@ export default function AssistantSelect() {
|
|||
data-testid="assistant-select-button"
|
||||
ref={buttonRef}
|
||||
className="mt-0.5 cursor-pointer border-none bg-transparent text-gray-400 hover:brightness-125"
|
||||
style={{ fontSize: `${getFontSize() - 3}px` }}
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
<AssistantSelectButton selectedProfile={selectedProfile} />
|
||||
</Popover.Button>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { Fragment } from "react";
|
|||
import { defaultBorderRadius } from "../../components";
|
||||
import { ToolTip } from "../../components/gui/Tooltip";
|
||||
import InfoHover from "../../components/InfoHover";
|
||||
import { getFontSize } from "../../util";
|
||||
import { fontSize } from "../../util";
|
||||
|
||||
interface ModelRoleSelectorProps {
|
||||
models: ModelDescription[];
|
||||
|
|
@ -31,7 +31,7 @@ const ModelRoleSelector = ({
|
|||
<div className="mt-2 flex flex-row items-center gap-1 sm:mt-0">
|
||||
<span
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 3}px`,
|
||||
fontSize: fontSize(-3),
|
||||
}}
|
||||
>
|
||||
{displayName}
|
||||
|
|
@ -51,12 +51,12 @@ const ModelRoleSelector = ({
|
|||
{models.length === 0 ? (
|
||||
<span
|
||||
className="text-lightgray lines lines-1 italic"
|
||||
style={{ fontSize: `${getFontSize() - 3}px` }}
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>{`No ${displayName} models${["Chat", "Apply", "Edit"].includes(displayName) ? ". Using chat model" : ""}`}</span>
|
||||
) : (
|
||||
<span
|
||||
className="lines lines-1"
|
||||
style={{ fontSize: `${getFontSize() - 3}px` }}
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{selectedModel?.title ?? `Select ${displayName} model`}
|
||||
</span>
|
||||
|
|
@ -90,7 +90,7 @@ const ModelRoleSelector = ({
|
|||
>
|
||||
<span
|
||||
className="lines lines-1 relative flex h-4 items-center gap-2"
|
||||
style={{ fontSize: `${getFontSize() - 3}px` }}
|
||||
style={{ fontSize: fontSize(-3) }}
|
||||
>
|
||||
{option.title}
|
||||
</span>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { useState } from "react";
|
|||
import { useNavigate } from "react-router-dom";
|
||||
import PageHeader from "../../components/PageHeader";
|
||||
import { useNavigationListener } from "../../hooks/useNavigationListener";
|
||||
import { getFontSize } from "../../util";
|
||||
import { fontSize } from "../../util";
|
||||
import { AccountButton } from "./AccountButton";
|
||||
import { HelpCenterSection } from "./HelpCenterSection";
|
||||
import { IndexingSettingsSection } from "./IndexingSettingsSection";
|
||||
|
|
@ -69,7 +69,7 @@ function ConfigPage() {
|
|||
{tabs.map((tab) => (
|
||||
<div
|
||||
style={{
|
||||
fontSize: `${getFontSize() - 2}px`,
|
||||
fontSize: fontSize(-2),
|
||||
}}
|
||||
key={tab.id}
|
||||
className={`hover:bg-vsc-input-background flex cursor-pointer items-center justify-center gap-2 rounded-md px-4 py-2 ${
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ export function getFontSize(): number {
|
|||
return getLocalStorage("fontSize") ?? (isJetBrains() ? 15 : 14);
|
||||
}
|
||||
|
||||
export function fontSize(n: number): string {
|
||||
return `${getFontSize() + n}px`;
|
||||
}
|
||||
|
||||
export function isJetBrains() {
|
||||
return getLocalStorage("ide") === "jetbrains";
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue