Skip to content
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: community chat frontend #504

Merged
merged 8 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## [0.53.15](https://github.com/thecyberworld/TheCyberHUB/compare/v0.53.14...v0.53.15) (2023-10-09)


### Bug Fixes

* alignement of icon and text in the navbar ([#486](https://github.com/thecyberworld/TheCyberHUB/issues/486)) ([1373320](https://github.com/thecyberworld/TheCyberHUB/commit/1373320a046b10f554d5a4f340ba1932f7622f12))



## [0.53.14](https://github.com/thecyberworld/TheCyberHUB/compare/v0.53.13...v0.53.14) (2023-10-01)


Expand Down Expand Up @@ -34,12 +43,3 @@



## [0.53.10](https://github.com/thecyberworld/TheCyberHUB/compare/v0.53.9...v0.53.10) (2023-09-05)


### Bug Fixes

* minor issues ([#435](https://github.com/thecyberworld/TheCyberHUB/issues/435)) ([39c0631](https://github.com/thecyberworld/TheCyberHUB/commit/39c0631d6650a1ccd8437eca88dc63c5fcd4cfcb))



4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"homepage": "https://thecyberhub.org/",
"name": "thecyberhub.org",
"private": true,
"version": "0.53.14",
"version": "0.53.15",
"scripts": {
"predeploy": "npm run build",
"deploy": "gh-pages -d dist",
Expand Down
5 changes: 4 additions & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import AuthRoute from "./pages/AuthRoute";
import SecurityRoutes from "./components/Other/Security/SecurityRoutes";
import ExploreRoutes from "./components/Explore/ExploreRoutes";
import Leaderboard from "./components/Other/CyberGames/Leaderboard/Leaderboard";
import ChatRoute from "./components/Chat/ChatRoute";

const App = () => {
const [isLoading, setIsLoading] = useState(true);
Expand All @@ -70,11 +71,12 @@ const App = () => {

const hideHomeHeader = () => {
const pathDashboard = pathname.includes("/dashboard");
const chat = pathname.includes("/chat");
const pathLogin = pathname.includes("/login");
const pathRegister = pathname.includes("/register");
const pathForgetPassword = pathname.includes("/forgetPassword");
const pathResetPassword = pathname.includes("/resetPassword");
return pathDashboard || pathLogin || pathRegister || pathForgetPassword || pathResetPassword;
return pathDashboard || pathLogin || pathRegister || pathForgetPassword || pathResetPassword || chat;
};

const [isOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -118,6 +120,7 @@ const App = () => {
<Route path={"/security/*"} element={<SecurityRoutes />} />

<Route path={"/dashboard/*"} element={<DashboardRoute />} />
<Route path={"/chat/*"} element={<ChatRoute />} />

<Route exact path={"/contact"} element={<ContactForm />} />

Expand Down
16 changes: 16 additions & 0 deletions src/components/Chat/Chat.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from "react";
// import { Wrapper } from "../Dashboard/Profile/ProfileElements";
import { ChatItemsContainer } from "./ChatElement";
import ChatArea from "./ChatArea/ChatArea";

const Chat = () => {
return (
// <Wrapper>
<ChatItemsContainer>
<ChatArea />
</ChatItemsContainer>
// </Wrapper>
);
};

export default Chat;
28 changes: 28 additions & 0 deletions src/components/Chat/ChatArea/ChatArea.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import React from "react";
import { ChatContainer, LeftNav, RightNav } from "../ChatElement";
import { FaPhoneAlt, FaVideo, FaUserCircle } from "react-icons/fa";

const ChatArea = () => {
return (
<>
<ChatContainer>
<LeftNav>
Security / <h6>General</h6>
</LeftNav>
<RightNav>
<li>
<FaVideo />
</li>
<li>
<FaPhoneAlt />
</li>
<li>
<FaUserCircle />
</li>
</RightNav>
</ChatContainer>
</>
);
};

export default ChatArea;
61 changes: 61 additions & 0 deletions src/components/Chat/ChatElement.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import styled from "styled-components";

export const ChatRoutesContainer = styled.div`
display: flex;
flex-direction: row;
align-items: start;
justify-content: space-between;
width: 100%;
max-width: 1500px;
`;

export const ChatContainer = styled.div`
display: flex;
align-items: center;
justify-content: space-between;
padding: 15px;
z-index: 1000;
top: 0;
width: 100%;
border-bottom: 1px solid white;

max-width: 1500px;
`;

export const ChatItemsContainer = styled.div`
width: 100%;

display: flex;
flex-direction: row;
justify-content: space-evenly;
margin: 25px;
border-radius: 10px;
color: #f5f5f5;

@media screen and (max-width: 768px) {
flex-wrap: wrap;
}
`;

export const LeftNav = styled.div`
font-size: 28px;
margin-right: 1px;
display: flex;
align-items: center;
`;
export const RightNav = styled.div`
font-size: 28px;
margin-right: 1px;
width: 15%;
display: flex;
list-style: none;
justify-content: space-between;
align-items: center;
`;

export const Chatbox = styled.div`
width: 100%;

display: flex;
flex-direction: row;
`;
19 changes: 19 additions & 0 deletions src/components/Chat/ChatRoute.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import { Route, Routes } from "react-router-dom";
import { ChatRoutesContainer } from "./ChatElement";
import Sidebar from "./Sidebar/Sidebar";
import { Chat } from "../index";

const ChatRoute = () => {
return (
<ChatRoutesContainer>
<Sidebar />

<Routes>
<Route index element={<Chat />} />
</Routes>
</ChatRoutesContainer>
);
};

export default ChatRoute;
58 changes: 58 additions & 0 deletions src/components/Chat/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from "react";
import { SidebarContainer, RouteLink, SidebarTitle } from "./SidebarElement";
import { FaUserCircle, FaCaretDown } from "react-icons/fa";
import { useSelector } from "react-redux";

const Sidebar = () => {
const { user } = useSelector((state) => state.auth);

return (
<SidebarContainer>
<section style={{ display: "flex", flexDirection: "row", margin: "0.2" }}>
<h2>
<FaUserCircle />
</h2>
<h4>
{user.name}
<p>@{user.username}</p>
</h4>
</section>
<br />

<RouteLink>
<SidebarTitle>
<FaCaretDown /> Announcement
</SidebarTitle>
</RouteLink>
<RouteLink>
<SidebarTitle>
<FaCaretDown /> Support
</SidebarTitle>
</RouteLink>

<RouteLink>
<SidebarTitle>
<FaCaretDown /> Help
</SidebarTitle>
</RouteLink>

<RouteLink>
<SidebarTitle>
<FaCaretDown /> Security
</SidebarTitle>
</RouteLink>

<RouteLink>
<SidebarTitle>
<FaCaretDown /> Pro-Player Only
</SidebarTitle>
</RouteLink>

<RouteLink to={"/dashboard"}>
<SidebarTitle>Back to Dashboard</SidebarTitle>
</RouteLink>
</SidebarContainer>
);
};

export default Sidebar;
42 changes: 42 additions & 0 deletions src/components/Chat/Sidebar/SidebarElement.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import styled from "styled-components";
import { Link } from "react-router-dom";

export const SidebarContainer = styled.div`
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 25px;
background: #36403e;
width: 300px;
height: 100vh;
border-radius: 10px;
color: #f5f5f5;
border-right: #2a2a2a 1px solid;
gap: 15px;

// stick to the top
position: sticky;
top: 0;
`;

export const RouteLink = styled(Link)`
text-decoration: none;
color: #f5f5f5;
`;

export const SidebarTitle = styled.h3`
color: #f5f5f5;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: 0.3s ease-in-out;
`;

export const RoutesContainer = styled.div`
display: flex;
flex-direction: row;
align-items: start;
justify-content: space-between;
width: 100%;
max-width: 1500px;
`;
19 changes: 19 additions & 0 deletions src/components/Dashboard/Chat/ChatHome.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from "react";
import { Wrapper } from "../Profile/ProfileElements";
import { RouterButton } from "../../Other/MixComponents/Buttons/ButtonElements";

const ChatHome = () => {
return (
<Wrapper style={{ fontSize: 25 }}>
<h1>Welcome</h1>
<p>
Want to connect and communicate <br />
with a vibrant community of like-minded people?
</p>
<br />
<RouterButton to="/chat">Join the Chatroom!</RouterButton>
</Wrapper>
);
};

export default ChatHome;
3 changes: 2 additions & 1 deletion src/components/Dashboard/DashboardRoute.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { Route, Routes } from "react-router-dom";
import { Dashboard, EditBlog, GoalSetter, NotFound, UserBlogs } from "../index";
import { ChatHome, Dashboard, EditBlog, GoalSetter, NotFound, UserBlogs } from "../index";
import CreateBlogV2 from "../Blogs/ManageBlogs/CreateBlogV2/CreateBlogV2";
import Sidebar from "./Sidebar/Sidebar";
import { DashboardRoutesContainer } from "./DashboardElements";
Expand All @@ -15,6 +15,7 @@ const DashboardRoute = () => {
<Route index element={<Dashboard />} />
<Route path={"goals"} element={<GoalSetter />} />
<Route path={"bookmarks"} element={<Bookmarks />} />
<Route path={"chat"} element={<ChatHome />} />
<Route path={"blogs"}>
<Route index element={<UserBlogs />} />
<Route exact path={"create"} element={<CreateBlogV2 />} />
Expand Down
4 changes: 4 additions & 0 deletions src/components/Dashboard/Sidebar/Sidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ const Sidebar = () => {
<SidebarTitle> User Blogs </SidebarTitle>
</RouteLink>

<RouteLink to={"/dashboard/chat"}>
<SidebarTitle> Community </SidebarTitle>
</RouteLink>

<RouteLink to={"/dashboard/goals"}>
<SidebarTitle> Goals </SidebarTitle>
</RouteLink>
Expand Down
2 changes: 1 addition & 1 deletion src/components/Header/Navbar/NavbarElements.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { AiFillCaretDown } from "react-icons/ai";
import { TbCrown } from "react-icons/tb";

export const DropdownIcon = styled(AiFillCaretDown)`
margin: 5px 0 0 5px;
margin: 0px 0 0 5px;
`;

export const Nav = styled.nav`
Expand Down
3 changes: 3 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,6 @@ export { default as SingleBlog } from "./Blogs/SingleBlog/SingleBlog";
export { default as EditBlog } from "./Blogs/ManageBlogs/EditBlog/EditBlog";
export { default as NotFound } from "../NotFound";
export { default as CertificateCard } from "./Other/Certificate/CertificateCard";

export { default as ChatHome } from "./Dashboard/Chat/ChatHome";
export { default as Chat } from "./Chat/Chat";