🚧 (wip) proping function into page component

Prop the page component state function on the main to the page component so that the page can be changed from the page
component. Used for step-by-step login procedures.
This commit is contained in:
2025-10-02 10:33:40 +07:00
parent 57affc70ca
commit 8e69819444
2 changed files with 23 additions and 13 deletions

View File

@ -1,29 +1,27 @@
"use client";
import { redirect } from "next/navigation";
import React, { useEffect, useState } from "react";
import React, { JSX, useEffect, useState } from "react";
import SecurityCheckup from "@/shared/auth/ui/SecurityCheckup";
import SecurityCheckupFailed from "@/shared/auth/ui/SecurityCheckupFailed";
import Signup from "../ui/Signup";
const SignupPage = () => {
// State to set the current page component
const [componentFlow, setComponentFlow] = useState<JSX.Element>(
<SecurityCheckup />
);
/**
* Create a lit component that will be used in popp, consisting of 3 component flows:
* 1. When the user opens it, a browser environment check will be performed.
* 2. If it passes, the login component will appear and the user will perform authentication.
* 3. If it fails, stop the authentication process and display the warning component, then return the user to the homepage.
* 1. If it passes, the login component will appear and the user will perform authentication.
* 2. If it fails, stop the authentication process and display the warning component, then return the user to the homepage.
*/
const componentFlowList = {
securityCheckup: <SecurityCheckup />,
securityCheckupFailed: <SecurityCheckupFailed />,
SecurityCheckupSuccessed: <Signup />,
SecurityCheckupSuccessed: <Signup changeCurrentPage={setComponentFlow} />,
};
// State to set the current page component
const [componentFlow, setComponentFlow] = useState(
componentFlowList.securityCheckup
);
useEffect(() => {
/**
* Check if the window has an opener (i.e., it was opened by another window)