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

Carousel #19

Open
wants to merge 5 commits 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
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "portfolio-d2956"
}
}
76 changes: 1 addition & 75 deletions app/globals.css
Original file line number Diff line number Diff line change
@@ -1,78 +1,4 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 222.2 84% 4.9%;

--muted: 210 40% 96.1%;
--muted-foreground: 215.4 16.3% 46.9%;

--popover: 0 0% 100%;
--popover-foreground: 222.2 84% 4.9%;

--card: 0 0% 100%;
--card-foreground: 222.2 84% 4.9%;

--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;

--primary: 222.2 47.4% 11.2%;
--primary-foreground: 210 40% 98%;

--secondary: 210 40% 96.1%;
--secondary-foreground: 222.2 47.4% 11.2%;

--accent: 210 40% 96.1%;
--accent-foreground: 222.2 47.4% 11.2%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 40% 98%;

--ring: 215 20.2% 65.1%;

--radius: 0.5rem;
}

.dark {
--background: 222.2 84% 4.9%;
--foreground: 210 40% 98%;

--muted: 217.2 32.6% 17.5%;
--muted-foreground: 215 20.2% 65.1%;

--popover: 222.2 84% 4.9%;
--popover-foreground: 210 40% 98%;

--card: 222.2 84% 4.9%;
--card-foreground: 210 40% 98%;

--border: 217.2 32.6% 17.5%;
--input: 217.2 32.6% 17.5%;

--primary: 210 40% 98%;
--primary-foreground: 222.2 47.4% 11.2%;

--secondary: 217.2 32.6% 17.5%;
--secondary-foreground: 210 40% 98%;

--accent: 217.2 32.6% 17.5%;
--accent-foreground: 210 40% 98%;

--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 85.7% 97.3%;

--ring: 217.2 32.6% 17.5%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}

11 changes: 1 addition & 10 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import './globals.css'
import type { Metadata } from 'next'
import { Inter } from 'next/font/google'

const inter = Inter({ subsets: ['latin'] })

export const metadata: Metadata = {
title: 'Create Next App',
description: 'Generated by create next app',
}

export default function RootLayout({
children,
Expand All @@ -16,7 +7,7 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<body>{children}</body>
</html>
)
}
48 changes: 10 additions & 38 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,15 @@
"use client"

import Image from 'next/image'
import { Button } from "@/components/ui/button"
import { NavigationMenu } from "@/components/ui/navigation-menu"
import { Menubar } from "@/components/ui/menubar"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select"

import HeroSection from '@/components/normal/hero'

"use client";
import React from "react";
import HeroSection from "@/components/normal/hero";
import NavbarComponent from "../components/navbar/navbar";
import AuthWrapper from "@/components/auth/auth";
import MainCarousel from "@/components/carousel/carousel";
export default function Home() {
return (
<main className="">
{/* <Button style={{ color: "red", background: "green" }}>CTA</Button> */}

{/* <Card className="w-[350px]">
<CardHeader>
<CardTitle>Create project</CardTitle>
<CardDescription>Deploy your new project in one-click.</CardDescription>
</CardHeader>
<CardContent>
<form>
<div className="grid w-full items-center gap-4">
<div className="flex flex-col space-y-1.5">
<Label htmlFor="name">Name</Label>
<Input id="name" placeholder="Name of your project" />
</div>
</div>
</form>
</CardContent>
<CardFooter className="flex justify-between">
<Button variant="outline">Cancel</Button>
<Button>Deploy</Button>
</CardFooter>
</Card> */}

<main>
<NavbarComponent />
<MainCarousel/>
<HeroSection />
</main>
)
);
}
6 changes: 6 additions & 0 deletions app/speakers/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from "react";


export default function Speakers(){
return <>Hello World</>
}
104 changes: 104 additions & 0 deletions components/auth/auth.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
"use client";
import React, { useEffect, useState } from "react";
import { getAuth, Auth } from "firebase/auth";
import { app} from "../firebase/firebase";

import {
getFirestore,
collection,
addDoc,
where,
query,
getDocs
} from "firebase/firestore";
import { usePathname, useRouter } from "next/navigation";
import { PUBLIC_ROUTES } from "../routes/routes";

export default function AuthWrapper({
children,
}: {
children: React.ReactNode;
}) {
const router = useRouter();
const pathName: string = usePathname() || "";
const [loggedIn, setLoggedIn] = useState(false);
const [loginChecked, setLoginChecked] = useState(false);
const [loading, setLoading] = useState<Boolean>(false);
const auth: Auth = getAuth(app);

const checkAuthState = async () => {
const currentUser = auth.currentUser;
console.log(currentUser)
const database = getFirestore(app);
const queryData: any = query(
collection(database, "users"),
where("name", "==", currentUser?.email)
);
console.log(queryData)
getDocs(queryData)
.then((data: any) => {
if (data.empty) {
addDoc(collection(database, "users"), currentUser)
.then((docRef) => {
console.log(`Document added with id : ${docRef}`);
})
.catch((err) => {
console.log(err);
});
}
else{
console.log("User already exists");
}
})
.catch((err: any) => {
console.log(err);
});

// If user is not logged in
if (!currentUser) {
setLoggedIn(false);
setLoginChecked(true);
}
};

auth.onAuthStateChanged(async function (user) {
if (!(pathName in PUBLIC_ROUTES)) {
checkAuthState();
}
});

useEffect(() => {
if (loggedIn && pathName in PUBLIC_ROUTES) router.push("/");
}, [loggedIn]);

useEffect(() => {
if (loginChecked) {
// Check if the route is public or not
if (!loggedIn && !(pathName in PUBLIC_ROUTES)) {
router.push("/login");
} else if (loggedIn && pathName in PUBLIC_ROUTES) {
router.push("/");
} else {
setLoading(false);
}
}
}, [loginChecked]);

useEffect(() => {
if (pathName in PUBLIC_ROUTES) {
setLoading(false);
}
}, [pathName]);

return (
<>
{loading ? (
<div className="h-[100vh] w-full">
<h1>Hello World</h1>
</div>
) : (
<>{children}</>
)}
</>
);
}
26 changes: 26 additions & 0 deletions components/carousel/carousel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import { Carousel } from "@mantine/carousel";
import { IconArrowRight, IconArrowLeft } from "@tabler/icons-react";

export default function MainCarousel() {
return (
<Carousel
mx="auto"
withIndicators
height={200}
className="p-2"
nextControlIcon={<IconArrowRight size={20} />}
previousControlIcon={<IconArrowLeft size={20} />}
>
<Carousel.Slide className="flex justify-center">
<img src="https://media.istockphoto.com/id/1146517111/photo/taj-mahal-mausoleum-in-agra.jpg?s=612x612&w=0&k=20&c=vcIjhwUrNyjoKbGbAQ5sOcEzDUgOfCsm9ySmJ8gNeRk="></img>
</Carousel.Slide>
<Carousel.Slide className="flex justify-center">
<img src="https://media.istockphoto.com/id/1146517111/photo/taj-mahal-mausoleum-in-agra.jpg?s=612x612&w=0&k=20&c=vcIjhwUrNyjoKbGbAQ5sOcEzDUgOfCsm9ySmJ8gNeRk="></img>
</Carousel.Slide>
<Carousel.Slide className="flex justify-center">
<img src="https://media.istockphoto.com/id/1146517111/photo/taj-mahal-mausoleum-in-agra.jpg?s=612x612&w=0&k=20&c=vcIjhwUrNyjoKbGbAQ5sOcEzDUgOfCsm9ySmJ8gNeRk="></img>
</Carousel.Slide>
</Carousel>
);
}
20 changes: 20 additions & 0 deletions components/firebase/firebase.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import firebase from "firebase/compat/app";
import "firebase/firestore";


const app = firebase.initializeApp({
apiKey: "AIzaSyD0p1bNaCfVeP5M2RPiiZVqKarjEZwm9CA",
authDomain: "portfolio-d2956.firebaseapp.com",
projectId: "portfolio-d2956",
storageBucket: "portfolio-d2956.appspot.com",
messagingSenderId: "819926489468",
appId: "1:819926489468:web:355ab8114761a2d51bacf9",
measurementId: "G-QKS84BFJKL",
});


export {app};




Loading