storyteller landing and dashboard update

This commit is contained in:
BFlat committed 2024-03-14 11:48:53 +07:00
1 parent 43fc435af4
commit 47923888c1
5 files changed
+76 -36

No files matched your search

@@ -30,6 +30,8 @@ import { useInferenceJobs, useLocalize } from "hooks";
import { Logout } from "@storyteller/components/src/api/session/Logout";
import { Button } from "components/common";
import { WebUrl } from "common/WebUrl";
import { DomainConfig, Website } from "utils/domainConfig";
import { useDomainConfig } from "context/DomainConfigContext";
interface SideNavProps {
sessionWrapper: SessionWrapper;
@@ -56,6 +58,7 @@ export default function SideNav({
const isOnLoginPage = window.location.pathname.includes("/login");
const isOnSignUpPage = window.location.pathname.includes("/signup");
const isOnStudioPage = window.location.pathname.includes("/studio");
const domain: DomainConfig = useDomainConfig();
let history = useHistory();
const handleNavLinkClick = () => {
@@ -107,7 +110,8 @@ export default function SideNav({
const shouldNotShowSidebar =
(!isLoggedIn && (isOnLandingPage || isOnLoginPage || isOnSignUpPage)) ||
isOnStudioPage;
isOnStudioPage ||
(domain.website === Website.StorytellerAi && isOnLandingPage);
const shouldShowSidebar = windowWidth >= 992 && !shouldNotShowSidebar;
const sidebarClassName = `sidebar ${
shouldShowSidebar ? "visible" : ""
@@ -333,7 +337,7 @@ export default function SideNav({
<li>
<NavLink
exact={true}
to="/"
to={domain.website === Website.FakeYou ? "/" : "/dashboard"}
activeClassName="active-link"
onClick={handleNavLinkClick}
>
@@ -341,7 +345,7 @@ export default function SideNav({
icon={faHome}
className="sidebar-heading-icon"
/>
Home
{domain.website === Website.FakeYou ? "Home" : "Dashboard"}
</NavLink>
</li>
<li>
@@ -127,6 +127,7 @@ import DevTTS from "./pages/dev_tts/DevTTS";
import { StudioIntroPage } from "./pages/storyteller_studio_intro/StudioIntroPage";
import StudioVSTPage from "./pages/storyteller_studio_intro/StudioVST/StudioVSTPage";
import { StudioIntroResultPage } from "./pages/storyteller_studio_intro/StudioIntroResultPage";
import DashboardPage from "./pages/dashboard/DashboardPage";
interface Props {
sessionWrapper: SessionWrapper;
@@ -727,6 +728,10 @@ class PageContainer extends React.Component<
/>
</Route>
<Route path="/dashboard">
<DashboardPage sessionWrapper={this.props.sessionWrapper} />
</Route>
<Route path="/about">
<AboutPage />
</Route>
@@ -812,7 +817,7 @@ class PageContainer extends React.Component<
<Route path="/dev-tts">
<DevTTS />
</Route>
{/* Route for initial voice creation */}
<Route exact path="/voice-designer/create">
<VoiceDesignerFormPage
@@ -0,0 +1,19 @@
import React from "react";
import Dashboard from "../landing/Dashboard";
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
import { usePrefixedDocumentTitle } from "common/UsePrefixedDocumentTitle";
import { Container } from "components/common";
interface DashboardPageProps {
sessionWrapper: SessionWrapper;
}
export default function DashboardPage({ sessionWrapper }: DashboardPageProps) {
usePrefixedDocumentTitle("AI Tools");
return (
<Container type="panel">
<Dashboard sessionWrapper={sessionWrapper} />
</Container>
);
}
@@ -39,14 +39,17 @@ function LandingPage(props: Props) {
const domain: DomainConfig = useDomainConfig();
const webpageTitle = domain.website === Website.FakeYou ? "FakeYou Celebrity Voice Generator" : "";
const webpageTitle =
domain.website === Website.FakeYou
? "FakeYou Celebrity Voice Generator"
: "";
usePrefixedDocumentTitle(webpageTitle);
const isLoggedIn = props.sessionWrapper.isLoggedIn();
// DO NOT LEAK THIS YET!!
let protectedStudioOnboarding = <></>
let protectedStudioOnboarding = <></>;
if (props.sessionWrapper.canAccessStudio()) {
protectedStudioOnboarding = (
@@ -58,8 +61,8 @@ function LandingPage(props: Props) {
return (
<>
{domain.website === Website.StorytellerAi && !isLoggedIn && (
<LandingVideoReel />
{domain.website === Website.StorytellerAi && (
<LandingVideoReel sessionWrapper={props.sessionWrapper} />
)}
<Container type="panel">
{domain.website === Website.FakeYou ? (
@@ -90,27 +93,22 @@ function LandingPage(props: Props) {
) : (
<>
{/* STORYTELLER,AI */}
{!isLoggedIn ? (
<>
{protectedStudioOnboarding}
<VstSectionV2 />
<TtsDemoSection
sessionWrapper={props.sessionWrapper}
sessionSubscriptionsWrapper={
props.sessionSubscriptionsWrapper
}
inferenceJobs={props.inferenceJobs}
ttsInferenceJobs={props.ttsInferenceJobs}
enqueueInferenceJob={props.enqueueInferenceJob}
inferenceJobsByCategory={props.inferenceJobsByCategory}
enqueueTtsJob={props.enqueueTtsJob}
/>
<Dashboard sessionWrapper={props.sessionWrapper} />
<FakeYouLandingBody />
</>
) : (
<Dashboard sessionWrapper={props.sessionWrapper} />
)}
{protectedStudioOnboarding}
<VstSectionV2 />
<TtsDemoSection
sessionWrapper={props.sessionWrapper}
sessionSubscriptionsWrapper={props.sessionSubscriptionsWrapper}
inferenceJobs={props.inferenceJobs}
ttsInferenceJobs={props.ttsInferenceJobs}
enqueueInferenceJob={props.enqueueInferenceJob}
inferenceJobsByCategory={props.inferenceJobsByCategory}
enqueueTtsJob={props.enqueueTtsJob}
/>
<Dashboard sessionWrapper={props.sessionWrapper} />
<FakeYouLandingBody />
</>
)}
</Container>
@@ -1,12 +1,26 @@
import { faArrowRight } from "@fortawesome/pro-solid-svg-icons";
import { Button } from "components/common";
import React, { useEffect } from "react";
import React, { useEffect, useState } from "react";
import "./LandingVideoReel.scss";
import { SessionWrapper } from "@storyteller/components/src/session/SessionWrapper";
import { useLocation } from "react-router-dom";
interface LandingVideoReelProps {}
interface LandingVideoReelProps {
sessionWrapper: SessionWrapper;
}
export default function LandingVideoReel(props: LandingVideoReelProps) {
const isOnLandingPage = window.location.pathname === "/";
export default function LandingVideoReel({
sessionWrapper,
}: LandingVideoReelProps) {
const location = useLocation();
const [isOnLandingPage, setIsOnLandingPage] = useState(
window.location.pathname === "/"
);
const isLoggedIn = sessionWrapper.isLoggedIn();
useEffect(() => {
setIsOnLandingPage(location.pathname === "/");
}, [location]);
useEffect(() => {
const contentWrapper = document.getElementById("page-content-wrapper");
@@ -41,7 +55,7 @@ export default function LandingVideoReel(props: LandingVideoReelProps) {
searchBar?.classList.remove("landing-search");
contentWrapper?.classList.remove("no-page-padding-top");
};
}, [isOnLandingPage]);
}, [isOnLandingPage, isLoggedIn]);
return (
<div className="storyteller-landing-reel">
@@ -62,8 +76,8 @@ export default function LandingVideoReel(props: LandingVideoReelProps) {
<Button
icon={faArrowRight}
iconFlip={true}
label="Sign Up Now"
to="/signup"
label={isLoggedIn ? "Explore AI Tools" : "Sign Up Now"}
to={isLoggedIn ? "/dashboard" : "/signup"}
className="mt-4"
/>
</div>