diff --git a/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx b/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx index f703e76ca6..d4084bf060 100644 --- a/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx +++ b/frontend/apps/editor3d/app/src/components/signaled/TopBar/TopBar.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef, useState } from "react"; +import { useRef, useState } from "react"; import { faGear, faImages, @@ -18,6 +18,7 @@ import { } from "@fortawesome/pro-regular-svg-icons"; import { Button } from "@storyteller/ui-button"; import { PopoverMenu } from "@storyteller/ui-popover"; +import { AuthButtons } from "./AuthButtons"; import { SceneTitleInput } from "./SceneTitleInput"; import { Activity } from "~/pages/PageEnigma/comps/GenerateModals/Activity"; import { @@ -57,10 +58,6 @@ import { usePricingModalStore, useCreditsModalStore, } from "@storyteller/ui-pricing-modal"; -import { useCreditsBalanceChangedEvent } from "@storyteller/tauri-events"; -import { useSubscriptionPlanChangedEvent } from "@storyteller/tauri-events"; -import { useCreditsState } from "@storyteller/credits"; -import { useSubscriptionState } from "@storyteller/subscription"; interface Props { pageName: string; @@ -79,7 +76,7 @@ type SettingsSection = const SWITCHER_THROTTLE_TIME = 500; // milliseconds // NB: See `TabState` for the default tab. -const appMenuTabs: MenuIconItem[] = [ +const appMenuTabs: MenuIconItem[] = [ { id: "IMAGE", label: "Text to Image", @@ -153,25 +150,6 @@ export const TopBar = ({ pageName, loginSignUpPressed }: Props) => { const [disableSwitcher, setDisableSwitcher] = useState(false); const switcherThrottle = useRef(false); - const creditsStore = useCreditsState(); - const sumTotalCredits = creditsStore.totalCredits; - - const subscriptionStore = useSubscriptionState(); - const hasPaidPlan = subscriptionStore.hasPaidPlan(); - - useEffect(() => { - creditsStore.fetchFromServer(); - subscriptionStore.fetchFromServer(); - }, []); - - useCreditsBalanceChangedEvent(async () => { - creditsStore.fetchFromServer(); - }); - - useSubscriptionPlanChangedEvent(async () => { - subscriptionStore.fetchFromServer(); - }); - const disableTabSwitcher = () => { return ( disableSwitcher || @@ -240,43 +218,13 @@ export const TopBar = ({ pageName, loginSignUpPressed }: Props) => { const pageTitle = getPageTitle(); - const { toggleModal: toggleSubscriptionModal } = usePricingModalStore(); + const { toggleModal } = usePricingModalStore(); const { toggleModal: toggleCreditsModal } = useCreditsModalStore(); - // Pick logo based on current theme (light uses black logo; others use white) - const [logoSrc, setLogoSrc] = useState( - "/resources/logo/artcraft-logo-color-white.svg", - ); - useEffect(() => { - const computeLogo = () => { - const root = document.documentElement; - const isLight = root.classList.contains("theme-light"); - setLogoSrc( - isLight - ? "/resources/logo/artcraft-logo-color-black.svg" - : "/resources/logo/artcraft-logo-color-white.svg", - ); - }; - computeLogo(); - const mo = new MutationObserver((muts) => { - for (const m of muts) { - if (m.type === "attributes" && m.attributeName === "class") { - computeLogo(); - break; - } - } - }); - mo.observe(document.documentElement, { - attributes: true, - attributeFilter: ["class"], - }); - return () => mo.disconnect(); - }, []); - return ( <>