Skip to content

Commit 364149b

Browse files
Merge pull request #5269 from uinstinct/assistant-refresh-feedback
ui feedback on assistant refresh
2 parents ff63c8c + 42d1241 commit 364149b

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 { useLump } from "../../mainInput/Lump/LumpContext";
3839
import { useFontSize } from "../../ui/font";
@@ -157,6 +158,7 @@ export default function AssistantSelect() {
157158
const orgs = useAppSelector((store) => store.profiles.organizations);
158159
const ideMessenger = useContext(IdeMessengerContext);
159160
const { isToolbarExpanded } = useLump();
161+
const [loading, setLoading] = useState(false)
160162

161163
const { profiles, session, login } = useAuth();
162164
const navigate = useNavigate();
@@ -289,13 +291,15 @@ export default function AssistantSelect() {
289291
<span>Assistants</span>
290292
<div
291293
className="flex cursor-pointer flex-row items-center gap-1 hover:brightness-125"
292-
onClick={(e) => {
294+
onClick={async (e) => {
293295
e.stopPropagation();
294-
refreshProfiles();
296+
setLoading(true)
297+
await refreshProfiles()
298+
setLoading(false)
295299
buttonRef.current?.click();
296300
}}
297301
>
298-
<ArrowPathIcon className="text-lightgray h-2.5 w-2.5" />
302+
<ArrowPathIcon className={cn("text-lightgray h-2.5 w-2.5", loading && 'animate-spin-slow')} />
299303
</div>
300304
</div>
301305

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)