diff --git a/src/app/auth/login/page.tsx b/src/app/auth/login/page.tsx index 799f21d..b90ab92 100644 --- a/src/app/auth/login/page.tsx +++ b/src/app/auth/login/page.tsx @@ -1,10 +1,11 @@ -"use client"; -import { authOptions } from "@/authOptions"; -import { signIn } from "next-auth/react"; +import { Metadata } from "next"; +import { ProvidersList } from "./providersList"; -const LoginPage = () => { - const provider = authOptions.providers[0]; +export const metadata: Metadata = { + title: "Toogether | Connexion", +}; +export default function LoginPage() { return (
@@ -25,19 +26,8 @@ const LoginPage = () => {

Via

- +
); -}; - -export default LoginPage; +} diff --git a/src/app/auth/login/providersList.tsx b/src/app/auth/login/providersList.tsx new file mode 100644 index 0000000..297dbfb --- /dev/null +++ b/src/app/auth/login/providersList.tsx @@ -0,0 +1,22 @@ +"use client"; + +import { authOptions } from "@/authOptions"; +import { signIn } from "next-auth/react"; + +export const ProvidersList = () => { + const providers = authOptions.providers; + + return ( +
+ {providers.map((provider) => ( + + ))} +
+ ); +}; diff --git a/src/app/components/Header/index.tsx b/src/app/components/Header/index.tsx index 2cfe046..e88053b 100644 --- a/src/app/components/Header/index.tsx +++ b/src/app/components/Header/index.tsx @@ -1,4 +1,4 @@ -'use client'; +"use client"; import { Avatar, Button, @@ -9,24 +9,24 @@ import { Navbar, NavbarBrand, NavbarContent, - NavbarItem -} from '@nextui-org/react'; -import { useSession } from 'next-auth/react'; -import { ThemeSwitcher } from '../ThemeSwitcher/ThemeSwitcher'; -import { axiosInstance } from '@/app/lib/axios'; -import { useEffect, useState } from 'react'; -import { useRouter } from 'next/navigation'; + NavbarItem, +} from "@nextui-org/react"; +import { useSession } from "next-auth/react"; +import { ThemeSwitcher } from "../ThemeSwitcher/ThemeSwitcher"; +import { axiosInstance } from "@/app/lib/axios"; +import { useEffect, useState } from "react"; +import { useRouter } from "next/navigation"; const getInitials = (name: string) => { - if (!name) return ''; + if (!name) return ""; - const nameParts = name.split(' '); + const nameParts = name.split(" "); if (nameParts.length === 1) { return name; } - const firstInitial = nameParts[0]?.[0] || ''; - const secondInitial = nameParts[1]?.[0] || nameParts[0]?.[1] || ''; + const firstInitial = nameParts[0]?.[0] || ""; + const secondInitial = nameParts[1]?.[0] || nameParts[0]?.[1] || ""; return firstInitial + secondInitial; }; @@ -38,39 +38,39 @@ export const Header = () => { const [userProfile, setUserProfile] = useState<{ id: string; username: string; - role: 'ADMIN' | 'STUDENT'; + role: "ADMIN" | "STUDENT"; }>(); - const initials = session?.user?.name ? getInitials(session.user.name) : ''; + const initials = session?.user?.name ? getInitials(session.user.name) : ""; const fetchUserProfile = async () => { return await axiosInstance<{ id: string; username: string; - role: 'ADMIN' | 'STUDENT'; - }>('/@me'); + role: "ADMIN" | "STUDENT"; + }>("/@me"); }; useEffect(() => { - fetchUserProfile().then(r => { + fetchUserProfile().then((r) => { setUserProfile(r.data); }); }, []); return ( - + -

Toogether

+

Toogether

- - {userProfile?.role === 'ADMIN' ? ( + + {userProfile?.role === "ADMIN" ? ( @@ -80,29 +80,29 @@ export const Header = () => { - + - - + +

Signed in as

-

+

{session?.user?.name}

- Settings + Settings Logout diff --git a/src/app/components/Room/Card.tsx b/src/app/components/Room/Card.tsx index 8e68d08..57ed1b7 100644 --- a/src/app/components/Room/Card.tsx +++ b/src/app/components/Room/Card.tsx @@ -1,6 +1,6 @@ -'use client'; +"use client"; -import { parseDate, Time } from '@internationalized/date'; +import { parseDate, Time } from "@internationalized/date"; import { Button, @@ -9,56 +9,56 @@ import { CardHeader, DateInput, Divider, - TimeInput -} from '@nextui-org/react'; -import { Room } from './Room'; -import moment from 'moment'; -import { useRouter } from 'next/navigation'; + TimeInput, +} from "@nextui-org/react"; +import { Room } from "./Room"; +import moment from "moment"; +import { useRouter } from "next/navigation"; export const RoomCard = ({ id, name, date, Times, Presentator }: Room) => { const router = useRouter(); return ( - + -
-

{name}

-

+

+

{name}

+

{Presentator.username}

-
+
- {Times.map(time => ( + {Times.map((time) => (
-
+
- @@ -68,13 +68,13 @@ export const RoomCard = ({ id, name, date, Times, Presentator }: Room) => {
{moment(date).dayOfYear() === moment().dayOfYear() && ( -
+
); }; diff --git a/src/app/page.tsx b/src/app/page.tsx index bd6ceeb..54687c1 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -1,18 +1,18 @@ -import { Metadata } from 'next'; -import { Header } from './components/Header'; -import { RoomTable } from './components/Room/Table'; +import { Metadata } from "next"; +import { Header } from "./components/Header"; +import { RoomTable } from "./components/Room/Table"; export const metadata: Metadata = { - title: 'Toogether | Home', + title: "Toogether | Home", description: - 'Toogether is a platform that allows you to create and join rooms to study together.' + "Toogether is a platform that allows you to create and join rooms to study together.", }; -export default function HomePage () { +export default function HomePage() { return ( <>
-
+