Updated some legal screen stuff
This commit is contained in:
parent
246b36abc9
commit
ea72de0f08
6 changed files with 215 additions and 306 deletions
|
|
@ -1,10 +1,12 @@
|
|||
import Socket from "@tensamin/ttp/context";
|
||||
import User from "@tensamin/user/context";
|
||||
import type { ReactNode } from "react";
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import { useNavigate, useLocation } from "@tanstack/react-router";
|
||||
|
||||
import Sidebar from "@/components/sidebar";
|
||||
import Conversation from "@/features/conversation/context";
|
||||
import Navbar from "@/components/navbar";
|
||||
import { useStorage } from "@tensamin/storage/context";
|
||||
|
||||
/**
|
||||
* Executes Layout.
|
||||
|
|
@ -12,8 +14,30 @@ import Navbar from "@/components/navbar";
|
|||
* @returns unknown.
|
||||
*/
|
||||
export default function Layout(props: { children: ReactNode }) {
|
||||
const [loggedIn, setLoggedIn] = useState<boolean | null>(null);
|
||||
|
||||
const { load } = useStorage();
|
||||
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
|
||||
useEffect(() => {
|
||||
console.log(location);
|
||||
|
||||
load("user_id").then((userId) => {
|
||||
if (userId !== 0) {
|
||||
setLoggedIn(true);
|
||||
} else {
|
||||
navigate({
|
||||
to: "/login",
|
||||
});
|
||||
setLoggedIn(false);
|
||||
}
|
||||
});
|
||||
}, [location]);
|
||||
|
||||
return (
|
||||
<Socket>
|
||||
<Socket blockConnection={!loggedIn}>
|
||||
<User>
|
||||
<Conversation>
|
||||
<div className="w-full h-full flex bg-sidebar">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import Form from "@/components/screens/login/form";
|
||||
import { Button } from "@tensamin/ui/cmp/button";
|
||||
import { Link } from "@tanstack/react-router";
|
||||
|
||||
/**
|
||||
* Executes Page.
|
||||
|
|
@ -12,9 +10,12 @@ export default function Page() {
|
|||
<div className="w-full h-full flex flex-col gap-10 items-center justify-center">
|
||||
<Form />
|
||||
<div className="flex">
|
||||
<Link to="/signup">
|
||||
<Button variant="outline">Sign up</Button>
|
||||
</Link>
|
||||
<a target="_blank" href="https://docs.tensamin.net/installation/#iota">
|
||||
<p className="text-sm underline text-foreground/75">
|
||||
Don't have an account yet? Click here to get help setting up an
|
||||
Iota.
|
||||
</p>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in a new issue