Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

practice bootcamp adding 404 and 500 #198

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { NextPage } from "next"
import React, { ReactElement } from "react"
import ScottyLabsHeader from "src/components/design/ScottyLabsHeader"
import WaveBackground from "src/components/design/WaveBackground"
import ApplicationForm from "src/components/form/ApplicationForm"
import Menu from "src/components/menu/Menu"
import styles from "../styles/404.module.scss"

const ApplicationPage: NextPage = (): ReactElement => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is not actually used - it can be removed

return (
<>
<WaveBackground />
<Menu />
<div>
<ScottyLabsHeader />
<div className={styles.background}>
<ApplicationForm />
</div>
</div>
</>
)
}

export default function Custom404() {
return (
<>
<WaveBackground />
<div>
<ScottyLabsHeader />
<div className={styles.background}>
<h1> 404 - Page Not Found </h1>
</div>
</div>
</>
)
}
36 changes: 36 additions & 0 deletions pages/500.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { NextPage } from "next"
import React, { ReactElement } from "react"
import ScottyLabsHeader from "src/components/design/ScottyLabsHeader"
import WaveBackground from "src/components/design/WaveBackground"
import ApplicationForm from "src/components/form/ApplicationForm"
import Menu from "src/components/menu/Menu"
import styles from "../styles/500.module.scss"

const ApplicationPage: NextPage = (): ReactElement => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same goes for this function - it is not used so it can be removed safely

return (
<>
<WaveBackground />
<Menu />
<div>
<ScottyLabsHeader />
<div className={styles.background}>
<ApplicationForm />
</div>
</div>
</>
)
}

export default function Custom404() {
return (
<>
<WaveBackground />
<div>
<ScottyLabsHeader />
<div className={styles.background}>
<h1> 500 - Server Error </h1>
</div>
</div>
</>
)
}
102 changes: 51 additions & 51 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,51 @@
import { StyledEngineProvider, ThemeProvider } from "@mui/material"
import type { AppProps } from "next/app"
import Head from "next/head"
import { ReactElement } from "react"
import { Provider } from "react-redux"
import Script from "next/script"
import store from "src/store"
import { theme } from "src/themes/theme"
import "styles/globals.scss"
const App = ({ Component, pageProps }: AppProps): ReactElement => {
return (
<>
<Head>
<title>TartanHacks</title>
{/* Disable cache control */}
<meta
httpEquiv="Cache-Control"
content="no-cache, no-store, must-revalidate"
/>
<meta httpEquiv="Pragma" content="no-cache" />
<meta httpEquiv="Expires" content="0" />
<meta name="description" content="Register for TartanHacks" />
<link rel="icon" href="/favicon.png" />
<Script
async
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GOOGLE_ANALYTICS_ID}`}
></Script>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GOOGLE_ANALYTICS_ID}', {
page_path: window.location.pathname,
});
`}
</Script>
</Head>
<ThemeProvider theme={theme}>
<Provider store={store}>
<StyledEngineProvider injectFirst>
<Component {...pageProps} />
</StyledEngineProvider>
</Provider>
</ThemeProvider>
</>
)
}
export default App
import { StyledEngineProvider, ThemeProvider } from "@mui/material"
import type { AppProps } from "next/app"
import Head from "next/head"
import { ReactElement } from "react"
import { Provider } from "react-redux"
import Script from "next/script"
import store from "src/store"
import { theme } from "src/themes/theme"
import "styles/globals.scss"

const App = ({ Component, pageProps }: AppProps): ReactElement => {
return (
<>
<Head>
<title>TartanHacks</title>
{/* Disable cache control */}
<meta
httpEquiv="Cache-Control"
content="no-cache, no-store, must-revalidate"
/>
<meta httpEquiv="Pragma" content="no-cache" />
<meta httpEquiv="Expires" content="0" />
<meta name="description" content="Register for TartanHacks" />
<link rel="icon" href="/favicon.png" />
<Script
async
src={`https://www.googletagmanager.com/gtag/js?id=${process.env.GOOGLE_ANALYTICS_ID}`}
></Script>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '${process.env.GOOGLE_ANALYTICS_ID}', {
page_path: window.location.pathname,
});
`}
</Script>
</Head>
<ThemeProvider theme={theme}>
<Provider store={store}>
<StyledEngineProvider injectFirst>
<Component {...pageProps} />
</StyledEngineProvider>
</Provider>
</ThemeProvider>
</>
)
}

export default App
56 changes: 28 additions & 28 deletions pages/login.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
import { Collapse, LinearProgress } from "@mui/material"
import { deleteCookie } from "cookies-next"
import { NextPage } from "next"
import { ReactElement, useEffect } from "react"
import AuthenticationDialog from "src/components/auth/AuthenticationDialog"
import ScottyLabsIcon from "src/components/design/ScottyLabsIcon"
import WaveHeader from "src/components/design/WaveHeader"
import styles from "../styles/Auth.module.scss"
const LoginPage: NextPage = (): ReactElement => {
useEffect(() => {
window.localStorage.removeItem("accessToken")
deleteCookie("accessToken")
}, [])
return (
<div>
<WaveHeader />
<div className={styles.scottyContainer}>
<ScottyLabsIcon className={styles.scottyIcon} />
</div>
<div className={styles.dialog}>
<AuthenticationDialog registration={false} />
</div>
</div>
)
}
export default LoginPage
import { Collapse, LinearProgress } from "@mui/material"
import { deleteCookie } from "cookies-next"
import { NextPage } from "next"
import { ReactElement, useEffect } from "react"
import AuthenticationDialog from "src/components/auth/AuthenticationDialog"
import ScottyLabsIcon from "src/components/design/ScottyLabsIcon"
import WaveHeader from "src/components/design/WaveHeader"
import styles from "../styles/Auth.module.scss"

const LoginPage: NextPage = (): ReactElement => {
useEffect(() => {
window.localStorage.removeItem("accessToken")
deleteCookie("accessToken")
}, [])
return (
<div>
<WaveHeader />
<div className={styles.scottyContainer}>
<ScottyLabsIcon className={styles.scottyIcon} />
</div>
<div className={styles.dialog}>
<AuthenticationDialog registration={false} />
</div>
</div>
)
}

export default LoginPage
2 changes: 1 addition & 1 deletion src/components/auth/RequestResetDialog/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@
.link:hover {
text-decoration: underline;
filter: brightness(85%);
}
}
Loading
Loading