diff --git a/frontend/sweet-red-beans/src/components/Comment/Comment.js b/frontend/sweet-red-beans/src/components/Comment/Comment.js index 62b9132..38e129d 100644 --- a/frontend/sweet-red-beans/src/components/Comment/Comment.js +++ b/frontend/sweet-red-beans/src/components/Comment/Comment.js @@ -1,5 +1,4 @@ import React, { useEffect, useState } from "react"; -import styles from "../../css/Comments.module.css" import axios from "axios"; import { useNavigate } from "react-router"; import { useSelector } from "react-redux"; diff --git a/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js b/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js index 5468cf8..52d2631 100644 --- a/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js +++ b/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js @@ -101,22 +101,20 @@ const DMDetail = ({selectedRoom}) => { setContents(prev=>[...prev, message]); }; - const onChange = useCallback( (e) => { setMessage(e.target.value); }, [] ) - - const disconnect = () => { - if(stompClient != null) { - stompClient.disconnect(); - } - } + useEffect(() => { + console.log("아ㅏ아아ㅏ아아아아"); + }, []) //이제까지 메시지 내역 조회 useEffect(() => { + setContents([]); + setMessage(""); if(selectedRoom !== undefined){ axios.get("http://localhost:8080/direct-message/detail", { withCredentials: true, @@ -139,6 +137,12 @@ const DMDetail = ({selectedRoom}) => { }) }); setComplete(selectedRoom.is_complete) + + return () => { + if(stompClient != null) { + stompClient.disconnect(); + } + } }, [selectedRoom]) //신뢰도 +1 주는 버튼 diff --git a/frontend/sweet-red-beans/src/components/Modals/Modal.js b/frontend/sweet-red-beans/src/components/Modals/Modal.js index e1b2996..6f6d408 100644 --- a/frontend/sweet-red-beans/src/components/Modals/Modal.js +++ b/frontend/sweet-red-beans/src/components/Modals/Modal.js @@ -20,11 +20,11 @@ const Modal = (props) => { {header}
{props.children}
- + + */} ) : null} diff --git a/frontend/sweet-red-beans/src/components/MyPage/MyPageAdmin.js b/frontend/sweet-red-beans/src/components/MyPage/MyPageAdmin.js index eec3bd1..af3268a 100644 --- a/frontend/sweet-red-beans/src/components/MyPage/MyPageAdmin.js +++ b/frontend/sweet-red-beans/src/components/MyPage/MyPageAdmin.js @@ -2,12 +2,13 @@ import React, { useEffect, useState } from "react"; import Report from "../Report/Report"; import axios from "axios"; import Pagination from "./MyPageDetail/Pagination"; +import style from "../../css/MyPage/MyPageAdmin.module.css"; const MyPageAdmin = () => { const [reports, setReports] = useState([]); const [reportIsHere, setReportIsHere] = useState(false); - const [limit, setLimit] = useState(10); + const [limit, setLimit] = useState(15); const [page, setPage] = useState(1); const offset = (page - 1) * limit; @@ -27,21 +28,33 @@ const MyPageAdmin = () => { return ( <> - {reportIsHere ? reports.slice(offset, offset + limit).map((item, index) => ( -
- -
- )) : null} +
+
+
+
승인여부
+
신고자
+
신고 받은 사람
+
신고한 시간
+
+
+ {reportIsHere ? reports.slice(offset, offset + limit).map((item, index) => ( +
+ +
+ )) : null} +
+
+ +
- ) } diff --git a/frontend/sweet-red-beans/src/components/Report/Report.js b/frontend/sweet-red-beans/src/components/Report/Report.js index 12eb30c..1006471 100644 --- a/frontend/sweet-red-beans/src/components/Report/Report.js +++ b/frontend/sweet-red-beans/src/components/Report/Report.js @@ -1,46 +1,123 @@ import axios from "axios"; import React, { useEffect, useState } from "react"; +import { useNavigate } from "react-router"; +import style from "../../css/Report/Report.module.css"; +import Modal from "../Modals/Modal"; const Report = ({report}) => { + const navigation = useNavigate(); + const [modalOpen, setModalOpen] = useState(false); const [content, setContent] = useState(""); const [date, setDate] = useState(""); const [nickname, setNickname] = useState(""); - const [disable, setDisable] = useState(false); const [reportedNickname, setReportedNickname] = useState(""); + const [isComplete, setIsComplete] = useState(false); + + const openModal = () => { + setModalOpen(true); + }; + const closeModal = () => { + setModalOpen(false); + }; useEffect(() => { setContent(report.report_content); setDate(report.written_date) setNickname(report.nickname); setReportedNickname(report.reported_nickname) - }, []) + setIsComplete(report.is_complete); + console.log(report); + }, [report]) + + const useConfirm = (message = null, onConfirm, onCancel) => { + if (!onConfirm || typeof onConfirm !== "function") { + return; + } + if (onCancel && typeof onCancel !== "function") { + return; + } + + const confirmAction = () => { + if (window.confirm(message)) { + onConfirm(); + } else { + onCancel(); + } + }; + + return confirmAction; + }; - const reportAcceptClick = () => { + const confirm = () => { axios.patch('http://localhost:8080/manager/report', { - user_id:report.user_id + user_id:report.reported_nickname }, {withCredentials: true} ) .then((response) => { if(response.data){ - setDisable(true); console.log(response.data) } }) .catch((error) => { console.log(error); }) + closeModal(); + navigation(0); + } + + const cancelConfirm = () => console.log("승인 취소") + + const reportAcceptClick = useConfirm( + "승인하시겠습니까?", + confirm, + cancelConfirm + ); + + const parseDate = (written_date) => { + const d = new Date(written_date); + const year = d.getFullYear(); + let month = d.getMonth(); + let date = d.getDate(); + let hours = d.getHours(); + let min = d.getMinutes(); + if(month<10){ + month = '0'+month; + } + if(date<10){ + date = '0'+date; + } + if(hours<10){ + hours = '0'+hours; + } + if(min<10){ + min = '0'+min; + } + return ( +
{year}-{month}-{date} {hours} : {min}
+ ) } return ( <> -
{content}
-
{date}
-
{nickname}
-
신고당한 사람 : {reportedNickname}
-
- + +
+
+
신고자 : {nickname}
+
{parseDate(date)}
+
+
신고 받은 사람 : {reportedNickname}
+
{content}
+ +
+
+
+
{isComplete ? "승인" : "미승인"}
+
{nickname}
+
{reportedNickname}
+
{parseDate(date)}
+ ) } diff --git a/frontend/sweet-red-beans/src/components/TopBar/LogIn.js b/frontend/sweet-red-beans/src/components/TopBar/LogIn.js index a3e361d..d114c6b 100644 --- a/frontend/sweet-red-beans/src/components/TopBar/LogIn.js +++ b/frontend/sweet-red-beans/src/components/TopBar/LogIn.js @@ -74,9 +74,15 @@ const LogIn = () =>{ const date = new Date(); date.setMinutes(date.getMinutes() + 30); cookies.set("login", true, {expires: date}); + cookies.set("user", { + authority:response.data.authority, + porfileImage:response.data.image_url, + nickname:response.data.nickname, + }, {expires:date}); setModalOpen(false); - navigation(0); + + } else { alert("로그인에 실패했습니다."); @@ -95,6 +101,7 @@ const LogIn = () =>{ .then(response => { if(response.data.result){ cookies.remove("login") + cookies.remove("user") navigation(0) } else { alert("로그아웃에 실패했습니다."); diff --git a/frontend/sweet-red-beans/src/components/TopBar/NavigationBar.js b/frontend/sweet-red-beans/src/components/TopBar/NavigationBar.js index 0f02f5b..f8c9111 100644 --- a/frontend/sweet-red-beans/src/components/TopBar/NavigationBar.js +++ b/frontend/sweet-red-beans/src/components/TopBar/NavigationBar.js @@ -4,8 +4,10 @@ import { Link } from "react-router-dom"; import styles from "../../css/TopBar/NavigationBar.module.css"; import BottomCategory from "./BottomCategory"; import { useNavigate } from "react-router"; +import { Cookies } from "react-cookie"; const NavigationBar = () => { + const cookies = new Cookies(); const navigation = useNavigate(); const [hide, setHide] = useState(true); const [userId, setUserId] = useState(false); @@ -44,7 +46,14 @@ const NavigationBar = () => { } const mypageClick = () => { - navigation('/mypage'); + const authority = cookies.get("user").authority + if(authority === "일반") { + navigation('/mypage'); + } + else if (authority === "관리자") { + navigation('/adminpage'); + } + } diff --git a/frontend/sweet-red-beans/src/components/TransactionPage/TransactionPage.js b/frontend/sweet-red-beans/src/components/TransactionPage/TransactionPage.js index 55dab3a..b41ffa7 100644 --- a/frontend/sweet-red-beans/src/components/TransactionPage/TransactionPage.js +++ b/frontend/sweet-red-beans/src/components/TransactionPage/TransactionPage.js @@ -8,9 +8,12 @@ import { getCookie } from "../../Cookie"; import { useNavigate } from "react-router"; import { useSelector } from "react-redux"; import userImage from "../../img/user.png"; +import { Cookies } from "react-cookie"; const TransactionPage = () => { - const navigation = useNavigate() + const cookies = new Cookies(); + const navigation = useNavigate(); + const [modalOpen, setModalOpen] = useState(false); const [transactions, setTransactions] = useState([]); const [transactionIsHere, setTransactionIsHere] = useState(false); @@ -32,7 +35,6 @@ const TransactionPage = () => { //내 프로필 const [nickname, setNickname] = useState(""); const [profileImage, setProfileImage] = useState(""); - const [reliability, setReliability] = useState(0); const [fetching, setFetching] = useState(false); @@ -231,21 +233,15 @@ const TransactionPage = () => { .catch(error => console.log(error)); //내 프로필 조회 - axios.get('http://localhost:8080/mypage',{ - withCredentials: true , - }) - .then(response => { - setNickname(response.data.user.nickname); - setProfileImage(response.data.user.profile_url); - setReliability(response.data.user.reliability); - }) - .catch(error => { - if(error.response.status === 401){ - setNickname("익명"); - setProfileImage(userImage); - setReliability(0); - } - }); + if(cookies.get("user")){ + setNickname(cookies.get("user").nickname); + setProfileImage(cookies.get("user").porfileImage); + } + else { + setNickname("익명"); + setProfileImage(userImage); + } + }, []) useEffect(()=>{ diff --git a/frontend/sweet-red-beans/src/css/Comments.module.css b/frontend/sweet-red-beans/src/css/Comments.module.css deleted file mode 100644 index 00ff9fd..0000000 --- a/frontend/sweet-red-beans/src/css/Comments.module.css +++ /dev/null @@ -1,3 +0,0 @@ -.display{ - visibility: hidden; -} \ No newline at end of file diff --git a/frontend/sweet-red-beans/src/css/DMPage/DMList.module.css b/frontend/sweet-red-beans/src/css/DMPage/DMList.module.css index 561b7fa..85a75e9 100644 --- a/frontend/sweet-red-beans/src/css/DMPage/DMList.module.css +++ b/frontend/sweet-red-beans/src/css/DMPage/DMList.module.css @@ -23,5 +23,4 @@ border-radius: 20px; background-clip: padding-box; border: 4px solid transparent; - } \ No newline at end of file diff --git a/frontend/sweet-red-beans/src/css/EventPage/EventMovieThumbnail.module.css b/frontend/sweet-red-beans/src/css/EventPage/EventMovieThumbnail.module.css index 7dd51e9..75352ce 100644 --- a/frontend/sweet-red-beans/src/css/EventPage/EventMovieThumbnail.module.css +++ b/frontend/sweet-red-beans/src/css/EventPage/EventMovieThumbnail.module.css @@ -42,23 +42,24 @@ } .likeOnButton { - background: url("../../img/ticket.png"); + background: url("../../img/ticket3.png"); } .likeOffButton { - background: url("../../img/ticket.png"); + background: url("../../img/ticket3.png"); } .likeOnButton, .likeOffButton { cursor: pointer; position: absolute; - width: 50px; - height: 50px; + width: 40px; + height: 40px; border-radius: 50px; - border: #c4c4c4 solid 1px; - background-size: 60%; + background-size: 80%; background-repeat: no-repeat; background-position: 50% 50%; + border: none; + /* border: #c4c4c4 solid 1px;*/ background-color: rgba(255, 255, 255, 0.8); top: 10px; right: 10px; diff --git a/frontend/sweet-red-beans/src/css/Modal/modal.module.css b/frontend/sweet-red-beans/src/css/Modal/modal.module.css index 7bae988..634af5f 100644 --- a/frontend/sweet-red-beans/src/css/Modal/modal.module.css +++ b/frontend/sweet-red-beans/src/css/Modal/modal.module.css @@ -7,11 +7,11 @@ left: 0; z-index: 99; background-color: rgba(0, 0, 0, 0.6); - } +} .openModal > section { width: 90%; - max-width: 450px; + max-width: 500px; margin: 0 auto; border-radius: 0.3rem; background-color: white; diff --git a/frontend/sweet-red-beans/src/css/MyPage/MyPageAdmin.module.css b/frontend/sweet-red-beans/src/css/MyPage/MyPageAdmin.module.css new file mode 100644 index 0000000..76f90ba --- /dev/null +++ b/frontend/sweet-red-beans/src/css/MyPage/MyPageAdmin.module.css @@ -0,0 +1,71 @@ +.layout{ + max-width: 800px; + margin: 0 auto; + margin-top: 50px; + background-color: white; + border: #c4c4c4 1px solid; + border-radius: 20px; + padding: 50px 100px 30px 100px; +} + +.reportBox { + width: 100%; + border-top: #F23333 3px solid; +} + +.topBar { + position: relative; + height: 45px; + border-bottom: #c4c4c4 1px solid; +} + +.topBar div { + position: absolute; + display: inline-block; + top:50%; + transform: translate(0%, -50%); + font-size: 14px; +} + +.topBar div:nth-child(1) { + left:15px; + width: 60px; +} + +.topBar div:nth-child(2) { + left:200px; + width: 100px; +} + +.topBar div:nth-child(3) { + left: 400px; + width: 100px; +} + +.topBar div:nth-child(4) { + right:0px; + width: 200px; +} +.writeButtonArea { + margin-top: 30px; + text-align: right; +} + +.writeButtonArea button{ + cursor: pointer; + border: none; + width: 100px; + height: 50px; + background-color: #F23333; + color: white; + border-radius: 10px; + font-size: 1rem; + font-family: 'ROKAFSansBold'; +} + +@font-face { + font-family: 'ROKAFSansBold'; + src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts2201-3@1.0/ROKAFSansBold.woff') format('woff'); + font-weight: normal; + font-style: normal; +} \ No newline at end of file diff --git a/frontend/sweet-red-beans/src/css/Report/Report.module.css b/frontend/sweet-red-beans/src/css/Report/Report.module.css new file mode 100644 index 0000000..79e0838 --- /dev/null +++ b/frontend/sweet-red-beans/src/css/Report/Report.module.css @@ -0,0 +1,129 @@ +.main { + position: relative; + height: 45px; + border-bottom: #c4c4c4 1px solid; +} + +.main > div{ + position: absolute; + display: inline-block; + top:50%; + transform: translate(0%, -50%); + color: black; + font-size: 14px; + overflow:hidden; + text-overflow: ellipsis; + white-space:nowrap; +} + +.main > div:nth-child(1) { + cursor: pointer; + width: 60px;; + text-align: center; + left:15px; +} + +.main > div:nth-child(1):hover { + text-decoration: underline; +} + +.main > .incomplete { + color: #F32222; +} + +.main > div:nth-child(2) { + left:200px; + width: 100px; + color: #c4c4c4; + cursor:default; +} + +.main > div:nth-child(3) { + left: 400px; + width: 100px; + color: #c4c4c4; + cursor:default; +} + +.main > div:nth-child(4) { + right:0px; + width: 200px; + color: #c4c4c4; + cursor:default; +} + +.modal { + font-size: 14px; + margin: 0 auto; + width: 400px; +} + +.modal > .topArea { + position: relative; + height: 45px; + text-align: center; + border-top: #F32222 3px solid; + border-bottom: #c4c4c4 1px solid; +} + +.modal > .topArea > div { + position: absolute; + top:50%; + transform: translate(0, -50%); +} + +.modal > .topArea > div:nth-child(1) { + left: 10px; +} + +.modal > .topArea > div:nth-child(2) { + font-size: 12px; + color: #c4c4c4; + right: 10px; +} + +/* 신고 받은 사람 */ +.modal > div:nth-child(2) { + height: 45px; + border-bottom: #c4c4c4 1px solid; + vertical-align: middle; + display: flex; + align-items: center; + box-sizing: border-box; + padding-left: 10px; + background-color: #f0f0f0; +} + +/* 내용 */ +.modal > div:nth-child(3) { + height: 300px; + border-bottom: #c4c4c4 1px solid; + text-align: left; + box-sizing: border-box; + padding: 10px; + overflow:auto; +} + +.modal > div:nth-child(3)::-webkit-scrollbar{ + width: 15px; +} + +.modal > div:nth-child(3)::-webkit-scrollbar-thumb{ + width: 15px; + background-color: #C4C4C4; + border-radius: 20px; + background-clip: padding-box; + border: 4px solid transparent; +} + +.modal > button { + font-size: 16px; + cursor: pointer; + margin-top: 45px; + height: 50px; + width: 110px; + background-color: #F32222; + color: white; + border: none; + border-radius: 10px; +} \ No newline at end of file diff --git a/frontend/sweet-red-beans/src/css/TopBar/LogIn.module.css b/frontend/sweet-red-beans/src/css/TopBar/LogIn.module.css index d86114c..c579fb4 100644 --- a/frontend/sweet-red-beans/src/css/TopBar/LogIn.module.css +++ b/frontend/sweet-red-beans/src/css/TopBar/LogIn.module.css @@ -28,7 +28,7 @@ color: #F23333; margin-bottom: 15px; text-align: left; - margin-left: 65px; + margin-left: 85px; margin-top: -5px; } diff --git a/frontend/sweet-red-beans/src/img/ticket3.png b/frontend/sweet-red-beans/src/img/ticket3.png new file mode 100644 index 0000000..7225400 Binary files /dev/null and b/frontend/sweet-red-beans/src/img/ticket3.png differ