From cbb28fac6f38ed2aa94ecf84d7f2f64ef047c127 Mon Sep 17 00:00:00 2001 From: Sergey Elpashev Date: Thu, 3 Apr 2025 11:11:30 +0300 Subject: [PATCH] feat: some profile page upgrades --- src/app.tsx | 25 ++++++++++++++----------- src/components/layout.tsx | 13 ------------- src/pages/login.tsx | 13 ++++++++++++- src/pages/profile.tsx | 23 +++++++++++++++++++---- 4 files changed, 45 insertions(+), 29 deletions(-) delete mode 100644 src/components/layout.tsx diff --git a/src/app.tsx b/src/app.tsx index 3acc904..cdcac73 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,8 +1,8 @@ import { FunctionComponent } from "preact"; -import { ErrorBoundary, LocationProvider, Route, Router, useLocation } from "preact-iso"; +import { ErrorBoundary, lazy, LocationProvider, Route, Router, useLocation } from "preact-iso"; import "preact/debug"; import LoginPage from "./pages/login"; -import ProfilePage from "./pages/profile"; +import { AppProvider } from "./providers/AuthProvider"; const HomePage: FunctionComponent = () => { const location = useLocation(); @@ -12,14 +12,17 @@ const HomePage: FunctionComponent = () => { export function App() { return ( - - - - - - - - - + + + + + + + import("./pages/profile"))} /> +

404

} /> +
+
+
+
); } diff --git a/src/components/layout.tsx b/src/components/layout.tsx deleted file mode 100644 index ad94bd4..0000000 --- a/src/components/layout.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { FunctionComponent } from "preact"; -import Menu from "./menu"; - -const Layout: FunctionComponent = (props) => { - return ( -
- {props.children} - -
- ); -}; - -export default Layout; diff --git a/src/pages/login.tsx b/src/pages/login.tsx index a684268..736562e 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -1,14 +1,25 @@ import Button from "@/components/ui/Button"; import Input from "@/components/ui/Input"; +import { useAppContext } from "@/providers/AuthProvider"; import { FunctionComponent } from "preact"; +import { useLocation } from "preact-iso"; import classes from "./login.module.scss"; const LoginPage: FunctionComponent = () => { + const { isLoggedIn } = useAppContext(); + const location = useLocation(); return (
- +
); diff --git a/src/pages/profile.tsx b/src/pages/profile.tsx index a786293..d172c39 100644 --- a/src/pages/profile.tsx +++ b/src/pages/profile.tsx @@ -1,11 +1,26 @@ -import Layout from "@/components/layout"; +import Menu from "@/components/menu"; import { FunctionComponent } from "preact"; +import { Route, Router, useLocation } from "preact-iso"; const ProfilePage: FunctionComponent = () => { + const { route } = useLocation(); return ( - -

Profile

-
+
+
+ +

Test

} /> +

Test2

} /> + { + route("/profile/settings", true); + return null; + }} + /> +
+
+ +
); };