Skip to content

Commit

Permalink
feat(client): created note generation page and payment plan page
Browse files Browse the repository at this point in the history
  • Loading branch information
EchoSkorJjj committed Feb 24, 2024
1 parent 804309c commit 7800aa2
Show file tree
Hide file tree
Showing 18 changed files with 501 additions and 73 deletions.
9 changes: 7 additions & 2 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const SgIDCallbackPage = lazy(() => import("~pages/auth/SgIDCallback"));

// Private Page
const HomePage = lazy(() => import("~pages/home/Home"));
const NotesGeneratorPage = lazy(() => import("~pages/notes/NotesGenerator"));
const SubscribePage = lazy(() => import("~pages/subscribe/Subscribe"));

const App = () => {
const { isAuthenticated } = useAuth();
Expand All @@ -35,6 +37,7 @@ const App = () => {
username: "Hello World",
email: "sadad@gmail.com",
role: "User",
is_paid: false,
},
});
}
Expand All @@ -46,10 +49,10 @@ const App = () => {
}, []);

return (
<Flex direction="column" minH="100vh" bg={"darkBlue.500"}>
<Flex direction="column" minH="100vh" bg={"white"}>
<Suspense fallback={<Loader />}>
<Navbar />
<Box flex="1">
<Box flex="1" bg="darkBlue.500">
<Suspense fallback={<Loader />}>
<Routes>
<Route
Expand All @@ -73,6 +76,8 @@ const App = () => {
element={<PrivateRoute isAuthenticated={isAuthenticated} />}
>
<Route path="/home" element={<HomePage />} />
<Route path="/generator" element={<NotesGeneratorPage />} />
<Route path="/subscribe" element={<SubscribePage />} />
</Route>
<Route path="*" element={<NotFound />} />
</Routes>
Expand Down
Binary file added client/src/assets/img/notes_page_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 2 additions & 6 deletions client/src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const Navbar = ({ ...rest }) => {
alignItems={"center"}
justifyContent={"space-between"}
{...rest}
h="20"
maxW={"6xl"}
direction={"row"}
>
Expand All @@ -59,19 +60,14 @@ const Navbar = ({ ...rest }) => {
<Logo destination="/" />
{isAuthenticated ? <NavLink /> : <></>}
</HStack>
<HStack
h="20"
alignItems="center"
spacing={{ base: "0", sm: "2", lg: "6" }}
>
<HStack alignItems="center">
{isAuthenticated ? (
<AuthMenu user={user} handleSignOutClick={signOut} />
) : (
<Button
as={"a"}
fontSize={"sm"}
fontWeight={600}
display={{ base: "none", md: "flex" }}
color={"white"}
bg={"blue.400"}
href={"/login"}
Expand Down
29 changes: 10 additions & 19 deletions client/src/components/navbar/components/AuthMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { FiChevronDown } from "react-icons/fi";
import {
Avatar,
Box,
Button,
Center,
HStack,
Menu,
MenuButton,
MenuDivider,
MenuItem,
MenuList,
Portal,
Text,
VStack,
} from "@chakra-ui/react";
import { Menu } from "@opengovsg/design-system-react";

import avatar4 from "~assets/img/avatars/avatar4.png";

Expand All @@ -26,8 +20,8 @@ interface AuthMenuProps {

export const AuthMenu = ({ user, handleSignOutClick }: AuthMenuProps) => {
return (
<Menu>
<MenuButton
<Menu isStretch={true}>
<Menu.Button
as={Button}
py={2}
transition="all 0.3s"
Expand All @@ -50,13 +44,10 @@ export const AuthMenu = ({ user, handleSignOutClick }: AuthMenuProps) => {
{user?.role}
</Text>
</VStack>
<Box display={{ base: "none", lg: "flex" }}>
<FiChevronDown />
</Box>
</HStack>
</MenuButton>
</Menu.Button>
<Portal>
<MenuList alignItems={"center"}>
<Menu.List alignItems={"center"} width={"200px"}>
<br />
<Center>
<Avatar size={"2xl"} src={avatar4} referrerPolicy="no-referrer" />
Expand All @@ -66,12 +57,12 @@ export const AuthMenu = ({ user, handleSignOutClick }: AuthMenuProps) => {
<p>{user?.username}</p>
</Center>
<br />
<MenuDivider />
<MenuItem as="a" href="/profile">
<Menu.Divider />
<Menu.Item as="a" href="/profile">
Profile Settings
</MenuItem>
<MenuItem onClick={handleSignOutClick}>Logout</MenuItem>
</MenuList>
</Menu.Item>
<Menu.Item onClick={handleSignOutClick}>Logout</Menu.Item>
</Menu.List>
</Portal>
</Menu>
);
Expand Down
6 changes: 4 additions & 2 deletions client/src/pages/auth/MyInfoCallback.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { useEffect } from "react";
import { lazy, useEffect } from "react";

import { useAuth } from "~features/auth";

const Loader = lazy(() => import("~components/loader/Loader"));

const MyInfoCallback = () => {
const { myInfoAuth } = useAuth();

useEffect(() => {
myInfoAuth();
}, []);

return <></>;
return <Loader />;
};

export default MyInfoCallback;
6 changes: 4 additions & 2 deletions client/src/pages/auth/SgIDCallback.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import { useEffect } from "react";
import { lazy, useEffect } from "react";

import { useAuth } from "~features/auth";

const Loader = lazy(() => import("~components/loader/Loader"));

const SgIDCallback = () => {
const { sgIdAuth } = useAuth();

useEffect(() => {
sgIdAuth();
}, []);

return <></>;
return <Loader />;
};

export default SgIDCallback;
4 changes: 2 additions & 2 deletions client/src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const HomePage = () => {
pr="8em"
pt="8em"
as="a"
href="/notes-generator"
href="/generator"
justifyContent={"center"}
alignContent="center"
>
Expand All @@ -51,7 +51,7 @@ const HomePage = () => {
pr="8em"
pt="8em"
as="a"
href="/notes-marketplace"
href="/marketplace"
>
<Text color={"white"} lineHeight={1.2} fontSize="3xl">
View our
Expand Down
27 changes: 12 additions & 15 deletions client/src/pages/landing/Landing.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
import {
Box,
Flex,
Image,
Stack,
Text,
useBreakpointValue,
VStack,
} from "@chakra-ui/react";
import { Box, Flex, Image, Stack, Text, VStack } from "@chakra-ui/react";

import LandingPageImage from "~assets/img/landing_page_image.png";

Expand All @@ -17,25 +9,30 @@ const LandingPage = () => {
<Box position="relative" height="100%" width="100%">
<Image
src={LandingPageImage}
width={useBreakpointValue({ base: "3xl", md: "6xl" })}
width={{ base: "3xl", md: "6xl" }}
position="absolute"
display={{ base: "none", md: "flex" }}
bottom="0"
left="50%"
transform="translate(-50%, 15%)"
left={{ md: "50%" }}
transform={{
base: "translate(0%, 35%)",
md: "translate(-50%, 10%)",
}}
alt="Centered Image"
/>
<VStack
w={"full"}
position="absolute"
transform="translate(-15%, 300%)"
transform={{ md: "translate(-15%, 370%)" }}
justify={"center"}
px={useBreakpointValue({ base: 4, md: 8 })}
mt={{ base: 6, md: "none" }}
px={{ base: 4, md: 8 }}
>
<Stack maxW={"2xl"} align={"flex-start"} spacing={6}>
<Text
color={"white"}
lineHeight={1.2}
fontSize={useBreakpointValue({ base: "3xl", md: "5xl" })}
fontSize={{ base: "3xl", md: "4xl", lg: "5xl" }}
>
We{" "}
<Text as="span" fontWeight="bold">
Expand Down
Loading

0 comments on commit 7800aa2

Please sign in to comment.