|
1 |
| -import Link from "next/link"; |
2 |
| -import Image from "next/image"; |
3 | 1 | import { redirect } from "next/navigation";
|
4 | 2 | import { getServerSession } from "next-auth/next";
|
5 |
| -import { headers } from 'next/headers'; |
6 | 3 |
|
7 | 4 | import UserSignOut from "@/components/UserSignOut";
|
8 | 5 | import { authOptions } from "@/app/api/auth/[...nextauth]/route";
|
9 | 6 | import { UserService } from "@/services/UserService";
|
10 | 7 |
|
11 |
| -import qrCodeIcon from "@/assets/icons/qr-code.png"; |
12 |
| -import cameraIconWhite from "@/assets/icons/camera.png"; |
13 |
| -import cameraIconBlue from "@/assets/icons/blueCamera.png"; |
14 |
| - |
15 |
| -import giftBoxIcon from "@/assets/icons/gift-box.png"; |
16 |
| -import attendeeLink from "@/assets/icons/link_card_attendee.png" |
17 |
| -import companyLink from "@/assets/icons/link_card_company.png" |
18 |
| - |
19 |
| -//TODO: add redirects |
20 |
| - |
21 |
| -function RightIcon({ role } : { role: string}) { |
22 |
| - console.log(role) |
23 |
| - switch (role) { |
24 |
| - case "team": |
25 |
| - case "admin": |
26 |
| - return( |
27 |
| - <button className="flex gap-1"> |
28 |
| - <Link href="/"> |
29 |
| - <Image width={25} src={giftBoxIcon} alt="Gift Box Icon" /> |
30 |
| - </Link> |
31 |
| - </button> |
32 |
| - ); |
33 |
| - |
34 |
| - case "user": |
35 |
| - return( |
36 |
| - <button className="flex gap-1"> |
37 |
| - <Link href="/"> |
38 |
| - <Image width={30} src={attendeeLink} alt="Attendee Link Icon" /> |
39 |
| - </Link> |
40 |
| - </button> |
41 |
| - ); |
42 |
| - |
43 |
| - case "company": |
44 |
| - return( |
45 |
| - <button className="flex gap-1"> |
46 |
| - <Link href="/"> |
47 |
| - <Image width={30} src={companyLink} alt="Company Link Icon" /> |
48 |
| - </Link> |
49 |
| - </button> |
50 |
| - ); |
51 |
| - |
52 |
| - default: |
53 |
| - break; |
54 |
| - } |
55 |
| -} |
| 8 | +import ClientBottomNavbar from "./ClientBottomNavbar"; |
56 | 9 |
|
57 | 10 | export default async function BottomNavbar() {
|
58 | 11 | const session = await getServerSession(authOptions);
|
59 | 12 | if (!session) redirect("/login");
|
60 | 13 |
|
61 | 14 | const user: User = await UserService.getMe(session.cannonToken);
|
62 | 15 | if (!user) return <UserSignOut />;
|
63 |
| - |
64 |
| - let headersList = headers(); |
65 |
| - let fullUrl = headersList.get('referer') || ""; |
66 |
| - let urlObject = new URL(fullUrl); |
67 |
| - let path = urlObject.pathname; |
68 |
| - console.log(path) |
69 | 16 |
|
70 | 17 | return (
|
71 |
| - <div className="flex flex-col items-center"> |
72 |
| - <div className={`cameraIcon ${path == "/camera" ? "bg-white" : "bg-dark-blue"}`}> |
73 |
| - <Link className="flex gap-1" href="/camera"> |
74 |
| - <Image width={35} src={path == "/camera" ? cameraIconBlue : cameraIconWhite} alt="Camera Icon" /> |
75 |
| - </Link> |
76 |
| - </div> |
77 |
| - <div className="baseNav"> |
78 |
| - <div className="baseNavIcons"> |
79 |
| - <Link className={`flex gap-1 ${ |
80 |
| - path == "/" |
81 |
| - ? "" |
82 |
| - : "border-dark-blue" |
83 |
| - } border-b-2 pb-1`} href="/"> |
84 |
| - <Image width={30} src={qrCodeIcon} alt="QR Code Icon" /> |
85 |
| - </Link> |
86 |
| - <RightIcon role={user.role}/> |
87 |
| - </div> |
88 |
| - </div> |
89 |
| - </div> |
90 |
| - |
| 18 | + <ClientBottomNavbar user={user} ></ClientBottomNavbar> |
91 | 19 | );
|
92 | 20 | }
|
0 commit comments