From 9a945edd875e37650a17714fca822692e4b4e191 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Thu, 13 Jan 2022 18:12:43 -0800 Subject: [PATCH] cleaning things up --- components/Layouts/SiteLayout.js | 35 ++++++ contexts/authContext.js | 2 +- pages/_app.js | 42 ++----- pages/index.js | 3 +- pages/teams/dashboard.tsx | 17 ++- pages/teams/index.js | 105 +++++------------ pages/teams/landing.js | 80 +++++++++++++ pages/teams/login.tsx | 4 +- services/authService.js | 18 +++ services/{firebase.js => firebaseService.js} | 0 services/userService.tsx | 5 + styles/Home.module.css | 116 ------------------- styles/globals.css | 6 +- 13 files changed, 186 insertions(+), 247 deletions(-) create mode 100644 components/Layouts/SiteLayout.js create mode 100644 pages/teams/landing.js create mode 100644 services/authService.js rename services/{firebase.js => firebaseService.js} (100%) create mode 100644 services/userService.tsx delete mode 100644 styles/Home.module.css diff --git a/components/Layouts/SiteLayout.js b/components/Layouts/SiteLayout.js new file mode 100644 index 0000000..30e923b --- /dev/null +++ b/components/Layouts/SiteLayout.js @@ -0,0 +1,35 @@ + +import Head from "next/head" + +export default function Layout({ children }) { + return ( + <> + + + nirvana + + + {/* Google Fonts */} + + + + + + + +
+ {children} +
+ + ) +} \ No newline at end of file diff --git a/contexts/authContext.js b/contexts/authContext.js index 1068fbf..9217983 100644 --- a/contexts/authContext.js +++ b/contexts/authContext.js @@ -1,6 +1,6 @@ import { getAuth, GoogleAuthProvider, onAuthStateChanged, signInWithPopup, signOut, User } from "firebase/auth"; import React, { useContext, useEffect, useState } from "react"; -import firebase from '../services/firebase' +import firebase from '../services/firebaseService' const AuthContext = React.createContext(null); const googleProvider = new GoogleAuthProvider() diff --git a/pages/_app.js b/pages/_app.js index faf4704..765210b 100644 --- a/pages/_app.js +++ b/pages/_app.js @@ -2,42 +2,16 @@ import '../styles/globals.css' import 'antd/dist/antd.css'; import Head from 'next/head' import { AuthProvider } from '../contexts/authContext' +import SiteLayout from '../components/Layouts/SiteLayout' function MyApp({ Component, pageProps }) { - return <> - - - - - nirvana - - - - - - - - - - - - -
- - - -
- + return ( + + + + + + ) } export default MyApp diff --git a/pages/index.js b/pages/index.js index c2547a7..c9a10ef 100644 --- a/pages/index.js +++ b/pages/index.js @@ -1,6 +1,5 @@ import Head from 'next/head'; import Image from 'next/image'; -import styles from '../styles/Home.module.css'; export default function Home() { return ( @@ -12,7 +11,7 @@ export default function Home() {

tired of the rat race on{' '} - insta, tiktok, snap, "meta"...? + insta, tiktok, snap, "meta"...?

diff --git a/pages/teams/dashboard.tsx b/pages/teams/dashboard.tsx index 8d12cbf..adc66c4 100644 --- a/pages/teams/dashboard.tsx +++ b/pages/teams/dashboard.tsx @@ -75,18 +75,18 @@ export default function Dashboard() { const { currUser, logOut } = useAuth() const router = useRouter() + useEffect(() => { + // if not authenticated, take user to the login + if (!currUser) { + console.log('not authenticated...routing from dashboard to teams home') + router.push('/teams/login') + } + }, [currUser]) + const [selectedChannel, setSelectedChannel] = useState(null) console.log("in dashboard " + currUser) - useEffect(() => { - // if not authed, go to home - if (!currUser) { - console.log('not authenticated...routing from dashboard to teams home') - router.push('/teams') - } - }, [currUser]) - async function handleSignOut() { console.log("clicked log out button") @@ -218,7 +218,6 @@ export default function Dashboard() { - {/* list of team members */} { testFriends.map((friend, i) => { diff --git a/pages/teams/index.js b/pages/teams/index.js index c5fe90a..d5d061e 100644 --- a/pages/teams/index.js +++ b/pages/teams/index.js @@ -1,81 +1,30 @@ -import Head from 'next/head'; -import Image from 'next/image'; -import styles from '/styles/Home.module.css'; -import Link from 'next/link'; +import { useAuth } from "../../contexts/authContext" +import { useRouter } from "next/router" +import { useEffect } from "react" + +/** + * figure out where to take the user based on everything + */ +function RouteHandler() { + const { currUser, logOut } = useAuth() + const router = useRouter() + + useEffect(() => { + // if not authenticated, take user to the login + if (!currUser) { + console.log('not authenticated...routing from dashboard to teams home') + router.push('/teams/login') + } + }, [currUser]) -export default function Home() { return ( -

- - - - nirvana for teams - - - - - - - - - - -
-

nirvana

- -

๐Ÿƒvoice first collaboration for remote teams

- -

- tired of spending most of the work day on{' '} - slack, zoom, ms teams, trello, outlook, gcal, notion, gmail...? -

- -

- focus on actually working and: -
- - cut the texting, emojis, and notifications -
- - increase collaboration without endless threads -
- - avoid 80% of meetings with asynchronous and spontaneous convos -
- - form better relationships with your team -
-

- -

- wanna test the beta? text us @ 949.237.2715 -

- - {/* -

waitlist currently sitting at 2,324 people...

-
*/} - -

- why? we live in a distracted world. let's fix it, because less is more. -

- - - - -
-
- ); +
this is the route handler page
+ ) } + +export async function getServerSideProps() { + // Pass data to the page via props + return { props: { } } +} + +export default RouteHandler diff --git a/pages/teams/landing.js b/pages/teams/landing.js new file mode 100644 index 0000000..4aaa56a --- /dev/null +++ b/pages/teams/landing.js @@ -0,0 +1,80 @@ +import Head from 'next/head'; +import Image from 'next/image'; +import Link from 'next/link'; + +export default function Landing() { + return ( +
+ + + + nirvana for teams + + + + + + + + + + +
+

nirvana

+ +

๐Ÿƒvoice first collaboration for remote teams

+ +

+ tired of spending most of the work day on{' '} + slack, zoom, ms teams, trello, outlook, gcal, notion, gmail...? +

+ +

+ focus on actually working and: +
+ - cut the texting, emojis, and notifications +
+ - increase collaboration without endless threads +
+ - avoid 80% of meetings with asynchronous and spontaneous convos +
+ - form better relationships with your team +
+

+ +

+ wanna test the beta? text us @ 949.237.2715 +

+ + {/* +

waitlist currently sitting at 2,324 people...

+
*/} + +

+ why? we live in a distracted world. let's fix it, because less is more. +

+ + + + +
+
+ ); +} diff --git a/pages/teams/login.tsx b/pages/teams/login.tsx index 9f7cca5..074b591 100644 --- a/pages/teams/login.tsx +++ b/pages/teams/login.tsx @@ -10,8 +10,8 @@ export default function Login() { useEffect(() => { // if auth, go to dashboard if (currUser) { - console.log('already logged in, redirecting to the dashboard') - router.push('/teams/dashboard') + console.log('already logged in, redirecting to router') + router.push('/teams') } }, [currUser]) diff --git a/services/authService.js b/services/authService.js new file mode 100644 index 0000000..fc43dc6 --- /dev/null +++ b/services/authService.js @@ -0,0 +1,18 @@ +export function requireAuthentication(gssp) { + return async (context) => { + const { req, res } = context; + const token = req.cookies.userToken; + + if (!token) { + // Redirect to login page + return { + redirect: { + destination: '/admin/login', + statusCode: 302 + } + }; + } + + return await gssp(context); // Continue on to call `getServerSideProps` logic + } +} \ No newline at end of file diff --git a/services/firebase.js b/services/firebaseService.js similarity index 100% rename from services/firebase.js rename to services/firebaseService.js diff --git a/services/userService.tsx b/services/userService.tsx new file mode 100644 index 0000000..f0a80df --- /dev/null +++ b/services/userService.tsx @@ -0,0 +1,5 @@ +class UserService { + +} + +export {} \ No newline at end of file diff --git a/styles/Home.module.css b/styles/Home.module.css deleted file mode 100644 index 32a57d5..0000000 --- a/styles/Home.module.css +++ /dev/null @@ -1,116 +0,0 @@ -.container { - padding: 0 2rem; -} - -.main { - min-height: 100vh; - padding: 4rem 0; - flex: 1; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; -} - -.footer { - display: flex; - flex: 1; - padding: 2rem 0; - border-top: 1px solid #eaeaea; - justify-content: center; - align-items: center; -} - -.footer a { - display: flex; - justify-content: center; - align-items: center; - flex-grow: 1; -} - -.title a { - color: #0070f3; - text-decoration: none; -} - -.title a:hover, -.title a:focus, -.title a:active { - text-decoration: underline; -} - -.title { - margin: 0; - line-height: 1.15; - font-size: 4rem; -} - -.title, -.description { - text-align: center; -} - -.description { - margin: 4rem 0; - line-height: 1.5; - font-size: 1.5rem; -} - -.code { - background: #fafafa; - border-radius: 5px; - padding: 0.75rem; - font-size: 1.1rem; - font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, - Bitstream Vera Sans Mono, Courier New, monospace; -} - -.grid { - display: flex; - align-items: center; - justify-content: center; - flex-wrap: wrap; - max-width: 800px; -} - -.card { - margin: 1rem; - padding: 1.5rem; - text-align: left; - color: inherit; - text-decoration: none; - border: 1px solid #eaeaea; - border-radius: 10px; - transition: color 0.15s ease, border-color 0.15s ease; - max-width: 300px; -} - -.card:hover, -.card:focus, -.card:active { - color: #0070f3; - border-color: #0070f3; -} - -.card h2 { - margin: 0 0 1rem 0; - font-size: 1.5rem; -} - -.card p { - margin: 0; - font-size: 1.25rem; - line-height: 1.5; -} - -.logo { - height: 1em; - margin-left: 0.5rem; -} - -@media (max-width: 600px) { - .grid { - width: 100%; - flex-direction: column; - } -} diff --git a/styles/globals.css b/styles/globals.css index 1c3ed79..c38236f 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -21,7 +21,7 @@ main { font-family: "Poppins", sans-serif; } -body { +bg { background: url("/wallpapers/dark-mountains.jpg") no-repeat center center fixed; -webkit-background-size: cover; @@ -47,20 +47,16 @@ body { color: teal; } #side-note { - font-family: "Baloo Bhaijaan 2", cursive; font-size: 1.5em; } p { - font-family: "Baloo Bhaijaan 2", cursive; font-size: 2em; - color: white; } #marquee-text { font-style: italic; font-size: 1.5em; - font-family: "Baloo Bhaijaan 2", cursive; } /* Mobile :320px. */