Skip to content

Commit d9145e2

Browse files
committed
ui feedback on assistant refresh
1 parent 8aded10 commit d9145e2

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

gui/src/components/modelSelection/platform/AssistantSelect.tsx

+8-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
ExclamationTriangleIcon,
88
PlusIcon,
99
} from "@heroicons/react/24/outline";
10-
import { useContext, useEffect, useMemo, useRef } from "react";
10+
import { useContext, useEffect, useMemo, useRef, useState } from "react";
1111
import { useAuth } from "../../../context/Auth";
1212
import { IdeMessengerContext } from "../../../context/IdeMessenger";
1313
import {
@@ -33,6 +33,7 @@ import {
3333
import { ProfileDescription } from "core/config/ConfigHandler";
3434
import { useNavigate } from "react-router-dom";
3535
import { vscCommandCenterInactiveBorder } from "../..";
36+
import { cn } from "../../../util/cn";
3637
import { ROUTES } from "../../../util/navigation";
3738
import { ToolTip } from "../../gui/Tooltip";
3839
import { useLump } from "../../mainInput/Lump/LumpContext";
@@ -165,6 +166,7 @@ export default function AssistantSelect() {
165166
const orgs = useAppSelector((store) => store.profiles.organizations);
166167
const ideMessenger = useContext(IdeMessengerContext);
167168
const { isToolbarExpanded } = useLump();
169+
const [loading, setLoading] = useState(false)
168170

169171
const { profiles, session, login } = useAuth();
170172
const navigate = useNavigate();
@@ -297,13 +299,15 @@ export default function AssistantSelect() {
297299
<span>Assistants</span>
298300
<div
299301
className="flex cursor-pointer flex-row items-center gap-1 hover:brightness-125"
300-
onClick={(e) => {
302+
onClick={async (e) => {
301303
e.stopPropagation();
302-
refreshProfiles();
304+
setLoading(true)
305+
await refreshProfiles()
306+
setLoading(false)
303307
buttonRef.current?.click();
304308
}}
305309
>
306-
<ArrowPathIcon className="text-lightgray h-2.5 w-2.5" />
310+
<ArrowPathIcon className={cn("text-lightgray h-2.5 w-2.5", loading && 'animate-spin')} />
307311
</div>
308312
</div>
309313

gui/src/context/Auth.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ interface AuthContextType {
2828
login: (useOnboarding: boolean) => Promise<boolean>;
2929
selectedProfile: ProfileDescription | null;
3030
profiles: ProfileDescription[] | null;
31-
refreshProfiles: () => void;
31+
refreshProfiles: () => Promise<void>;
3232
organizations: OrganizationDescription[];
3333
}
3434

0 commit comments

Comments
 (0)