-
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
feat: create dashboard servers #40
base: main
Are you sure you want to change the base?
Changes from 7 commits
6fbac1a
7f6d6f0
e7a40d4
b0fa809
111a03c
1a597bf
f193833
e1ad1d2
4773e20
b4f237b
ecbebe3
939fba2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export class SerializedUser { | ||
id: number; | ||
name: string; | ||
username: string; | ||
email: string; | ||
|
||
// biome-ignore lint/suspicious/noExplicitAny: <explanation> | ||
constructor(user: any) { | ||
// TODO: fix any | ||
|
||
this.id = user.id; | ||
this.name = user.name; | ||
this.username = user.username; | ||
this.email = user.email; | ||
} | ||
} | ||
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. Don't import |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
import { checkChannel } from "@/lib/utils"; | ||
import { useRouter } from "@tanstack/react-router"; | ||
import { Channels } from "../servers-layout/channels"; | ||
import Chat from "../servers-layout/chat"; | ||
import { Sidebar } from "./sidebar"; | ||
|
||
export const Servers = () => { | ||
const user = { | ||
id: 1, | ||
username: "Amr", | ||
profile_image_url: "https://placebear.com/200/200", | ||
bio: "#AmrShoukry", | ||
status: "online", | ||
}; | ||
|
||
const server = { | ||
id: 1, | ||
name: "Active Courses", | ||
image_url: "https://placebear.com/200/200", | ||
channels: [ | ||
{ | ||
id: 1, | ||
name: "HTML", | ||
users: [ | ||
{ | ||
id: 1, | ||
username: "Amr", | ||
profile_image_url: "https://placebear.com/200/200", | ||
status: "online", | ||
}, | ||
{ | ||
id: 2, | ||
username: "Moaz", | ||
profile_image_url: "https://placebear.com/200/200", | ||
status: "online", | ||
}, | ||
{ | ||
id: 3, | ||
username: "Ali", | ||
profile_image_url: "https://placebear.com/200/200", | ||
status: "offline", | ||
}, | ||
], | ||
messages: [ | ||
{ | ||
id: 1, | ||
user_image: "https://placebear.com/200/200", | ||
username: "Amr", | ||
timestamp: "Yesterday at 2:13 PM", | ||
content_string: | ||
"Lorem ipsum dolor sit amet consectetur adipisicing.", | ||
}, | ||
{ | ||
id: 2, | ||
user_image: "https://placebear.com/200/200", | ||
username: "Ali", | ||
timestamp: "Yesterday at 2:15 PM", | ||
content_string: | ||
"Lorem ipsum dolor sit consectetur adipisicing.", | ||
}, | ||
], | ||
}, | ||
{ | ||
id: 2, | ||
name: "CSS", | ||
users: [ | ||
{ | ||
id: 1, | ||
username: "Amr", | ||
profile_image_url: "https://placebear.com/200/200", | ||
status: "online", | ||
}, | ||
{ | ||
id: 2, | ||
username: "Moaz", | ||
profile_image_url: "https://placebear.com/200/200", | ||
status: "online", | ||
}, | ||
{ | ||
id: 3, | ||
username: "Ali", | ||
profile_image_url: "https://placebear.com/200/200", | ||
status: "offline", | ||
}, | ||
], | ||
messages: [ | ||
{ | ||
id: 1, | ||
user_image: "https://placebear.com/200/200", | ||
username: "Moaz", | ||
timestamp: "Yesterday at 2:13 PM", | ||
content_string: | ||
"Lorem ipsum dolor sit amet consectetur adipisicing.", | ||
}, | ||
{ | ||
id: 2, | ||
user_image: "https://placebear.com/200/200", | ||
username: "Ali", | ||
timestamp: "Yesterday at 2:15 PM", | ||
content_string: | ||
"Lorem ipsum dolor sit consectetur adipisicing.", | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
const router = useRouter(); | ||
const currentUrl = router.state.location.pathname; | ||
const isChannel = checkChannel(currentUrl); | ||
|
||
// Listen for route changes and update state accordingly | ||
|
||
return ( | ||
<div className="flex overflow-hidden"> | ||
<Sidebar /> | ||
<Channels server={server} user={user} /> | ||
{isChannel ? ( | ||
<Chat /> | ||
) : ( | ||
<p className="hidden w-full items-center justify-center bg-mainBlackHover md:flex"> | ||
Please Select A Channel To Continue | ||
</p> | ||
)} | ||
</div> | ||
); | ||
}; |
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. If a sever is active I don't need a hover effect, the white bar will be large if it's active and small if it's not. |
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. In small screens not all the content of the navbar is visible. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Link } from "@tanstack/react-router"; | ||
import React, { FC } from "react"; | ||
import BackSVG from "../svgs/back"; | ||
import BellMutedSVG from "../svgs/channel-bar/bell-muted"; | ||
import ChannelSVG from "../svgs/channel-bar/channel"; | ||
import HelpSVG from "../svgs/channel-bar/help"; | ||
import InboxSVG from "../svgs/channel-bar/inbox"; | ||
import PinSVG from "../svgs/channel-bar/pin"; | ||
import ThreadsSVG from "../svgs/channel-bar/threads"; | ||
import UsersSVG from "../svgs/channel-bar/users"; | ||
|
||
interface ChannelBarProps { | ||
setIsExpanded: React.Dispatch<React.SetStateAction<boolean>>; | ||
} | ||
|
||
export const ChannelBar: FC<ChannelBarProps> = ({ setIsExpanded }) => { | ||
const serverId = 1; | ||
return ( | ||
<div className="custom-scrollbar flex h-[56px] items-center justify-between gap-[8px] overflow-x-auto border-b-[#000] border-b-[1px] border-b-solid bg-secondBlack px-[16px]"> | ||
<div className="flex items-center gap-[8px]"> | ||
<Link to={`/app/channels/${String(serverId)}`}> | ||
<BackSVG /> | ||
</Link> | ||
<ChannelSVG /> | ||
<p>Name</p> | ||
</div> | ||
<div className="flex items-center gap-[16px]"> | ||
<ThreadsSVG /> | ||
<BellMutedSVG /> | ||
<PinSVG /> | ||
<button onClick={() => setIsExpanded((old) => !old)}> | ||
<UsersSVG /> | ||
</button> | ||
<input | ||
type="text" | ||
className="h-[24px] rounded-sm bg-[#000] px-[4px] py-[8px] text-[12px]" | ||
placeholder="Search" | ||
/> | ||
<InboxSVG /> | ||
<HelpSVG /> | ||
</div> | ||
</div> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { ChannelItemProps } from "@/types/servers"; | ||
import { Link } from "@tanstack/react-router"; | ||
import { FC } from "react"; | ||
import { DiscordChannelSVG } from "../svgs/discord-channel"; | ||
|
||
export const ChannelItem: FC<ChannelItemProps> = ({ channel, serverId }) => { | ||
return ( | ||
<div className="relative flex items-center gap-[8px]"> | ||
<div className="flex h-2 w-1 items-center justify-center overflow-hidden rounded-full bg-white duration-100 group-hover:top-3 group-hover:h-6"></div> | ||
<Link | ||
to={`/app/channels/${serverId}/${channel.id}`} | ||
className="mr-[8px] flex w-full items-center gap-[8px] rounded-sm px-[8px] py-[8px] hover:bg-mainBlackHover" | ||
> | ||
<DiscordChannelSVG /> | ||
<p>{channel.name}</p> | ||
</Link> | ||
</div> | ||
); | ||
}; |
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.
Remove image from
public
folder because it's not visible in the deployment.