-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat backend+Frontend added #16
base: backend-development
Are you sure you want to change the base?
Changes from 10 commits
bc1a58a
283f205
98bd3ae
c7ce1b8
65945a3
59f83b8
4c6b8c6
168536f
59f5198
1555f5b
7e0b6c0
e9132d4
1f49928
8fc20f0
cd1db61
5efd4b3
55ec1f5
708358b
3e898a6
a95dd39
2f9e14f
5268cf5
c715186
12d846b
88ef5ea
63815d6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @dongjin2008 Remove all changes here |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,12 @@ | |
"@total-typescript/ts-reset": "^0.5.1", | ||
"clsx": "^2.0.0", | ||
"convex": "^1.2.1", | ||
"next": "^13.4.2", | ||
"dotenv": "^16.3.1", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove this dependency |
||
"next": "^13.4.19", | ||
"openai": "^4.5.0", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"valtio": "^1.11.2", | ||
"zod": "^3.21.4" | ||
}, | ||
"devDependencies": { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
"use client"; | ||
import { ReactNode } from "react"; | ||
import { ConvexProvider, ConvexReactClient } from "convex/react"; | ||
import * as process from "process"; | ||
|
||
const convex = new ConvexReactClient(process.env.NEXT_PUBLIC_CONVEX_URL!); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls. use the ~/env.mjs file not dotenv!!! no process.env! |
||
|
||
export default function ConvexClientProvider({ | ||
children, | ||
}: { | ||
children: ReactNode; | ||
}) { | ||
return <ConvexProvider client={convex}>{children}</ConvexProvider>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use client"; | ||
import React from "react"; | ||
import Navbar from "../../../ui/navbar"; | ||
import Profile from "../../../ui/Profile"; | ||
import { useSnapshot } from "valtio"; | ||
import { state } from "~/app/state"; | ||
|
||
export default function playerLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
const snap = useSnapshot(state); | ||
return ( | ||
<section className="h-screen px-10 py-14 flex flex-col"> | ||
<Navbar> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need the navbar component? Pls. remove the navbar component and put the logic into this file. Or you have a good reason to do it. |
||
<Profile type="nav" initial={snap.user.charAt(0).toUpperCase()} /> | ||
<Profile type="nav" initial={snap.user.charAt(0).toUpperCase()} /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pls. make them into buttons! Use the ~/ui/button for that |
||
<Profile type="nav" initial={snap.user.charAt(0).toUpperCase()} /> | ||
</Navbar> | ||
{children} | ||
</section> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import Chat from "~/ui/chat"; | ||
|
||
export default function RoomPage({ params }: { params: { slug: string } }) { | ||
return ( | ||
<main className="h-full flex justify-between min-h-0 gap-12"> | ||
<div className="h-full w-full"></div> | ||
<Chat roomId={params.slug} /> | ||
</main> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { proxy } from "valtio"; | ||
|
||
export const state = proxy({ | ||
playerId: "", | ||
setPlayerId: (id: string) => { | ||
state.playerId = id; | ||
}, | ||
|
||
user: "", | ||
setUsername: (username: string) => { | ||
state.user = username; | ||
}, | ||
}); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename this file to profile.tsx |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const Profile = ({ type, initial }) => { | ||
return ( | ||
<div> | ||
{type === "nav" && ( | ||
<div className="flex flex-col items-center justify-center w-[99px] h-[79px] bg-primary rounded-3xl"> | ||
<div className="w-[46px] h-[46px] bg-background rounded-full flex justify-center items-center"> | ||
<p className="text-primary font-extrabold text-2xl">{initial}</p> | ||
</div> | ||
</div> | ||
)} | ||
{type === "chat" && ( | ||
<div className="w-[37px] h-[37px] bg-background rounded-full flex justify-center items-center"> | ||
<p className="text-primary font-extrabold text-2xl">{initial}</p> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Profile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dongjin2008 Remove all changes here