Skip to content

Commit

Permalink
userlist
Browse files Browse the repository at this point in the history
  • Loading branch information
xdzqyyds committed Dec 2, 2024
1 parent 459d1df commit 3349f85
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
5 changes: 4 additions & 1 deletion webapp/app.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useAtom } from 'jotai'
import Welcome from './pages/welcome'
import Meeting from './pages/meeting'
import { meetingIdAtom } from './store/atom'
import { meetingIdAtom, isLoggedInAtom } from './store/atom'
import UserList from './components/userlist'

export default function WOOM() {
const [meetingId] = useAtom(meetingIdAtom)
const [isLoggedIn] = useAtom(isLoggedInAtom)

return (
<div
Expand All @@ -14,6 +16,7 @@ export default function WOOM() {
? <Welcome />
: <Meeting meetingId={meetingId} />
}
{isLoggedIn && <UserList />}
</div>
)
}
14 changes: 1 addition & 13 deletions webapp/components/login.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { useState } from 'react'
import { useAtom } from 'jotai'
import { userIdAtom, userPasswordAtom, isLoggedInAtom } from '../store/atom'
import Join from '../components/join'
import UserList from '../components/userlist'
import { getLoginStatus } from '../components/join'
import { login } from '../lib/api'

export default function Login() {
const [userId, setUserId] = useAtom(userIdAtom)
const [password, setPassword] = useAtom(userPasswordAtom)
const [isLoggedIn, setIsLoggedIn] = useAtom(isLoggedInAtom)
const [, setIsLoggedIn] = useAtom(isLoggedInAtom)
const [error, setError] = useState<string | null>(null)

const handleLogin = async () => {
Expand All @@ -31,16 +29,6 @@ export default function Login() {
}
}

if (isLoggedIn) {
return (
<div className="relative">
<Join />
<UserList />
</div>
)
}


return (
<div className="flex flex-col justify-around bg-gray-800/80 p-6 my-4 rounded-lg">
<center className="flex flex-col items-center space-y-4">
Expand Down
11 changes: 10 additions & 1 deletion webapp/pages/welcome.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import Login from '../components/login'
import Join from '../components/join'
import { useAtom } from 'jotai'
import { isLoggedInAtom } from '../store/atom'

export default function Welcome() {
const [isLoggedIn] = useAtom(isLoggedInAtom)

return (
<div className="flex flex-col justify-around min-h-screen">
<center>
<div>
<h1 className="flex justify-center text-white text-5xl font-bold">WOOM</h1>
<p className="text-white">A new meeting</p>
</div >
<Login />
{
!isLoggedIn
? <Login />
: <Join />
}
</center>
</div>
)
Expand Down

0 comments on commit 3349f85

Please sign in to comment.