Commit 0309cd62 authored by 이재연's avatar 이재연
Browse files

aaaaaaaaaaaaaaa

parent 74ec15d7
...@@ -7,7 +7,7 @@ import RoomPage from "./pages/RoomPage"; ...@@ -7,7 +7,7 @@ import RoomPage from "./pages/RoomPage";
import InfoUpdatePage from "./pages/InfoUpdatePage"; import InfoUpdatePage from "./pages/InfoUpdatePage";
import InvitePage from "./pages/InvitePage"; import InvitePage from "./pages/InvitePage";
import SingupPage from "./components/SignUp"; import SingupPage from "./components/SignUp";
import LoginPage from "./components/Login" import LoginPage from "./components/Login";
function App() { function App() {
return ( return (
...@@ -21,17 +21,6 @@ function App() { ...@@ -21,17 +21,6 @@ function App() {
<Route path="/profile/:id/update" component={InfoUpdatePage} /> <Route path="/profile/:id/update" component={InfoUpdatePage} />
<Route path="/profile/:id" component={ProfilePage} /> <Route path="/profile/:id" component={ProfilePage} />
<Route path="/room/:roomId/:channelId" component={RoomPage}> <Route path="/room/:roomId/:channelId" component={RoomPage}>
{/* <Switch>
<Route path={"/room/:roomId/meeting"}>
<></>
</Route>
<Route path={"/room/:roomId/normal"}>
<></>
</Route>
<Route path={"/room/:roomId/notice"}>
<></>
</Route>
</Switch> */}
</Route> </Route>
<Route path="/room/Invite" component={InvitePage} /> <Route path="/room/Invite" component={InvitePage} />
</Switch> </Switch>
......
import { useEffect, useState } from 'react'; import { useEffect, useState } from "react";
import { Link } from 'react-router-dom' import { Link, useParams } from "react-router-dom";
import roomApi from '../../apis/room.api'; import roomApi from "../../apis/room.api";
import userApi from '../../apis/user.api'; import userApi from "../../apis/user.api";
import catchErrors from '../../context/catchError'; import catchErrors from "../../context/catchError";
const id = localStorage.getItem('user'); const id = localStorage.getItem("user");
const INIT_ROOM={ const INIT_ROOM = {
name:"", roomId:"",
profileimg:"", name: "",
member:"", profileimg: "",
} member: "",
};
const RoomSingle = () => { const RoomSingle = () => {
const [room, setRoom] = useState(INIT_ROOM) const [room, setRoom] = useState([INIT_ROOM]);
const [error,setError]=useState('') const [error, setError] = useState("");
const channelId = 1 const channelId = 'main';
const roomId = "1234567abc" const {roomId}=useParams(room.roomId);
async function getJoinRoom(Id) { async function getJoinRoom(Id) {
try { try {
const User = await userApi.getUser(Id) const User = await userApi.getUser(Id);
const RoomNumArr = User.roomNumber const RoomNumArr = User.roomNumber;
const Room= await roomApi.getRoom(RoomNumArr) const Room = await roomApi.getRoom(RoomNumArr);
console.log(Room[0]) let roomlist = [];
const rrr=Room[0] for (let prop in Room) {
const memcount= rrr.member.length roomlist.push({
setRoom({...room, name:rrr.name, profileimg: rrr.profileimg, member:memcount}) roomId:Room[prop].id,
console.log(room) name: Room[prop].name,
profileimg: Room[prop].profileimg,
member: Room[prop].member.length,
});
}
setRoom(roomlist);
} catch (error) { } catch (error) {
catchErrors(error, setError) catchErrors(error, setError);
} }
} }
useEffect(() => { useEffect(() => {
getJoinRoom(id) getJoinRoom(id);
}, [id]) }, [id]);
console.log(room)
const { profileimg } = room;
return ( return (
<Link <div>
to={`/room/${id}/${channelId}`} {room &&
className="text-decoration-none text-dark" room.map((el) => (
> <Link
<div to={`/room/${el.roomId}/${channelId}`}
className="d-flex mx-4 my-2 p-2" className="text-decoration-none text-dark"
style={{ backgroundColor: '#C4C4C4' }} >
> <div
<div style={{ width: '37px', height: '37px' }}> className="d-flex mx-4 my-2 p-2"
{/* <img style={{ backgroundColor: "#C4C4C4" }}
src={`/roomUploads/${profileimg}`} >
className="rounded-circle" <div style={{ width: "37px", height: "37px" }}>
style={{ width: '37px', height: '37px' }} <img
/> */} src={`/roomUploads/${el.profileimg}`}
</div> className="rounded-circle"
<div style={{ width: "37px", height: "37px" }}
className="mx-3 mt-2" />
style={{ </div>
width: '250px', <div
overflow:'scroll', className="mx-3 mt-2"
whiteSpace: 'nowrap', style={{
msOverflowStyle:'none', width: "250px",
}} overflow: "scroll",
> whiteSpace: "nowrap",
{room.name} msOverflowStyle: "none",
</div> }}
<div className="ms-auto mt-2"> {room.member}/100 </div> >
</div> {el.name}
</div>
</Link> <div className="ms-auto mt-2"> {el.member}/100 </div>
) </div>
} </Link>
))}
</div>
);
};
export default RoomSingle export default RoomSingle;
...@@ -6,7 +6,7 @@ const ChannelSingle = () => { ...@@ -6,7 +6,7 @@ const ChannelSingle = () => {
<div className="overflow-auto" style={{ height: "610px" }}> <div className="overflow-auto" style={{ height: "610px" }}>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<Link to={`${roomId}/meeting`}> <Link to={`room/${roomId}/meeting`}>
<img <img
className="col-auto mt-2" className="col-auto mt-2"
src="/fullSpeaker.png" src="/fullSpeaker.png"
......
import { useState } from "react"; import { useState } from "react";
import { useParams } from "react-router-dom";
import ChannelSingle from './ChannelSingle' import ChannelSingle from './ChannelSingle'
const RightHamberger = () => { const RightHamberger = () => {
const [admin, setAdmin] = useState('true') const [admin, setAdmin] = useState('true')
const {roomId}=useParams();
return ( return (
<div> <div>
<div> <div>
...@@ -42,7 +44,7 @@ const RightHamberger = () => { ...@@ -42,7 +44,7 @@ const RightHamberger = () => {
> >
데계데계데계데계데계데계데계데계데계데계 재밌는 수학과 데계데계데계데계데계데계데계데계데계데계 재밌는 수학과
</p> </p>
<h6 className="mt-2" id="roomId" > #ASV2AE985 </h6> <h6 className="mt-2" id="roomId" >{`${roomId}`}</h6>
<button <button
type="button" type="button"
className="btn-close text-reset" className="btn-close text-reset"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment