Skip to content

Commit

Permalink
next 12 configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-prog committed Jul 22, 2023
1 parent 7e2685a commit cccdf46
Show file tree
Hide file tree
Showing 40 changed files with 160 additions and 109 deletions.
3 changes: 1 addition & 2 deletions middleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import { withAuth } from "next-auth/middleware"
import { NextRequest, NextResponse } from "next/server"
import { getToken } from "next-auth/jwt"
Expand All @@ -8,7 +7,7 @@ export default withAuth(
async function middleware (req: NextRequest) {
const token = await getToken({ req })
const isAuthenticated = !!token;

if (!isAuthenticated) {
const response = NextResponse.json(
{ statusText: "UnAuthorized" },
Expand Down
7 changes: 3 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/** @type {import('next').NextConfig} */

const nextConfig = {

/* config options here */
}

module.exports = nextConfig
module.exports = nextConfig
122 changes: 100 additions & 22 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
"postcss": "8.4.25",
"react": "18.2.0",
"react-dom": "18.2.0",
"tailwindcss": "3.3.2",
"typescript": "5.1.6"
},
"devDependencies": {
"eslint": "8.44.0",
"eslint-config-next": "13.4.9"
"eslint-config-next": "13.4.9",
"tailwindcss": "^3.3.3"
}
}
File renamed without changes.
6 changes: 6 additions & 0 deletions pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import Bottom from './_components/Bottom'
import { SocialList } from './_template_data/Social'

import { SessionProvider } from "next-auth/react"
import Head from 'next/head';


<Head>
<link rel="shortcut icon" href="/images/favicon.ico" />
</Head>


export default function App({ Component, pageProps,}: AppProps<{ session: Session }>) {
Expand Down
7 changes: 1 addition & 6 deletions pages/_components/About.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Image from "next/image"
import { AboutType } from "../_template_data/About"


Expand All @@ -7,14 +6,10 @@ export default function About({ data, AboutImage }: { data: AboutType, AboutImag
<div id="about" className='page component'>
<div className='row'>
<div className='col flex-1 max-md:flex-none items-center justify-center w-[90%]'>
<Image
<img
src={AboutImage}
alt="About image"
width={200}
height={160}
className="w-[40vw] max-md:w-full max-md:mb-10 border-gray-800 border-8"
placeholder="blur"
blurDataURL={AboutImage}
/>
</div>
<div className='col flex-1 max-md:flex-none max-md:mt-6 items-center justify-center'>
Expand Down
5 changes: 1 addition & 4 deletions pages/_components/Bottom.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
import Image from "next/image"
import { SocialType } from "../_template_data/Social"


export default function Bottom({ Logo, SocialList }: { Logo: string, SocialList: SocialType[] }) {
return (
<div className='row justify-between px-4 py-4 bottom-0 w-full bg-[#1d242b]'>
<div>
<Image
<img
src={Logo}
alt="bottom navbar logo"
width={200}
height={160}
className="w-12 h-12 m-6"
placeholder="blur"
blurDataURL={Logo}
/>
</div>
<div className='row items-start h-full py-6 max-md:col text-white'>
Expand Down
28 changes: 11 additions & 17 deletions pages/_components/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'flowbite'

import Image from "next/image"
import Link from 'next/link'

import { useSession, signIn } from "next-auth/react"


Expand All @@ -12,17 +9,14 @@ export default function Navbar({ Logo }: { Logo: string }) {
return (
<nav className="absolute top-0 w-full py-4">
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<Link href={"/"} className="flex items-center">
<Image
src={Logo}
alt="navbar logo"
width={200}
height={160}
className="w-12 h-12"
placeholder="blur"
blurDataURL={Logo}
/>
</Link>
<a href={"/"} className="flex items-center">
<div>
<img
src={Logo}
className="w-12 h-12"
/>
</div>
</a>
<button data-collapse-toggle="navbar-default" type="button" className="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 md:hidden hover:bg-gray-100 focus:outline-none dark:text-gray-800 dark:hover:bg-gray-300" aria-controls="navbar-default" aria-expanded="false">
<span className="sr-only">Open main menu</span>
<svg className="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 17 14">
Expand All @@ -47,11 +41,11 @@ export default function Navbar({ Logo }: { Logo: string }) {
<a href="#faq" className="max-md:text-white block py-2 pl-3 pr-4 text-gray-900 hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">FAQ</a>
</li>
<li>
<Link href={"/team"} className="max-md:text-white block py-2 pl-3 pr-4 max-md:mb-2 text-gray-900 hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Team</Link>
<a href={"/team"} className="max-md:text-white block py-2 pl-3 pr-4 max-md:mb-2 text-gray-900 hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-blue-700 md:p-0 md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Team</a>
</li>
<li className='mr-6 max-md:pb-2 max-md:mb-1'>
<li className='mr-6 my-2 max-md:pb-2 max-md:mb-1'>
{session ?
<Link href={"/dashboard"} className="text-[#e9e9e9] bg-[#262d3b] py-2 px-7 border-[#45546e] border-4">Dashboard</Link>
<a href={"/dashboard"} className="text-[#e9e9e9] bg-[#262d3b] py-2 px-7 border-[#45546e] border-4">Dashboard</a>
:
<button onClick={() => signIn("descope", { callbackUrl: "/dashboard" })} className="text-[#e9e9e9] bg-[#262d3b] py-2 px-7 border-[#45546e] border-4">Apply</button>
}
Expand Down
7 changes: 1 addition & 6 deletions pages/_components/Speakers.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Image from "next/image"
import { SpeakerType } from '../_template_data/Speakers'


Expand All @@ -10,14 +9,10 @@ export default function Speakers({ data }: { data: SpeakerType[] }) {
{data.map((obj, i) => (
<div key={i} className='row h-full w-[30%] max-md:w-[90%] m-3 bg-gray-200'>
<div className='col flex-1 max-md:flex-none'>
<Image
<img
src={obj.img}
alt="speaker img"
width={200}
height={160}
className="w-[20vh] h-[20vh] max-md:w-full max-md:h-full object-cover"
placeholder="blur"
blurDataURL={obj.img}
/>
</div>
<div className='col flex-1 max-md:flex-none p-6'>
Expand Down
7 changes: 1 addition & 6 deletions pages/_components/Sponsors.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Image from "next/image"
import { SponsorType } from '../_template_data/Sponsor'


Expand All @@ -9,14 +8,10 @@ export default function Sponsors({ data }: { data: SponsorType[] }) {
<div className='row w-full'>
{data.map((obj, i) => (
<div key={i} className='row justify-start m-10'>
<Image
<img
src={obj.img}
alt="sponsor img"
width={200}
height={160}
className="w-[35vh] object-cover"
placeholder="blur"
blurDataURL={obj.img}
/>
</div>
))}
Expand Down
53 changes: 25 additions & 28 deletions pages/api/airtable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,39 @@ import Airtable from 'airtable'
import { NextApiRequest, NextApiResponse } from 'next'


export default function handler(request: NextApiRequest, response: NextApiResponse) {
console.log("BOB")
export default async function handler(request: NextApiRequest, response: NextApiResponse) {
const API_KEY = process.env.AIRTABLE_PERSONAL_ACCESS_TOKEN
const AIRTABLE_BASE = process.env.AIRTABLE_BASE
const AIRTABLE_VIEW = process.env.AIRTABLE_TABLE_NAME

const base = new Airtable({apiKey: API_KEY}).base(AIRTABLE_BASE || "");
const { searchParams } = new URL(request.url || "")
const email = searchParams.get('email')

console.log("Email: ", email)
const email = request.query.email

// const res = await base(AIRTABLE_VIEW || "")
// .select({ filterByFormula: `email="${email}"`})
// .firstPage()
// .then((records) => {
// if (records.length === 0) {
// return "None"
// }
// return records
// })
// .catch((err: any) => {
// console.log(err)
// return err;
// });
const res = await base(AIRTABLE_VIEW || "")
.select({ filterByFormula: `email="${email}"`})
.firstPage()
.then((records) => {
if (records.length === 0) {
return "None"
}
return records
})
.catch((err: any) => {
console.log(err)
return err;
});

const res = [{
"fields": {
"Name": 'Descope',
"University": 'University of Waterloo',
"What year are you?": 'First year',
"Email": '[email protected]',
'Why AuthHacks?': "Authentication is a fundamental part of any startup, SaaS, or business. The workshops and connections I'll make will profoundly broaden my knowledge of good security practices and industry leaders.",
'Accepted': true
}
}]
// const res = [{
// "fields": {
// "Name": 'Descope',
// "University": 'University of Waterloo',
// "What year are you?": 'First year',
// "Email": '[email protected]',
// 'Why AuthHacks?': "Authentication is a fundamental part of any startup, SaaS, or business. The workshops and connections I'll make will profoundly broaden my knowledge of good security practices and industry leaders.",
// 'Accepted': true
// }
// }]

return response.status(200).json(
{
Expand Down
2 changes: 1 addition & 1 deletion pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import NextAuth from "next-auth/next";
import { authOptions } from "../../_utils/options";


export default NextAuth(authOptions);
export default NextAuth(authOptions)

6 changes: 2 additions & 4 deletions pages/dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function Dashboard({ airtableRecord }: { airtableRecord: any }) {


export async function getServerSideProps(context: any) {
console.log("Context: ", context)
const session = await getServerSession(context.req, context.res, authOptions)
const headers = context.req.headers

Expand All @@ -52,10 +51,9 @@ export async function getServerSideProps(context: any) {
const res = await fetch(`${process.env.NEXTAUTH_URL}/api/airtable?email=${email}`, {
headers: headers
})

console.log(res)

const data = await res.json()
const airtableRecord = data.body;
const airtableRecord = data.body || null;

return { props: { airtableRecord } }
}
2 changes: 2 additions & 0 deletions pages/globals.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import url('https://fonts.googleapis.com/css2?family=Silkscreen&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
Expand Down Expand Up @@ -32,4 +33,5 @@ html, body {
linear-gradient(to right, rgb(190, 190, 190) 20%, rgb(243, 243, 243) 20%);
background-size: 10px 10px, 10px 10px;
scroll-behavior: smooth;
font-family: 'Silkscreen', cursive;
}
7 changes: 1 addition & 6 deletions pages/team.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Image from "next/image"
import { TeamList } from "./_template_data/Team"


Expand All @@ -9,14 +8,10 @@ export default function Team() {
<div className="flex flex-row w-full items-start justify-center h-full">
{TeamList.map((person, i) => (
<div key={i} className="w-1/4 max-md:w-[80%]">
<Image
<img
src={person.image}
alt="pfp"
width={200}
height={160}
className="w-full"
placeholder="blur"
blurDataURL={person.image}
/>
<div className="w-full break-all">
<p className="my-4 text-2xl">{person.name} / <span className='text-[#207ceb]'>{person.role}</span></p>
Expand Down
Binary file added public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/accepted_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/accepted_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/airtable.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/airtable_base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/airtable_form_fields.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/application_pending.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks_5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/authhacks_6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/create_token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/embed_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/embed_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/signup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/table_name.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/team.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added readme-assets/template_data.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module.exports = {
content: [
'./pages/**/*.{js,ts,jsx,tsx,mdx}',
'./components/**/*.{js,ts,jsx,tsx,mdx}',
'./app/**/*.{js,ts,jsx,tsx,mdx}',
'./node_modules/flowbite/**/*.js'
],
plugins: [
Expand Down

0 comments on commit cccdf46

Please sign in to comment.