diff --git a/crates/wizard-gui/src/hub_auth.rs b/crates/wizard-gui/src/hub_auth.rs index e893977..158b1ad 100644 --- a/crates/wizard-gui/src/hub_auth.rs +++ b/crates/wizard-gui/src/hub_auth.rs @@ -268,6 +268,16 @@ pub(crate) async fn open_hub(app: tauri::AppHandle, theme: String) -> Result<(), .map_err(|error| error.message().to_owned()) } +/// Opens the registration page in the system browser, leaving Wizard open. +#[tauri::command] +pub(crate) async fn open_hub_registration() -> Result<(), String> { + let url = Url::parse("https://hub.coreinfra.ai/register") + .map_err(|_| "Некорректный адрес регистрации")?; + login::open_browser(&url) + .await + .map_err(|error| error.message().to_owned()) +} + /// Republishes the saved account after a session change, keeping `pending` and `error`. pub(crate) fn republish(app: &tauri::AppHandle) { app.state::>().update(|account| { diff --git a/crates/wizard-gui/src/lib.rs b/crates/wizard-gui/src/lib.rs index e42244a..554756f 100644 --- a/crates/wizard-gui/src/lib.rs +++ b/crates/wizard-gui/src/lib.rs @@ -127,6 +127,7 @@ pub fn run_application() -> Result<()> { hub_auth::logout_hub_account, hub_auth::select_hub, hub_auth::open_hub, + hub_auth::open_hub_registration, hub_tokens::get_hub_tokens_state, hub_tokens::get_configured_token_info, hub_tokens::refresh_hub_tokens, diff --git a/crates/wizard-gui/wizard-ui/src/App.tsx b/crates/wizard-gui/wizard-ui/src/App.tsx index a95f408..e0a987f 100644 --- a/crates/wizard-gui/wizard-ui/src/App.tsx +++ b/crates/wizard-gui/wizard-ui/src/App.tsx @@ -10,6 +10,7 @@ import { SidebarLayout } from "./components/catalyst/sidebar-layout"; import { ErrorText } from "./components/ErrorText"; import { OpenLogsButton } from "./logs/OpenLogsButton"; import { useHubAccountControl } from "./settings/HubAccount"; +import { HubSignIn } from "./settings/HubSignIn"; import { SettingsPage } from "./settings/SettingsPage"; import { useUpdateState } from "./updates/update"; import { UpdateScreen } from "./updates/UpdateScreen"; @@ -48,6 +49,7 @@ function App() { navbar={null} sidebar={} > + {page === "settings" && } {page !== "settings" && agents.status === "loading" && Загрузка…} {page !== "settings" && agents.status === "error" && Не удалось загрузить состояние агентов: {agents.message}} diff --git a/crates/wizard-gui/wizard-ui/src/agents/AgentPage.tsx b/crates/wizard-gui/wizard-ui/src/agents/AgentPage.tsx index db274e8..18b8437 100644 --- a/crates/wizard-gui/wizard-ui/src/agents/AgentPage.tsx +++ b/crates/wizard-gui/wizard-ui/src/agents/AgentPage.tsx @@ -295,22 +295,6 @@ export function AgentPage({ agents, page, proxy, account }: { } } - const signIn = !account.signedIn && ( -
- CoreInfra AI Hub - Войдите в CoreInfra AI Hub, чтобы подключить агента. Вход в аккаунт не изменяет настройки агентов. - -
- - {/* The sidebar footer shows the error on wide windows; narrow ones hide the sidebar. */} - {account.error &&
{account.error}
} -
-
-
- ); - let content: ReactNode; switch (page) { // Keep a prepared plan alive while the settings page is selected. @@ -343,7 +327,6 @@ export function AgentPage({ agents, page, proxy, account }: { )} )} - {(codex.status === "found" || !chatGptInstall.hidden) && signIn} {codex.status === "found" && ( ({ CodexSetRouting: mode })} agentToken={codex.data.token} hub={hub} @@ -375,7 +358,6 @@ export function AgentPage({ agents, page, proxy, account }: { )} - {claude.status === "found" && signIn} {claude.status === "found" && ( ({ ClaudeSetRouting: mode })} agentToken={claude.data.token} hub={hub} @@ -401,7 +383,6 @@ export function AgentPage({ agents, page, proxy, account }: { )} - {signIn} {desktop.status === "found" && ( ({ ClaudeDesktopSetRouting: mode })} agentToken={desktop.data.token} hub={hub} @@ -434,7 +415,6 @@ export function AgentPage({ agents, page, proxy, account }: { )} - {detection.status === "found" && signIn} {detection.status === "found" && ( (page === "opencode" ? { SetOpenCodeHub: mode } : { SetPiHub: mode })} diff --git a/crates/wizard-gui/wizard-ui/src/assets/coreinfra-favicon.png b/crates/wizard-gui/wizard-ui/src/assets/coreinfra-favicon.png new file mode 100644 index 0000000..be7e80c Binary files /dev/null and b/crates/wizard-gui/wizard-ui/src/assets/coreinfra-favicon.png differ diff --git a/crates/wizard-gui/wizard-ui/src/settings/HubAccount.tsx b/crates/wizard-gui/wizard-ui/src/settings/HubAccount.tsx index 9afd870..6bb5853 100644 --- a/crates/wizard-gui/wizard-ui/src/settings/HubAccount.tsx +++ b/crates/wizard-gui/wizard-ui/src/settings/HubAccount.tsx @@ -1,7 +1,7 @@ import { useRef, useState, useSyncExternalStore, type MouseEvent } from "react"; import { MenuButton, useClose } from "@headlessui/react"; import { ComputerDesktopIcon, EllipsisHorizontalIcon, MoonIcon, SunIcon } from "@heroicons/react/20/solid"; -import { hubDisplayName, loginHubAccount, logoutHubAccount, openHub, selectHub, useHubAccount } from "./hub_account"; +import { hubDisplayName, loginHubAccount, logoutHubAccount, openHub, openHubRegistration, selectHub, useHubAccount } from "./hub_account"; import { getTheme, setTheme, subscribeTheme } from "./theme"; import { Dropdown, DropdownDescription, DropdownDivider, DropdownHeader, DropdownHeading, DropdownItem, DropdownLabel, DropdownMenu, DropdownSection } from "../components/catalyst/dropdown"; import { SidebarItem, SidebarLabel } from "../components/catalyst/sidebar"; @@ -44,6 +44,7 @@ export function useHubAccountControl() { if (!agentBusy) void run(() => selectHub(hubId)); }, open: () => void run(() => openHub(getTheme())), + register: () => void run(openHubRegistration), }; } diff --git a/crates/wizard-gui/wizard-ui/src/settings/HubSignIn.css b/crates/wizard-gui/wizard-ui/src/settings/HubSignIn.css new file mode 100644 index 0000000..ab02baf --- /dev/null +++ b/crates/wizard-gui/wizard-ui/src/settings/HubSignIn.css @@ -0,0 +1,191 @@ +/* Neutral Catalyst zinc palette, with a quiet inset highlight like a native panel. */ +.hub-onboarding { + position: relative; + min-height: 128px; + background: linear-gradient(160deg, var(--color-zinc-50), var(--color-zinc-100)); + box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.85), 0 2px 6px rgb(0 0 0 / 0.02); +} + +[data-theme="dark"] .hub-onboarding { + background: linear-gradient(160deg, var(--color-zinc-800), var(--color-zinc-900)); + box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04), 0 2px 6px rgb(0 0 0 / 0.08); +} + +.hub-onboarding-symbol { + position: absolute; + top: 50%; + left: 50%; + width: 48px; + height: 48px; + transform: translate(-50%, -50%); + visibility: hidden; + pointer-events: none; +} + +.hub-onboarding-dots { + position: absolute; + inset: 0; + display: flex; + align-items: center; + justify-content: center; + gap: 6px; + opacity: 0; +} + +.hub-onboarding-dots span { + width: 5px; + height: 5px; + border-radius: 50%; + background: var(--color-zinc-400); +} + +.hub-onboarding-mark, +.hub-onboarding-mark-gray, +.hub-onboarding-mark-color { + position: absolute; + inset: 0; +} + +.hub-onboarding-mark-gray { + overflow: hidden; + /* Original site favicon: https://hub.coreinfra.ai/favicon.png. Bundled for offline use. */ + mask: url("../assets/coreinfra-favicon.png") center / contain no-repeat; + background: linear-gradient(145deg, var(--color-zinc-400), var(--color-zinc-600)); +} + +[data-theme="dark"] .hub-onboarding-mark-gray { + background: linear-gradient(145deg, var(--color-zinc-300), var(--color-zinc-500)); +} + +.hub-onboarding-mark-gray::after { + content: ""; + position: absolute; + inset: -25%; + background: linear-gradient(110deg, transparent 20%, rgb(255 255 255 / 0.7) 50%, transparent 80%); + filter: blur(5px); + transform: translateX(-120%); +} + +.hub-onboarding-mark-color { + background: url("../assets/coreinfra-favicon.png") center / contain no-repeat; +} + +.hub-onboarding-reveal { + display: grid; + grid-template-rows: 1fr; +} + +.hub-onboarding-content { + min-height: 0; + overflow: hidden; + /* Keep keyboard focus rings inside the animated clipping area. */ + margin: -4px; + padding: 4px; +} + +/* Dots → matte light over gray → original color → expand and fade → text. */ +.hub-onboarding[data-intro] { + animation: hub-welcome-arrive 300ms ease-out both; +} + +.hub-onboarding[data-intro] .hub-onboarding-symbol { + visibility: visible; +} + +.hub-onboarding[data-intro] .hub-onboarding-dots { + animation: hub-welcome-dots-out 180ms 620ms ease-out both; +} + +.hub-onboarding[data-intro] .hub-onboarding-dots span { + animation: hub-welcome-pulse 560ms ease-in-out 2 both; +} + +.hub-onboarding[data-intro] .hub-onboarding-dots span:nth-child(2) { animation-delay: 110ms; } +.hub-onboarding[data-intro] .hub-onboarding-dots span:nth-child(3) { animation-delay: 220ms; } + +.hub-onboarding[data-intro] .hub-onboarding-mark { + animation: + hub-welcome-mark-in 320ms 700ms cubic-bezier(0.22, 1, 0.36, 1) both, + hub-welcome-mark-out 420ms 2380ms cubic-bezier(0.4, 0, 0.2, 1) forwards; +} + +.hub-onboarding[data-intro] .hub-onboarding-mark-gray::after { + animation: hub-welcome-shine 750ms 950ms ease-in-out both; +} + +.hub-onboarding[data-intro] .hub-onboarding-mark-color { + animation: hub-welcome-color-in 500ms 1700ms cubic-bezier(0.4, 0, 0.2, 1) both; +} + +.hub-onboarding[data-intro] .hub-onboarding-reveal { + animation: hub-welcome-unfold 650ms 2800ms cubic-bezier(0.22, 1, 0.36, 1) both; +} + +.hub-onboarding[data-intro] .hub-onboarding-title { + animation: hub-welcome-text-in 450ms 2830ms ease-out both; +} + +.hub-onboarding[data-intro] .hub-onboarding-copy { + animation: hub-welcome-text-in 450ms 2940ms ease-out both; +} + +.hub-onboarding[data-intro] .hub-onboarding-action { + animation: hub-welcome-text-in 400ms 3060ms ease-out both; +} + +@keyframes hub-welcome-arrive { + from { opacity: 0; transform: translateY(4px); } + to { opacity: 1; transform: translateY(0); } +} + +@keyframes hub-welcome-pulse { + 0%, 100% { opacity: 0.25; transform: scale(0.85); } + 50% { opacity: 0.85; transform: scale(1); } +} + +@keyframes hub-welcome-dots-out { + from { opacity: 1; } + to { opacity: 0; } +} + +@keyframes hub-welcome-mark-in { + from { opacity: 0; transform: scale(0.88); filter: blur(2px); } + to { opacity: 1; transform: scale(1); filter: blur(0); } +} + +@keyframes hub-welcome-shine { + from { transform: translateX(-120%); } + to { transform: translateX(120%); } +} + +@keyframes hub-welcome-color-in { + from { clip-path: inset(0 100% 0 0); } + to { clip-path: inset(0 0 0 0); } +} + +@keyframes hub-welcome-mark-out { + from { opacity: 1; transform: scale(1); filter: blur(0); } + to { opacity: 0; transform: scale(1.75); filter: blur(4px); } +} + +@keyframes hub-welcome-unfold { + from { grid-template-rows: 0fr; } + to { grid-template-rows: 1fr; } +} + +@keyframes hub-welcome-text-in { + from { opacity: 0; transform: translateY(-6px); } + to { opacity: 1; transform: translateY(0); } +} + +@media (prefers-reduced-motion: reduce) { + .hub-onboarding[data-intro], + .hub-onboarding[data-intro] *, + .hub-onboarding[data-intro] *::after { + animation: none; + } + + .hub-onboarding[data-intro] .hub-onboarding-symbol { + visibility: hidden; + } +} diff --git a/crates/wizard-gui/wizard-ui/src/settings/HubSignIn.tsx b/crates/wizard-gui/wizard-ui/src/settings/HubSignIn.tsx new file mode 100644 index 0000000..5cc762f --- /dev/null +++ b/crates/wizard-gui/wizard-ui/src/settings/HubSignIn.tsx @@ -0,0 +1,74 @@ +import { useCallback, useEffect, useState } from "react"; +import { useReducedMotion } from "motion/react"; +import { Button } from "../components/catalyst/button"; +import { Link } from "../components/catalyst/link"; +import { ErrorText } from "../components/ErrorText"; +import type { HubAccountControl } from "./HubAccount"; +import "./HubSignIn.css"; + +// The CSS sequence finishes at 3.5s. Focus or a click can finish it immediately. +const INTRO_DURATION_MS = 3500; + +// Keep the first step visible even if agent detection is loading or fails. +export function HubSignIn({ hub }: { hub: HubAccountControl }) { + const reducedMotion = useReducedMotion(); + const [introduced, setIntroduced] = useState(false); + const finishIntro = useCallback(() => setIntroduced(true), []); + const accountLoaded = hub.account !== undefined; + const pending = hub.account?.pending; + const animateIntro = !introduced && !reducedMotion && !pending && !hub.error; + + useEffect(() => { + if (introduced) return; + if (hub.signedIn || reducedMotion || pending || hub.error) { + finishIntro(); + return; + } + if (!accountLoaded) return; + const timer = window.setTimeout(finishIntro, INTRO_DURATION_MS); + return () => window.clearTimeout(timer); + }, [accountLoaded, introduced, hub.signedIn, hub.error, pending, reducedMotion, finishIntro]); + + // Do not flash the welcome animation while restoring a saved account. + if (hub.signedIn || (!accountLoaded && !hub.error)) return null; + + return ( +
+
+ ); +} diff --git a/crates/wizard-gui/wizard-ui/src/settings/hub_account.ts b/crates/wizard-gui/wizard-ui/src/settings/hub_account.ts index 8e4d5fa..eb8035f 100644 --- a/crates/wizard-gui/wizard-ui/src/settings/hub_account.ts +++ b/crates/wizard-gui/wizard-ui/src/settings/hub_account.ts @@ -44,3 +44,4 @@ export const loginHubAccount = () => invoke("login_hub_account"); export const logoutHubAccount = () => invoke("logout_hub_account"); export const selectHub = (hubId: string) => invoke("select_hub", { hubId }); export const openHub = (theme: string) => invoke("open_hub", { theme }); +export const openHubRegistration = () => invoke("open_hub_registration");