Merge pull request #4998 from continuedev/pe/assistant-select-polish
feat: assistant select polish
This commit is contained in:
commit
bb15d088e4
2 changed files with 48 additions and 19 deletions
|
|
@ -10,7 +10,15 @@ export interface AssistantIconProps {
|
|||
export default function AssistantIcon({ assistant, size }: AssistantIconProps) {
|
||||
const sizeTw = size ?? 4;
|
||||
if (isLocalProfile(assistant)) {
|
||||
return <ComputerDesktopIcon className={`h-${sizeTw} w-${sizeTw}`} />;
|
||||
return (
|
||||
<div
|
||||
className={`h-${sizeTw} w-${sizeTw} bg-lightgray flex items-center justify-center rounded-full`}
|
||||
>
|
||||
<ComputerDesktopIcon
|
||||
className={`h-${sizeTw - 1} w-${sizeTw - 1} font-bold text-black`}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
} else if (assistant.iconUrl) {
|
||||
return (
|
||||
<img
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
import {
|
||||
ArrowTopRightOnSquareIcon,
|
||||
BuildingOfficeIcon,
|
||||
CheckIcon,
|
||||
ChevronDownIcon,
|
||||
Cog6ToothIcon,
|
||||
ExclamationTriangleIcon,
|
||||
|
|
@ -46,6 +45,8 @@ const AssistantSelectOption = ({
|
|||
selected,
|
||||
onClick,
|
||||
}: AssistantSelectOptionProps) => {
|
||||
const tinyFont = useFontSize(-4);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
const hasFatalErrors = useMemo(() => {
|
||||
|
|
@ -80,25 +81,30 @@ const AssistantSelectOption = ({
|
|||
disabled={hasFatalErrors}
|
||||
onClick={!hasFatalErrors ? handleOptionClick : undefined}
|
||||
fontSizeModifier={-2}
|
||||
className={selected ? "bg-list-active text-list-active-foreground" : ""}
|
||||
>
|
||||
<div className="flex w-full flex-col gap-0.5">
|
||||
<div className="flex w-full items-center justify-between">
|
||||
<div className="flex w-full items-center gap-2">
|
||||
<div className="mr-2 h-4 w-4 flex-shrink-0">
|
||||
<div
|
||||
className="flex w-full flex-col gap-0.5"
|
||||
style={{
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
<div className="flex w-full items-center justify-between bg-transparent">
|
||||
<div className="flex w-full items-center gap-1.5">
|
||||
<div className="flex h-4 w-4 flex-shrink-0">
|
||||
<AssistantIcon assistant={profile} />
|
||||
</div>
|
||||
<span
|
||||
className={`line-clamp-1 flex-1 ${selected ? "font-bold" : ""}`}
|
||||
className={`line-clamp-1 flex-1 ${selected ? "font-semibold" : ""}`}
|
||||
>
|
||||
{profile.title}
|
||||
</span>
|
||||
</div>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<div>{selected ? <CheckIcon className="h-3 w-3" /> : null}</div>
|
||||
<div className="flex flex-row items-center gap-1">
|
||||
{!profile.errors?.length ? (
|
||||
isLocalProfile(profile) ? (
|
||||
<Cog6ToothIcon
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
className="text-lightgray h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
|
@ -107,7 +113,7 @@ const AssistantSelectOption = ({
|
|||
/>
|
||||
) : (
|
||||
<ArrowTopRightOnSquareIcon
|
||||
className="h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
className="text-lightgray h-3 w-3 flex-shrink-0 cursor-pointer"
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
|
|
@ -238,9 +244,9 @@ export default function AssistantSelect() {
|
|||
</ListboxButton>
|
||||
|
||||
<Transition>
|
||||
<ListboxOptions className="pb-0">
|
||||
<ListboxOptions className="min-w-[200px] pb-0">
|
||||
<div
|
||||
className={`thin-scrollbar flex max-h-[300px] flex-col gap-1 overflow-y-auto py-1`}
|
||||
className={`thin-scrollbar flex max-h-[300px] flex-col overflow-y-auto`}
|
||||
>
|
||||
{profiles?.map((profile, idx) => {
|
||||
return (
|
||||
|
|
@ -267,8 +273,13 @@ export default function AssistantSelect() {
|
|||
fontSizeModifier={-2}
|
||||
onClick={session ? onNewAssistant : () => login(false)}
|
||||
>
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<PlusIcon className="h-4 w-4 flex-shrink-0" />
|
||||
<div
|
||||
className="text-lightgray flex flex-row items-center gap-2"
|
||||
style={{
|
||||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
<PlusIcon className="ml-0.5 h-3 w-3 flex-shrink-0" />
|
||||
New Assistant
|
||||
</div>
|
||||
</ListboxOption>
|
||||
|
|
@ -286,22 +297,32 @@ export default function AssistantSelect() {
|
|||
fontSize: tinyFont,
|
||||
}}
|
||||
>
|
||||
<span className="block">
|
||||
<span
|
||||
className="block"
|
||||
style={{
|
||||
fontSize: tinyFont - 1,
|
||||
}}
|
||||
>
|
||||
<code>{getMetaKeyLabel()} ⇧ '</code> to toggle
|
||||
</span>
|
||||
<div
|
||||
className="flex items-center gap-1"
|
||||
className="ml-auto flex items-center gap-1"
|
||||
onClick={() => navigate(ROUTES.CONFIG)}
|
||||
>
|
||||
{selectedOrganization?.iconUrl ? (
|
||||
<img
|
||||
src={selectedOrganization.iconUrl}
|
||||
className="h-4 w-4 rounded-full"
|
||||
className="h-3 w-3 rounded-full"
|
||||
/>
|
||||
) : (
|
||||
<BuildingOfficeIcon className="h-4 w-4" />
|
||||
)}
|
||||
<span className="hover:cursor-pointer hover:underline">
|
||||
<span
|
||||
className="hover:cursor-pointer hover:underline"
|
||||
style={{
|
||||
fontSize: tinyFont - 1,
|
||||
}}
|
||||
>
|
||||
{selectedOrganization?.name || "Personal"}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue