Skip to content

Commit 2eb5177

Browse files
fix: caption timer, navbar auth button
1 parent 9082d5a commit 2eb5177

File tree

4 files changed

+44
-7
lines changed

4 files changed

+44
-7
lines changed

src/components/captions/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const Captions: React.FC<Props> = ({
5858
}, [transcriptionQueue]);
5959

6060
return (
61-
<div className="closed-captions-wrapper">
61+
<div className="closed-captions-wrapper z-50">
6262
<div className="closed-captions-container">
6363
{caption?.message ? (
6464
<>

src/components/navbar/index.tsx

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@ import CharacterAnimation from "../animation/character";
44
import { BiMenuAltRight as MenuIcon } from "react-icons/bi";
55
import { AiOutlineClose as XIcon } from "react-icons/ai";
66
import { useState } from "react";
7+
import { signIn, signOut } from "next-auth/react";
8+
import { Session } from "next-auth";
79

8-
const Navbar = () => {
10+
const Navbar = ({
11+
status,
12+
session,
13+
}: {
14+
status: "loading" | "authenticated" | "unauthenticated";
15+
session: Session | null;
16+
}) => {
917
const links = [
1018
{
1119
label: "Home",
@@ -43,7 +51,7 @@ const Navbar = () => {
4351
<span className={`font-bold text-white`}>Jab We Meet</span>
4452
</Link>
4553

46-
<div className="hidden space-x-6 text-white lg:flex">
54+
<div className="hidden space-x-6 text-white lg:flex lg:items-center">
4755
{links.map((link) => (
4856
<Link
4957
className="transition-colors duration-300 hover:text-white"
@@ -56,7 +64,20 @@ const Navbar = () => {
5664
/>
5765
</Link>
5866
))}
67+
<button
68+
className="rounded-md bg-white bg-opacity-30 p-2 text-white"
69+
onClick={() => {
70+
if (status === "authenticated") {
71+
signOut();
72+
} else {
73+
signIn("google");
74+
}
75+
}}
76+
>
77+
{status === "authenticated" ? "Sign Out" : "Sign In"}
78+
</button>
5979
</div>
80+
6081
<div className="flex items-center space-x-4 lg:hidden">
6182
{isMenuOpen ? (
6283
<XIcon className="h-6 w-6 text-white" onClick={toggleMenu} />
@@ -67,7 +88,7 @@ const Navbar = () => {
6788
</div>
6889

6990
{isMenuOpen && (
70-
<div>
91+
<div className="flex flex-col space-y-2 p-5 text-white lg:hidden">
7192
{links.map((link) => (
7293
<Link
7394
key={link.path}
@@ -77,6 +98,18 @@ const Navbar = () => {
7798
{link.label}
7899
</Link>
79100
))}
101+
<button
102+
className="w-fit rounded-md bg-white bg-opacity-30 p-2 text-white"
103+
onClick={() => {
104+
if (status === "authenticated") {
105+
signIn("google");
106+
} else {
107+
signOut();
108+
}
109+
}}
110+
>
111+
{status === "authenticated" ? "Sign Out" : "Sign In"}
112+
</button>
80113
</div>
81114
)}
82115
</div>

src/pages/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import type { NextPage } from "next";
2+
import { useSession } from "next-auth/react";
23
import { useRouter } from "next/router";
34
import React from "react";
45
import Typing from "~/components/animation/typing";
56
import Navbar from "~/components/navbar";
67
import { api } from "~/utils/api";
78

89
function ConnectionTab() {
10+
const { data: session, status } = useSession();
911
const createRoom = api.rooms.createRoom.useMutation();
1012
const router = useRouter();
1113

@@ -14,11 +16,13 @@ function ConnectionTab() {
1416
router.push(`/rooms/${data.roomName}`);
1517
};
1618

19+
if (status === "loading") return <div>Loading...</div>;
20+
1721
return (
1822
<>
19-
<Navbar />
23+
<Navbar status={status} session={session} />
2024
<div className="flex h-full w-full flex-col items-center justify-center space-y-4 p-4">
21-
<Typing/>
25+
<Typing />
2226

2327
<p className="text-sm text-gray-400">
2428
Multilingual Video Conferencing App

src/pages/rooms/[name].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const Home: NextPage = () => {
5757
return (
5858
<>
5959
<Head>
60-
<title>LiveKit Meet</title>
60+
<title>Jab We Meet</title>
6161
<link rel="icon" href="/favicon.ico" />
6262
</Head>
6363

0 commit comments

Comments
 (0)