-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
77a3628
commit 6b8a2b1
Showing
25 changed files
with
1,646 additions
and
194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
import Header from "@/components/header"; | ||
import React, { Suspense } from "react"; | ||
import { Skeleton } from "@/components/ui/skeleton"; | ||
import Planner from "./ui/planner"; | ||
import { Providers } from "./providers"; | ||
|
||
export default function Home() { | ||
return ( | ||
<main> | ||
<Header /> | ||
|
||
<Suspense fallback={<Skeleton className="h-10 w-[200px]" />}> | ||
<Suspense fallback={<Skeleton className="h-10 w-[200px]" />}> | ||
<Providers> | ||
<Planner /> | ||
</Suspense> | ||
</main> | ||
</Providers> | ||
</Suspense> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use client" | ||
|
||
import {ReactNode, createContext, useContext, useState} from "react"; | ||
import { User } from "@/lib/gql/generated/graphql" | ||
|
||
type UserContextType = { | ||
user: User | null; | ||
setUser: (user: User | null) => void | ||
} | ||
|
||
const UserContext = createContext<UserContextType | undefined>(undefined); | ||
|
||
export const useUser = () => { | ||
const context = useContext(UserContext); | ||
if (!context) { | ||
throw new Error("useUser must be used within a UserProvider"); | ||
} | ||
return context | ||
} | ||
|
||
const UserProvider = ({ children }: { children: ReactNode }) => { | ||
const [user, setUser] = useState<User | null>(null); | ||
|
||
return ( | ||
<UserContext.Provider value={{ user, setUser }}> | ||
{children} | ||
</UserContext.Provider> | ||
); | ||
}; | ||
|
||
export const Providers = ({ children }: { children: ReactNode }) => { | ||
return ( | ||
<UserProvider>{children}</UserProvider> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,38 @@ | ||
import * as React from "react" | ||
import {LucideExternalLink} from "lucide-react"; | ||
"use client" | ||
|
||
import { LucideExternalLink } from "lucide-react"; | ||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { useEffect, useState } from "react"; | ||
|
||
// TODO: add actual links | ||
const Header = () => { | ||
return ( | ||
<div className="w-full h-20 flex flex-row items-center justify-between px-5"> | ||
<Image src="/logo.png" alt="Logo der Fachschaft" width="200" height="20" /> | ||
<span className="flex flex-row items-center justify-between w-fit"> | ||
<Link href="/" className="mr-3">Kontakt</Link> | ||
<Link href="/" className="flex flex-row items-center">Homepage | ||
<LucideExternalLink className="ml-1" size="14"/> | ||
</Link> | ||
</span> | ||
</div> | ||
); | ||
} | ||
|
||
export default Header; | ||
export default function Header() { | ||
const [isClient, setIsClient] = useState(false); | ||
useEffect(() => { | ||
setIsClient(true); | ||
}, []); | ||
|
||
if (!isClient) { | ||
return null; | ||
} | ||
|
||
Header.displayName = "Header" | ||
|
||
export {Header} | ||
return ( | ||
<header className="w-full h-20 flex flex-row items-center justify-between px-5"> | ||
<Image | ||
src="/logo.png" | ||
alt="Logo der Fachschaft" | ||
width="200" | ||
height="20" | ||
/> | ||
<span className="flex flex-row items-center justify-between w-fit"> | ||
<Link href="/" className="mr-3"> | ||
Kontakt | ||
</Link> | ||
<Link href="/" className="flex flex-row items-center"> | ||
Homepage | ||
<LucideExternalLink className="ml-1" size="14" /> | ||
</Link> | ||
</span> | ||
</header> | ||
); | ||
} |
Oops, something went wrong.