diff --git a/gui/src/components/PageHeader.tsx b/gui/src/components/PageHeader.tsx index bc759df2b..6a91516af 100644 --- a/gui/src/components/PageHeader.tsx +++ b/gui/src/components/PageHeader.tsx @@ -1,4 +1,5 @@ import { ArrowLeftIcon } from "@heroicons/react/24/outline"; +import { AccountButton } from "../pages/config/AccountButton"; export interface PageHeaderProps { onTitleClick?: () => void; @@ -21,17 +22,20 @@ export default function PageHeader({ : "" }`} > -
+
{title && ( -
- - - {title} - -
+ <> +
+ + + {title} + +
+ + )}
{rightContent}
diff --git a/gui/src/pages/config/AccountButton.tsx b/gui/src/pages/config/AccountButton.tsx new file mode 100644 index 000000000..fffc67a6b --- /dev/null +++ b/gui/src/pages/config/AccountButton.tsx @@ -0,0 +1,48 @@ +import { Popover, Transition } from "@headlessui/react"; +import { UserCircleIcon } from "@heroicons/react/24/outline"; +import { Fragment } from "react"; + +import { SecondaryButton } from "../../components"; +import { useAuth } from "../../context/Auth"; + +export function AccountButton() { + const { session, logout, login } = useAuth(); + + if (!session) { + return ( + login(false)}>Sign in + ); + } + + return ( + + + + + + + +
+
+ {session.account.label} + + {session.account.id} + +
+ + Sign out + +
+
+
+
+ ); +} diff --git a/gui/src/pages/config/index.tsx b/gui/src/pages/config/index.tsx index ae62e59b9..efce316a6 100644 --- a/gui/src/pages/config/index.tsx +++ b/gui/src/pages/config/index.tsx @@ -6,7 +6,6 @@ import { ChevronUpDownIcon, PlusCircleIcon, SparklesIcon, - UserCircleIcon, XMarkIcon, } from "@heroicons/react/24/outline"; import { ModelDescription } from "core"; @@ -16,7 +15,7 @@ import { } from "core/config/sharedConfig"; import { Fragment, useContext, useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; -import { Input, SecondaryButton } from "../../components"; +import { Input } from "../../components"; import NumberInput from "../../components/gui/NumberInput"; import { Select } from "../../components/gui/Select"; import ToggleSwitch from "../../components/gui/Switch"; @@ -182,40 +181,7 @@ function ConfigPage() {
navigate("/")} title="Chat" /> -
- {(session || hubEnabled || controlServerBetaEnabled) && ( -
-
-

Account

- {!session ? ( -
- You are not signed in. - login(false)}> - Sign in - -
- ) : ( -
-
- - - {session.account.label === "" - ? "Signed in" - : session.account.label} - - - (Sign out) - -
-
- )} -
-
- )} - +

Configuration