styling
This commit is contained in:
parent
b705971b51
commit
32ecdce887
6 changed files with 30 additions and 30 deletions
|
|
@ -4,24 +4,19 @@ import {
|
|||
ChevronUpDownIcon,
|
||||
CubeIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { Dispatch, Fragment, SetStateAction } from "react";
|
||||
import { Fragment } from "react";
|
||||
import { Listbox } from "@headlessui/react";
|
||||
import styled from "styled-components";
|
||||
import {
|
||||
defaultBorderRadius,
|
||||
lightGray,
|
||||
vscBackground,
|
||||
vscButtonBackground,
|
||||
vscForeground,
|
||||
vscInputBackground,
|
||||
vscListActiveBackground,
|
||||
vscListActiveForeground,
|
||||
} from "..";
|
||||
import {
|
||||
DisplayInfo,
|
||||
ModelPackage,
|
||||
} from "../../pages/AddNewModel/configs/models";
|
||||
import { ProviderInfo } from "../../pages/AddNewModel/configs/providers";
|
||||
import { DisplayInfo } from "../../pages/AddNewModel/configs/models";
|
||||
|
||||
export const StyledListbox = styled(Listbox)`
|
||||
background-color: ${vscBackground};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { ChevronDownIcon } from "@heroicons/react/24/outline";
|
|||
import { useEffect, useRef } from "react";
|
||||
import { useAuth } from "../../../context/Auth";
|
||||
import { useAppDispatch } from "../../../redux/hooks";
|
||||
import { cycleProfile } from "../../../redux/thunks/cycleProfile";
|
||||
import {
|
||||
getFontSize,
|
||||
isLocalProfile,
|
||||
|
|
@ -13,15 +12,13 @@ import PopoverTransition from "../../mainInput/InputToolbar/PopoverTransition";
|
|||
import { AssistantSelectOptions } from "./AssistantSelectOptions";
|
||||
import AssistantIcon from "./AssistantIcon";
|
||||
import { getProfileDisplayText } from "./utils";
|
||||
import { cycleProfile } from "../../../redux/thunks/profileAndOrg";
|
||||
|
||||
export default function AssistantSelect() {
|
||||
const dispatch = useAppDispatch();
|
||||
const buttonRef = useRef<HTMLButtonElement>(null);
|
||||
const { selectedProfile } = useAuth();
|
||||
|
||||
const isLocalProfileSelected =
|
||||
selectedProfile && isLocalProfile(selectedProfile);
|
||||
|
||||
useEffect(() => {
|
||||
let lastToggleTime = 0;
|
||||
const DEBOUNCE_MS = 500;
|
||||
|
|
@ -57,7 +54,7 @@ export default function AssistantSelect() {
|
|||
<Popover.Button
|
||||
data-testid="assistant-select-button"
|
||||
ref={buttonRef}
|
||||
className="text-lightgray cursor-pointer border-none bg-transparent text-gray-500 hover:brightness-125"
|
||||
className="text-lightgray cursor-pointer border-none bg-transparent hover:brightness-125"
|
||||
style={{ fontSize: `${getFontSize() - 2}px` }}
|
||||
>
|
||||
<div className="flex max-w-[50vw] items-center gap-0.5">
|
||||
|
|
|
|||
|
|
@ -144,13 +144,13 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||
.request("controlPlane/listOrganizations", undefined)
|
||||
.then((result) => {
|
||||
if (result.status === "success") {
|
||||
updateOrgsThunk(result.content);
|
||||
dispatch(updateOrgsThunk(result.content));
|
||||
} else {
|
||||
updateOrgsThunk([]);
|
||||
dispatch(updateOrgsThunk([]));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updateOrgsThunk([]);
|
||||
dispatch(updateOrgsThunk([]));
|
||||
}
|
||||
}, [session]);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { Listbox } from "@headlessui/react";
|
||||
import {
|
||||
BuildingOfficeIcon,
|
||||
ChevronDownIcon,
|
||||
ChevronUpDownIcon,
|
||||
UserCircleIcon,
|
||||
} from "@heroicons/react/24/outline";
|
||||
import { useAuth } from "../../context/Auth";
|
||||
|
|
@ -31,7 +31,7 @@ export function ScopeSelect() {
|
|||
return (
|
||||
<Listbox value={selectedOrgId} onChange={handleChange}>
|
||||
<div className="relative">
|
||||
<Listbox.Button className="border-vsc-input-border text-vsc-foreground hover:bg-vsc-background bg-vsc-input-background flex w-full max-w-[400px] cursor-pointer items-center gap-0.5 rounded border border-solid p-2 hover:opacity-90">
|
||||
<Listbox.Button className="border-vsc-input-border hover:bg-vsc-input-background text-vsc-foreground bg-vsc-background flex w-full max-w-[400px] cursor-pointer items-center gap-0.5 rounded border border-solid p-2 hover:opacity-90">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex items-center gap-2">
|
||||
{selectedDisplay?.iconUrl ? (
|
||||
|
|
@ -43,7 +43,7 @@ export function ScopeSelect() {
|
|||
{selectedDisplay?.name || "Select Organization"}
|
||||
</span>
|
||||
</div>
|
||||
<ChevronDownIcon className="h-4 w-4" aria-hidden="true" />
|
||||
<ChevronUpDownIcon className="h-5 w-5" aria-hidden="true" />
|
||||
</div>
|
||||
</Listbox.Button>
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ export function ScopeSelect() {
|
|||
<Listbox.Option
|
||||
key={org.id}
|
||||
value={org.id}
|
||||
className="text-vsc-foreground hover:bg-lightgray/20 cursor-pointer rounded p-2 hover:opacity-90"
|
||||
className="text-vsc-foreground hover:bg-list-active cursor-pointer rounded p-2 text-sm hover:opacity-90"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
{org.iconUrl ? (
|
||||
|
|
@ -76,7 +76,7 @@ export function ScopeSelect() {
|
|||
|
||||
<Listbox.Option
|
||||
value={null}
|
||||
className="text-vsc-foreground hover:bg-lightgray/20 cursor-pointer rounded p-2 hover:opacity-90"
|
||||
className="text-vsc-foreground hover:bg-list-active cursor-pointer rounded p-2 hover:opacity-90"
|
||||
>
|
||||
<div className="flex items-center gap-2">
|
||||
<UserCircleIcon className="h-5 w-5" />
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { useAuth } from "../../context/Auth";
|
|||
import { ScopeSelect } from "./ScopeSelect";
|
||||
import UserSettingsUI from "./UserSettings";
|
||||
import { Listbox, Transition } from "@headlessui/react";
|
||||
import { ChevronUpDownIcon } from "@heroicons/react/24/outline";
|
||||
import { ChevronUpDownIcon, PlusCircleIcon } from "@heroicons/react/24/outline";
|
||||
import { selectProfileThunk } from "../../redux/thunks/profileAndOrg";
|
||||
|
||||
function ConfigPage() {
|
||||
|
|
@ -25,8 +25,8 @@ function ConfigPage() {
|
|||
profiles,
|
||||
selectedProfile,
|
||||
controlServerBetaEnabled,
|
||||
selectedOrganization,
|
||||
} = useAuth();
|
||||
// const profiles = [];
|
||||
|
||||
const changeProfileId = (id: string) => {
|
||||
dispatch(selectProfileThunk(id));
|
||||
|
|
@ -102,7 +102,7 @@ function ConfigPage() {
|
|||
<div className="relative w-full">
|
||||
<Listbox.Button className="border-vsc-input-border bg-vsc-background hover:bg-vsc-input-background text-vsc-foreground relative m-0 flex w-full cursor-pointer items-center justify-between rounded-md border border-solid px-3 py-2 text-left">
|
||||
<span className="lines lines-1">
|
||||
{selectedProfile?.title}
|
||||
{selectedProfile?.title ?? "No Assistant Selected"}
|
||||
</span>
|
||||
<div className="pointer-events-none flex items-center">
|
||||
<ChevronUpDownIcon
|
||||
|
|
@ -127,21 +127,28 @@ function ConfigPage() {
|
|||
<Listbox.Option
|
||||
key={idx}
|
||||
value={option.id}
|
||||
className={`text-vsc-foreground hover:text-vsc-list-active-foreground flex cursor-pointer flex-row items-center gap-3 px-3 py-2 ${selectedProfile?.id === option.id ? "bg-vsc-list-active-background" : "bg-vsc-input-background"}`}
|
||||
className={`text-vsc-foreground hover:text-list-active-foreground flex cursor-pointer flex-row items-center gap-3 px-3 py-2 ${selectedProfile?.id === option.id ? "bg-list-active" : "bg-vsc-input-background"}`}
|
||||
>
|
||||
<span className="lines lines-1 relative flex h-5 items-center justify-between gap-3 pr-2 text-xs">
|
||||
{option.title}
|
||||
</span>
|
||||
</Listbox.Option>
|
||||
))}
|
||||
{profiles.length === 0 && (
|
||||
{hubEnabled && (
|
||||
<Listbox.Option
|
||||
key={"no-profiles"}
|
||||
value={undefined}
|
||||
className={`text-vsc-foreground hover:text-vsc-list-active-foreground flex cursor-pointer flex-row items-center gap-3 px-3 py-2 ${selectedProfile?.id === undefined ? "bg-vsc-list-active-background" : "bg-vsc-input-background"}`}
|
||||
value={null}
|
||||
className={`text-vsc-foreground hover:bg-list-active bg-vsc-input-background flex cursor-pointer flex-row items-center gap-2 px-3 py-2`}
|
||||
onClick={() => {
|
||||
ideMessenger.post("controlPlane/openUrl", {
|
||||
path: "new",
|
||||
orgSlug: selectedOrganization?.slug,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<span className="lines lines-1 relative flex h-5 items-center justify-between gap-3 pr-2 text-xs italic">
|
||||
No profiles found
|
||||
<PlusCircleIcon className="h-4 w-4" />
|
||||
<span className="lines lines-1 flex items-center justify-between text-xs">
|
||||
Create new Assistant
|
||||
</span>
|
||||
</Listbox.Option>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ export const selectOrgThunk = createAsyncThunk<
|
|||
// Fallback to Personal (org = null)
|
||||
|
||||
if (initialId !== newId) {
|
||||
dispatch(setAvailableProfiles([]));
|
||||
dispatch(setSelectedOrganizationId(newId));
|
||||
extra.ideMessenger.post("didChangeSelectedOrg", {
|
||||
id: newId,
|
||||
|
|
@ -117,7 +118,7 @@ export const updateOrgsThunk = createAsyncThunk<
|
|||
void,
|
||||
OrganizationDescription[],
|
||||
ThunkApiType
|
||||
>("session/updateOrgs", async (orgs, { dispatch, extra, getState }) => {
|
||||
>("session/updateOrgs", async (orgs, { dispatch, getState }) => {
|
||||
const state = getState();
|
||||
dispatch(setOrganizations(orgs));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue