Skip to content

Commit c550205

Browse files
authored
Merge pull request #14 from ArpitSiNgh08/main
Chat page half done
2 parents 0f6eb21 + 048685f commit c550205

16 files changed

Lines changed: 487 additions & 389 deletions

File tree

frontend/package-lock.json

Lines changed: 36 additions & 53 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,33 @@
1515
"@chakra-ui/react": "^2.0.0",
1616
"@chakra-ui/skeleton": "^2.1.0",
1717
"@chakra-ui/spinner": "^2.1.0",
18+
"@chakra-ui/system": "^2.0.0",
1819
"@chakra-ui/toast": "^7.0.2",
1920
"@chakra-ui/tooltip": "^2.3.1",
21+
"@emotion/react": "^11.0.0",
22+
"@emotion/styled": "^11.0.0",
23+
"@firebase/app": "^0.9.27",
24+
"@firebase/auth": "^1.6.0",
2025
"@testing-library/jest-dom": "^5.17.0",
2126
"@testing-library/react": "^13.4.0",
2227
"@testing-library/user-event": "^13.5.0",
2328
"axios": "^1.7.2",
2429
"dotenv": "^16.4.5",
2530
"emailjs-com": "^3.2.0",
31+
"firebase": "^10.8.0",
32+
"framer-motion": "^6.0.0",
2633
"leaflet": "^1.9.4",
2734
"react": "^18.2.0",
2835
"react-dom": "^18.2.0",
36+
"react-icons": "^5.5.0",
2937
"react-leaflet": "^4.2.1",
30-
"react-icons": "^5.3.0",
3138
"react-router-dom": "^6.23.1",
3239
"react-scripts": "5.0.1",
3340
"react-scrollable-feed": "^2.0.2",
41+
"react-split-pane": "^0.1.92",
3442
"socket.io-client": "^4.7.5",
3543
"update": "^0.7.4",
36-
"web-vitals": "^2.1.4",
37-
"firebase": "^10.8.0",
38-
"@firebase/app": "^0.9.27",
39-
"@firebase/auth": "^1.6.0",
40-
"@emotion/react": "^11.0.0",
41-
"@emotion/styled": "^11.0.0",
42-
"framer-motion": "^6.0.0",
43-
"@chakra-ui/system": "^2.0.0"
44+
"web-vitals": "^2.1.4"
4445
},
4546
"scripts": {
4647
"start": "react-scripts start",
@@ -69,4 +70,4 @@
6970
"last 1 safari version"
7071
]
7172
}
72-
}
73+
}

frontend/src/Pages/Chatpage.js

Lines changed: 56 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
import { Box } from "@chakra-ui/layout";
1+
import SplitPane from "react-split-pane";
2+
import { Box, useBreakpointValue, Drawer, DrawerOverlay, DrawerContent, DrawerBody, IconButton } from "@chakra-ui/react";
23
import { useState } from "react";
4+
import { FiMenu } from "react-icons/fi";
35
import Chatbox from "../components/Chatbox";
46
import MyChats from "../components/MyChats";
57
import SideDrawer from "../components/miscellaneous/SideDrawer";
@@ -10,20 +12,62 @@ import "./chat.css";
1012
const Chatpage = () => {
1113
const [fetchAgain, setFetchAgain] = useState(false);
1214
const { user } = ChatState();
15+
const [isDrawerOpen, setDrawerOpen] = useState(false);
16+
17+
// Responsive mode: "mobile", "medium", "large"
18+
const mode = useBreakpointValue({
19+
base: "mobile",
20+
md: "medium",
21+
lg: "large",
22+
});
1323

1424
return (
15-
<div className="chats-sec" style={{ width: "100%", height:"100%"}}>
25+
<div className="chats-sec" style={{ width: "100%", height: "100vh" }}>
1626
{/* {user && <SideDrawer />} */}
17-
<div className="chat-main">
18-
<div className="sidebar">
19-
{user && <MyChats fetchAgain={fetchAgain} />}
20-
</div>
21-
<div className="chatting">
22-
{user && (
23-
<Chatbox fetchAgain={fetchAgain} setFetchAgain={setFetchAgain} />
24-
)}
25-
</div>
26-
</div>
27+
28+
{(mode === "mobile" || mode === "medium") && (
29+
<>
30+
<IconButton
31+
icon={<FiMenu />}
32+
aria-label="Open My Chats"
33+
position="fixed"
34+
top={4}
35+
left={4}
36+
zIndex={2000}
37+
onClick={() => setDrawerOpen(true)}
38+
colorScheme="blue"
39+
/>
40+
<Drawer isOpen={isDrawerOpen} placement="left" onClose={() => setDrawerOpen(false)}>
41+
<DrawerOverlay />
42+
<DrawerContent bg="#0f1924" maxWidth={"60vw"} width="60vw" >
43+
<DrawerBody>
44+
{user && <MyChats fetchAgain={fetchAgain} />}
45+
</DrawerBody>
46+
</DrawerContent>
47+
</Drawer>
48+
<Box className="chatting" w="100%" h="100vh">
49+
{user && <Chatbox fetchAgain={fetchAgain} setFetchAgain={setFetchAgain} />}
50+
</Box>
51+
</>
52+
)}
53+
54+
{mode === "large" && (
55+
<SplitPane
56+
split="vertical"
57+
minSize={200}
58+
defaultSize={550}
59+
style={{ height: "100vh" }}
60+
>
61+
<div className="sidebar" style={{ background: "#0f1924", height: "100%", overflowX: "hidden" }}>
62+
{user && <MyChats fetchAgain={fetchAgain} />}
63+
</div>
64+
<div className="chatting">
65+
{user && (
66+
<Chatbox fetchAgain={fetchAgain} setFetchAgain={setFetchAgain} />
67+
)}
68+
</div>
69+
</SplitPane>
70+
)}
2771
</div>
2872
);
2973
};

frontend/src/Pages/chat.css

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
.chats-sec {
32
display: flex;
43
flex-direction: column;
@@ -9,29 +8,23 @@
98
.chat-main {
109
display: flex;
1110
height: 100%;
12-
background-color:#8CC7FF29 !important;
11+
background-color:#8CC7FF29 !important;
1312
}
1413

1514
.sidebar {
16-
17-
18-
background: #338ada !important;
19-
overflow: hidden;
20-
height: 100%;
21-
width: 40%;
15+
16+
overflow-y: auto;
17+
2218
transition: width 0.3s ease;
23-
padding: 10px;
2419
}
2520

2621
.chatting {
27-
2822
display: flex;
2923
flex-direction: column;
3024
justify-content: space-between;
25+
background-color: white !important;
3126
padding: 10px;
3227
transition: width 0.3s ease;
33-
width: 60%;
34-
background-color: #8CC7FF29 !important;
3528
}
3629

3730
.task-allocator {
@@ -130,23 +123,22 @@
130123

131124
.sidebar {
132125
overflow-y: auto;
133-
134126
transition: width 0.3s ease;
135127
}
136128

137-
.sidebar.full {
129+
/* .sidebar.full {
138130
width: 50%;
139131
}
140132
141133
.sidebar.reduced {
142134
width: 30%;
143-
}
135+
} */
144136

145137
.chatting {
146138
display: flex;
147139
flex-direction: column;
148140
justify-content: space-between;
149-
background-color: white !important;
141+
background-color: #0f1924 !important;
150142

151143
padding: 10px;
152144
transition: width 0.3s ease;
@@ -180,3 +172,20 @@
180172
border-top: 1px solid #ddd;
181173
background-color: #f8f9fa;
182174
}
175+
176+
/* Add to chat.css */
177+
.SplitPane .Resizer {
178+
background: #05549e;
179+
opacity: 0.5;
180+
z-index: 1;
181+
box-sizing: border-box;
182+
background-clip: padding-box;
183+
}
184+
.SplitPane .Resizer:hover {
185+
transition: all 2s ease;
186+
}
187+
.SplitPane .Resizer.vertical {
188+
width: 8px;
189+
margin: 0 -4px;
190+
cursor: col-resize;
191+
}

0 commit comments

Comments
 (0)