mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-17 23:26:02 +00:00
signup/login blocker and redirects back to product page
This commit is contained in:
1 parent
4d33f9f838
commit
914a54d295
11 files changed
+156
-20
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import { Button, Container, Panel } from "components/common";
|
||||
import React from "react";
|
||||
import { useHistory } from "react-router-dom";
|
||||
|
||||
interface LoginBlockProps {
|
||||
title?: string;
|
||||
message?: string;
|
||||
redirect?: string;
|
||||
}
|
||||
|
||||
export default function LoginBlock({
|
||||
title = "You need to be logged in to use this product.",
|
||||
message = "Please login or create an account to proceed.",
|
||||
redirect,
|
||||
}: LoginBlockProps) {
|
||||
const history = useHistory();
|
||||
|
||||
return (
|
||||
<div
|
||||
className="d-flex flex-column align-items-center justify-content-center"
|
||||
style={{ height: "calc(100vh - 65px)" }}
|
||||
>
|
||||
<Container
|
||||
type="panel"
|
||||
className="narrow-container d-flex flex-column align-items-center justify-content-center gap-4"
|
||||
>
|
||||
<Panel padding={true}>
|
||||
{/* <div className="d-flex py-4 justify-content-center w-100">
|
||||
<div
|
||||
style={{
|
||||
aspectRatio: "4/3",
|
||||
backgroundColor: "rgba(255, 255, 255, 0.06)",
|
||||
borderRadius: "0.5rem",
|
||||
overflow: "hidden",
|
||||
maxWidth: "340px",
|
||||
}}
|
||||
>
|
||||
<video
|
||||
autoPlay
|
||||
playsInline
|
||||
muted
|
||||
loop
|
||||
className="object-fit-cover w-100 h-100"
|
||||
>
|
||||
<source src="/videos/ai-tools/vst_video.mp4" />
|
||||
</video>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="d-flex flex-column align-items-center py-4">
|
||||
<h4 className="fw-bold mb-1 text-center">{title}</h4>
|
||||
<p className="opacity-75 text-center">{message}</p>
|
||||
<div className="d-flex gap-2 mt-2">
|
||||
<Button
|
||||
label="Login"
|
||||
className="mt-3"
|
||||
onClick={() => {
|
||||
history.push(
|
||||
`/login${redirect ? `?redirect=${redirect}` : ""}`.trim()
|
||||
);
|
||||
}}
|
||||
variant="secondary"
|
||||
/>
|
||||
<Button
|
||||
label="Sign Up"
|
||||
className="mt-3"
|
||||
onClick={() => {
|
||||
history.push(
|
||||
`/signup${redirect ? `?redirect=${redirect}` : ""}`.trim()
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Panel>
|
||||
</Container>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./LoginBlock";
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import React from "react";
|
||||
import Container from "../Container";
|
||||
import LoadingSpinner from "../LoadingSpinner";
|
||||
|
||||
export default function SessionFetchingSpinner() {
|
||||
return (
|
||||
<Container
|
||||
type="panel"
|
||||
className="narrow-container"
|
||||
style={{ height: "calc(100vh - 65px)" }}
|
||||
>
|
||||
<div className="d-flex align-items-center justify-content-center h-100 gap-4">
|
||||
<LoadingSpinner
|
||||
label="Loading"
|
||||
className="me-3 fs-6"
|
||||
labelClassName="fs-4"
|
||||
/>
|
||||
</div>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from "./SessionFetchingSpinner";
|
||||
@@ -25,6 +25,7 @@ import JobsClearButton from "./JobsClearButton";
|
||||
import JobQueueTicker from "./JobQueueTicker";
|
||||
import Label from "./Label";
|
||||
import LikeButton from "./LikeButton";
|
||||
import LoginBlock from "./LoginBlock";
|
||||
import MocapInput from "./MocapInput";
|
||||
import MasonryGrid from "./MasonryGrid/MasonryGrid";
|
||||
import Modal, { ModalUtilities } from "./Modal";
|
||||
@@ -42,6 +43,7 @@ import SelectionBubbles from "./SelectionBubbles";
|
||||
import SelectModal, { SelectModalData } from "./SelectModal";
|
||||
import SelectModalVideoTabs from "./SelectModalVideoTabs";
|
||||
import SelectModalWeightsTabs from "./SelectModalWeightsTabs";
|
||||
import SessionFetchingSpinner from "./SessionFetchingSpinner";
|
||||
import Skeleton from "./Skeleton";
|
||||
import Slider from "./Slider";
|
||||
import SocialButton, { Socials } from "./SocialButton";
|
||||
@@ -93,6 +95,7 @@ export {
|
||||
JobQueueTicker,
|
||||
Label,
|
||||
LikeButton,
|
||||
LoginBlock,
|
||||
MocapInput,
|
||||
MasonryGrid,
|
||||
Modal,
|
||||
@@ -111,6 +114,7 @@ export {
|
||||
SelectModal,
|
||||
SelectModalVideoTabs,
|
||||
SelectModalWeightsTabs,
|
||||
SessionFetchingSpinner,
|
||||
Skeleton,
|
||||
Slider,
|
||||
SocialButton,
|
||||
|
||||
@@ -331,6 +331,7 @@ class PageContainer extends React.Component<
|
||||
<SignupPage
|
||||
querySessionCallback={() => {}}
|
||||
sessionWrapper={this.props.sessionWrapper}
|
||||
querySessionAction={this.props.querySessionAction}
|
||||
/>
|
||||
</Route>
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import {
|
||||
// TextArea,
|
||||
// Slider,
|
||||
Label,
|
||||
SessionFetchingSpinner,
|
||||
LoginBlock,
|
||||
// DropdownOptions,
|
||||
} from "components/common";
|
||||
import { SessionSubscriptionsWrapper } from "@storyteller/components/src/session/SessionSubscriptionsWrapper";
|
||||
@@ -21,6 +23,7 @@ import {
|
||||
import { EntityInput } from "components/entities";
|
||||
import {
|
||||
useInferenceJobs,
|
||||
useSession,
|
||||
// useSession
|
||||
} from "hooks";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -34,6 +37,7 @@ interface Props {
|
||||
}
|
||||
|
||||
export default function AIFaceMirror({ sessionSubscriptionsWrapper }: Props) {
|
||||
const { loggedIn, sessionFetched } = useSession();
|
||||
const [sourceMediaToken, sourceMediaTokenSet] = useState("");
|
||||
const [removeWatermark, removeWatermarkSet] = useState(false);
|
||||
const [faceDriverToken, faceDriverTokenSet] = useState(
|
||||
@@ -50,7 +54,6 @@ export default function AIFaceMirror({ sessionSubscriptionsWrapper }: Props) {
|
||||
useDocumentTitle("Live Portrait AI. Free Video Animation");
|
||||
|
||||
const { enqueue } = useInferenceJobs();
|
||||
// const { canBanUsers } = useSession();
|
||||
|
||||
const visibilityOptions = [
|
||||
{ label: "Private", value: "private" },
|
||||
@@ -84,6 +87,19 @@ export default function AIFaceMirror({ sessionSubscriptionsWrapper }: Props) {
|
||||
}
|
||||
};
|
||||
|
||||
if (!sessionFetched) {
|
||||
return <SessionFetchingSpinner />;
|
||||
}
|
||||
|
||||
if (!loggedIn) {
|
||||
return (
|
||||
<LoginBlock
|
||||
title="You need to be logged in to use Live Portrait"
|
||||
redirect="/ai-live-portrait"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container type="panel" className="mt-3">
|
||||
|
||||
@@ -11,7 +11,9 @@ import {
|
||||
Checkbox,
|
||||
Container,
|
||||
Label,
|
||||
LoginBlock,
|
||||
Panel,
|
||||
SessionFetchingSpinner,
|
||||
} from "components/common";
|
||||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
|
||||
import {
|
||||
@@ -32,7 +34,7 @@ import {
|
||||
import Tippy from "@tippyjs/react";
|
||||
import "tippy.js/dist/tippy.css";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import { useInferenceJobs, useModal } from "hooks";
|
||||
import { useInferenceJobs, useModal, useSession } from "hooks";
|
||||
import {
|
||||
FrontendInferenceJobType,
|
||||
InferenceJob,
|
||||
@@ -68,6 +70,7 @@ export default function LivePortrait({
|
||||
}: LivePortraitProps) {
|
||||
useDocumentTitle("Live Portrait AI. Free Video Animation");
|
||||
const { enqueueInferenceJob } = useInferenceJobs();
|
||||
const { loggedIn, sessionFetched } = useSession();
|
||||
const { open, close } = useModal();
|
||||
const [isEnqueuing, setIsEnqueuing] = useState(false);
|
||||
const [selectedSourceIndex, setSelectedSourceIndex] = useState(0);
|
||||
@@ -652,6 +655,19 @@ export default function LivePortrait({
|
||||
}
|
||||
};
|
||||
|
||||
if (!sessionFetched) {
|
||||
return <SessionFetchingSpinner />;
|
||||
}
|
||||
|
||||
if (!loggedIn) {
|
||||
return (
|
||||
<LoginBlock
|
||||
title="You need to be logged in to use Live Portrait"
|
||||
redirect="/dev-lp"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<Container type="panel" className="mt-3 mt-lg-5">
|
||||
|
||||
@@ -287,7 +287,7 @@ function LoginPage(props: Props) {
|
||||
<div className="d-none d-xxl-block">
|
||||
Don't have an account?
|
||||
</div>
|
||||
<Link to="/signup">Sign up</Link>
|
||||
<Link to={`/signup${location.search}`}>Sign up</Link>
|
||||
</div>
|
||||
</span>
|
||||
</p>
|
||||
|
||||
@@ -30,6 +30,7 @@ enum FieldTriState {
|
||||
interface Props {
|
||||
sessionWrapper: SessionWrapper;
|
||||
querySessionCallback: () => void;
|
||||
querySessionAction: () => void;
|
||||
}
|
||||
|
||||
function SignupPage(props: Props) {
|
||||
@@ -247,6 +248,7 @@ function SignupPage(props: Props) {
|
||||
}
|
||||
} else if (CreateAccountIsSuccess(response)) {
|
||||
props.querySessionCallback();
|
||||
props.querySessionAction();
|
||||
|
||||
Analytics.accountSignupComplete();
|
||||
|
||||
@@ -604,7 +606,7 @@ function SignupPage(props: Props) {
|
||||
<p className="fs-7 mt-2">
|
||||
<Trans i18nKey="account.SignUpPage.signInInstead">
|
||||
Already have an account?{" "}
|
||||
<Link to="/login">Log in instead.</Link>
|
||||
<Link to={`/login${location.search}`}>Log in instead.</Link>
|
||||
</Trans>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -11,6 +11,8 @@ import {
|
||||
Slider,
|
||||
Label,
|
||||
DropdownOptions,
|
||||
SessionFetchingSpinner,
|
||||
LoginBlock,
|
||||
} from "components/common";
|
||||
import { EntityInput } from "components/entities";
|
||||
import {
|
||||
@@ -24,13 +26,12 @@ import { usePrefixedDocumentTitle } from "common/UsePrefixedDocumentTitle";
|
||||
import { StyleSelectionButton } from "./StyleSelection/StyleSelectionButton";
|
||||
import useStyleStore from "hooks/useStyleStore";
|
||||
import StyleOptionPicker from "./StyleSelection/StyleSelectionList";
|
||||
import LoadingSpinner from "components/common/LoadingSpinner";
|
||||
import { isMobile } from "react-device-detect";
|
||||
import { AITools } from "components/marketing";
|
||||
|
||||
export default function StyleVideo() {
|
||||
const { mediaToken: pageMediaToken } = useParams<{ mediaToken: string }>();
|
||||
const { styleVideoAccessCheck, sessionFetched } = useSession();
|
||||
const { loggedIn, sessionFetched } = useSession();
|
||||
const [mediaToken, mediaTokenSet] = useState(pageMediaToken || "");
|
||||
const [IPAToken, IPATokenSet] = useState("");
|
||||
const [prompt, promptSet] = useState("");
|
||||
@@ -175,24 +176,19 @@ export default function StyleVideo() {
|
||||
};
|
||||
|
||||
if (!sessionFetched) {
|
||||
return <SessionFetchingSpinner />;
|
||||
}
|
||||
|
||||
if (!loggedIn) {
|
||||
return (
|
||||
<Container
|
||||
type="panel"
|
||||
className="narrow-container"
|
||||
style={{ height: "calc(100vh - 65px)" }}
|
||||
>
|
||||
<div className="d-flex align-items-center justify-content-center h-100 gap-4">
|
||||
<LoadingSpinner
|
||||
label="Loading"
|
||||
className="me-3 fs-6"
|
||||
labelClassName="fs-4"
|
||||
/>
|
||||
</div>
|
||||
</Container>
|
||||
<LoginBlock
|
||||
title="You need to be logged in to use Video Style Transfer"
|
||||
redirect="/style-video"
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return styleVideoAccessCheck(
|
||||
return (
|
||||
<>
|
||||
<Container className="mt-3 mt-lg-5" type="panel">
|
||||
<Panel className="d-block d-lg-none mb-3">{vstInfo}</Panel>
|
||||
|
||||
Reference in new issue
Block a user