From f8e6ba902e63709ce56938ae80cccbeb85204f96 Mon Sep 17 00:00:00 2001 From: HyunJungJo98 Date: Sat, 26 Mar 2022 20:59:03 +0900 Subject: [PATCH] =?UTF-8?q?[#57,=20#61]Feat:=EC=B5=9C=EC=A0=81=ED=99=94,?= =?UTF-8?q?=20DM=ED=8E=98=EC=9D=B4=EC=A7=80=20=EB=B0=A9=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EC=8B=9C=20=ED=91=9C=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/DMPage/DMDetail.js | 745 ++++++++---------- .../src/components/DMPage/DMList.js | 50 +- .../src/components/DMPage/DMListThumbnail.js | 98 ++- .../src/components/DMPage/DMPage.js | 70 +- .../components/MainPage/MainMovieEvents.js | 120 ++- .../src/components/MainPage/MainPage.js | 91 +-- .../src/components/MainPage/MainPosts.js | 35 +- .../TransactionPage/TransactionDetail.js | 12 +- .../css/MainPage/MainMovieEvents.module.css | 52 +- .../src/css/MainPage/MainPosts.module.css | 56 +- .../sweet-red-beans/src/img/main-comment.png | Bin 0 -> 13202 bytes frontend/sweet-red-beans/src/store.js | 158 ++-- 12 files changed, 726 insertions(+), 761 deletions(-) create mode 100644 frontend/sweet-red-beans/src/img/main-comment.png diff --git a/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js b/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js index d0540fd..825e9a0 100644 --- a/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js +++ b/frontend/sweet-red-beans/src/components/DMPage/DMDetail.js @@ -1,9 +1,9 @@ import React, { - useState, - useCallback, - useEffect, - useMemo, - useRef, + useState, + useCallback, + useEffect, + useMemo, + useRef, } from 'react'; import * as StompJs from '@stomp/stompjs'; import SockJS from 'sockjs-client'; @@ -24,414 +24,357 @@ let stompClient = null; //props를 selectedRoom으로 바꾸고 roomId는 selectedRoom.chat_room_id으로 바꾸기 //transaction_id 값 바꾸기 const DMDetail = ({ selectedRoom }) => { - const navigation = useNavigate(); - - const [modalOpen, setModalOpen] = useState(false); - - const [reportContent, setReportContent] = useState(''); - //거래완료되면 true - //초기값 selectedRoom.is_complete로 설정하기 - const [complete, setComplete] = useState(selectedRoom.is_complete); - - const [imgFile, setImgFile] = useState(null); - const [imgBase64, setImgBase64] = useState(null); - - const [myNickname, setMyNickname] = useState(''); - - const openModal = () => { - setModalOpen(true); - }; - const closeModal = () => { - setModalOpen(false); - }; - - //대화 내용, 상대방 것 포함 - const [contents, setContents] = useState([]); - const [username, setUsername] = useState(''); - //내가 보낸 메시지 내용 - const [message, setMessage] = useState(''); - - let socket = new SockJS('http://localhost:8080/ws-stomp'); - let stompClient = Stomp.over(socket); - - useEffect(() => { - axios - .get('http://localhost:8080/mypage', { - withCredentials: true, - }) - .then((response) => { - setMyNickname(response.data.user.nickname); - }) - .catch((e) => console.log(e)); - }, []); - - useEffect(() => { - console.log(myNickname); - }, [myNickname]); - - //전송 버튼 눌렀을 때 - const sendClick = () => { - // if(!cookies.get("login")) { - // alert("로그인을 먼저 해주세요"); - // navigation('/') - // } - sendMessage(message); - //서버에서 받아올 때처럼 비슷한 형식으로 넣어주기 위해 - setMessage(''); - }; - - const sendMessage = (message) => { - const fd = new FormData(); - - if (imgFile === null) { - if (message !== '') { - stompClient.send( - '/pub/chat/message', - {}, - JSON.stringify({ - content: message, - chat_room_id: selectedRoom.chat_room_id, - }) - ); - } - } else { - stompClient.send( - '/pub/chat/message', - {}, - JSON.stringify({ - content: message, - chat_room_id: selectedRoom.chat_room_id, - image_url: imgBase64, - }) - ); - setImgBase64(null); - setImgFile(null); + const navigation = useNavigate(); + + const [modalOpen, setModalOpen] = useState(false); + + const [reportContent, setReportContent] = useState(''); + //거래완료되면 true + //초기값 selectedRoom.is_complete로 설정하기 + // const [complete, setComplete] = useState(selectedRoom.is_complete); + const [complete, setComplete] = useState(false); + const [imgFile, setImgFile] = useState(null); + const [imgBase64, setImgBase64] = useState(null); + + const [myNickname, setMyNickname] = useState(''); + + const openModal = () => { + setModalOpen(true); + }; + const closeModal = () => { + setModalOpen(false); + }; + + //대화 내용, 상대방 것 포함 + const [contents, setContents] = useState([]); + const [username, setUsername] = useState(''); + //내가 보낸 메시지 내용 + const [message, setMessage] = useState(''); + + let socket = new SockJS('http://localhost:8080/ws-stomp'); + let stompClient = Stomp.over(socket); + + //이제까지 메시지 내역 조회 + useEffect(() => { + console.log(selectedRoom); + setContents([]); + setMessage(''); + if (selectedRoom !== undefined) { + axios + .get('http://localhost:8080/direct-message/detail', { + withCredentials: true, + params: { + room_id: selectedRoom.chat_room_id, + }, + }) + .then((response) => { + setContents(response.data.message); + }) + .catch((error) => console.log(error)); + } + + stompClient.connect({}, () => { + stompClient.subscribe( + '/sub/chat/room/' + selectedRoom.chat_room_id, + (data) => { + console.log(JSON.parse(data.body)); + const newMessage = JSON.parse(data.body); + addMessage(newMessage); } + ); + }); + setComplete(selectedRoom.is_complete); + + return () => { + if (stompClient != null) { + stompClient.disconnect(); + setContents(null); + } }; - - useEffect(() => { - console.log(imgBase64); - }, [imgBase64]); - - useEffect(() => { - console.log(contents); - }, [contents]); - - const addMessage = (message) => { - //상대에게 받아온 메시지를 추가함 - setContents((prev) => [...prev, message]); + }, [selectedRoom]); + + //전송 버튼 눌렀을 때 + const sendClick = () => { + sendMessage(message); + setMessage(''); + }; + + const sendMessage = (message) => { + const fd = new FormData(); + + if (imgFile === null) { + if (message !== '') { + stompClient.send( + '/pub/chat/message', + {}, + JSON.stringify({ + content: message, + chat_room_id: selectedRoom.chat_room_id, + }) + ); + } + } else { + stompClient.send( + '/pub/chat/message', + {}, + JSON.stringify({ + content: message, + chat_room_id: selectedRoom.chat_room_id, + image_url: imgBase64, + }) + ); + setImgBase64(null); + setImgFile(null); + } + }; + + const addMessage = (message) => { + //상대에게 받아온 메시지를 추가함 + setContents((prev) => [...prev, message]); + }; + + const onChange = useCallback((e) => { + setMessage(e.target.value); + }, []); + + //신뢰도 +1 주는 버튼 + const reliabilityPlusClick = () => { + //신뢰도 1 주기 + if (complete === false) { + alert('거래완료를 해야 신뢰도를 줄 수 있습니다'); + } else { + const body = { + user_id: selectedRoom.not_mine_id, + }; + axios + .post('http://localhost:8080/direct-message/reliability', body, { + withCredentials: true, + }) + .then((response) => { + if (response.data.result) { + alert('상대방의 신뢰도가 올랐습니다.'); + } else { + alert('신뢰도를 올리는 데 실패했습니다.'); + } + }) + .catch((error) => console.log(error)); + } + }; + + //신고 내용 + const reportContentChange = (e) => { + setReportContent(e.target.value); + }; + + //신고 확인 버튼 눌렀을 때 + const reportConfirm = () => { + const body = { + user_id: '1', + transaction_id: selectedRoom.transaction_id, + report_content: reportContent, }; - - const onChange = useCallback((e) => { - setMessage(e.target.value); - }, []); - - //이제까지 메시지 내역 조회 - useEffect(() => { - console.log(selectedRoom); - setContents([]); - setMessage(''); - if (selectedRoom !== undefined) { - axios - .get('http://localhost:8080/direct-message/detail', { - withCredentials: true, - params: { - room_id: selectedRoom.chat_room_id, - }, - }) - .then((response) => { - //setMList(response.data.message.map(item => item.message_content)); - setContents(response.data.message); - }) - .catch((error) => console.log(error)); - } - - stompClient.connect({}, () => { - stompClient.subscribe( - '/sub/chat/room/' + selectedRoom.chat_room_id, - (data) => { - console.log(JSON.parse(data.body)); - const newMessage = JSON.parse(data.body); - addMessage(newMessage); - } - ); - }); - setComplete(selectedRoom.is_complete); - - return () => { - if (stompClient != null) { - stompClient.disconnect(); - } - }; - }, [selectedRoom]); - - //신뢰도 +1 주는 버튼 - const reliabilityPlusClick = () => { - //신뢰도 1 주기 - if (complete === false) { - alert('거래완료를 해야 신뢰도를 줄 수 있습니다'); + axios + .post('http://localhost:8080/direct-message/report', body, { + withCredentials: true, + }) + .then((response) => { + if (response.data.result) { + alert('신고되었습니다.'); + setReportContent(''); + setModalOpen(false); } else { - const body = { - user_id: selectedRoom.not_mine_id, - }; - axios - .post( - 'http://localhost:8080/direct-message/reliability', - body, - { withCredentials: true } - ) - .then((response) => { - if (response.data.result) { - alert('상대방의 신뢰도가 올랐습니다.'); - } else { - alert('신뢰도를 올리는 데 실패했습니다.'); - } - }) - .catch((error) => console.log(error)); + alert('신고에 실패했습니다.'); } + }) + .catch((error) => console.log(error)); + }; + + //삭제 취소 버튼 눌렀을 때 + const cancelConfirm = (e) => { + console.log('신고 취소'); + }; + + //모달창에서 신고하기 버튼 눌렀을 때 + const reportClick = (e) => { + e.preventDefault(); + if (reportContent === '') { + alert('신고 내용을 입력해주세요'); + } else { + if (window.confirm('정말 신고하시겠습니까?')) { + reportConfirm(); + } else { + cancelConfirm(); + } + } + }; + + //거래완료 버튼 눌렀을 때 + const completeClick = () => { + const body = { + transaction_id: selectedRoom.transaction_id, }; - - //신고 내용 - const reportContentChange = (e) => { - setReportContent(e.target.value); - }; - - //신고 확인 버튼 눌렀을 때 - const reportConfirm = () => { - const body = { - user_id: '1', - transaction_id: selectedRoom.transaction_id, - report_content: reportContent, - }; - axios - .post('http://localhost:8080/direct-message/report', body, { - withCredentials: true, - }) - .then((response) => { - if (response.data.result) { - alert('신고되었습니다.'); - setReportContent(''); - setModalOpen(false); - } else { - alert('신고에 실패했습니다.'); - } - }) - .catch((error) => console.log(error)); - }; - - //삭제 취소 버튼 눌렀을 때 - const cancelConfirm = (e) => { - console.log('신고 취소'); - }; - - //모달창에서 신고하기 버튼 눌렀을 때 - const reportClick = (e) => { - e.preventDefault(); - if (reportContent === '') { - alert('신고 내용을 입력해주세요'); + axios + .post('http://localhost:8080/direct-message/transaction-complete', body, { + withCredentials: true, + }) + .then((response) => { + if (response.data.result) { + setComplete(true); } else { - if (window.confirm('정말 신고하시겠습니까?')) { - reportConfirm(); - } else { - cancelConfirm(); - } + alert('거래완료에 실패했습니다.'); } + }) + .catch((error) => console.log(error)); + }; + + useEffect(() => { + // 메시지가 오면 스크롤 맨 아래로 내려주기 + let messagebox = document.querySelector('#messagebox'); + messagebox.scrollTop = messagebox.scrollHeight; + }, [contents, imgBase64]); + + const fileChange = (e) => { + setImgFile(e.target.files); + }; + + const previewCancelClick = () => { + setImgFile(null); + setImgBase64(null); + }; + + useEffect(() => { + if (!imgFile) return false; + + const reader = new FileReader(); + reader.onloadend = () => { + setImgBase64(reader.result); }; - - //거래완료 버튼 눌렀을 때 - const completeClick = () => { - const body = { - transaction_id: selectedRoom.transaction_id, - }; - axios - .post( - 'http://localhost:8080/direct-message/transaction-complete', - body, - { withCredentials: true } - ) - .then((response) => { - if (response.data.result) { - setComplete(true); - } else { - alert('거래완료에 실패했습니다.'); - } - }) - .catch((error) => console.log(error)); - }; - - useEffect(() => { - let messagebox = document.querySelector('#messagebox'); - messagebox.scrollTop = messagebox.scrollHeight; - }, [contents, imgBase64]); - - const handleChangeFile = (e) => { - setImgFile(e.target.files); - }; - - const previewCancelClick = () => { - setImgFile(null); - setImgBase64(null); - }; - - useEffect(() => { - if (!imgFile) return false; - - const reader = new FileReader(); - reader.onloadend = () => { - setImgBase64(reader.result); - }; - reader.readAsDataURL(imgFile[0]); - }, [imgFile]); - - return ( - <> - -
-
신고사유를 적어주세요
-
- -
- -
-
- -
-
-
- -
- {selectedRoom.user_status === '정지' || - selectedRoom.user_status === '탈퇴' - ? '(알수없음)' - : selectedRoom.not_mine_nickname} -
-
{selectedRoom.not_mine_reliability}
-
- - - -
-
- {useMemo( - () => ( -
- {contents.map((message, index) => ( -
- {message.image_url === null || - message.image_url === '' ? ( - <> -
- {message.nickname === myNickname - ? parseDate( - message.written_date - ) - : null} -
-
{message.content}
-
- {!( - message.nickname === - myNickname - ) - ? parseDate( - message.written_date - ) - : null} -
- - ) : ( - <> -
- {message.nickname === myNickname - ? parseDate( - message.written_date - ) - : null} -
-
-
{message.content}
-
- -
-
-
- {!( - message.nickname === - myNickname - ) - ? parseDate( - message.written_date - ) - : null} -
- - )} -
- ))} -
- {imgBase64 !== null ? ( -
- - -
- ) : null} -
+ reader.readAsDataURL(imgFile[0]); + }, [imgFile]); + + return ( + <> + +
+
신고사유를 적어주세요
+
+ +
+ +
+
+ +
+
+
+ +
+ {selectedRoom.user_status === '정지' || + selectedRoom.user_status === '탈퇴' + ? '(알수없음)' + : selectedRoom.not_mine_nickname} +
+
{selectedRoom.not_mine_reliability}
+
+ + + +
+
+ {useMemo( + () => ( +
+ {contents.map((message, index) => ( +
+ {message.image_url === null || message.image_url === '' ? ( + <> +
+ {message.nickname === myNickname + ? parseDate(message.written_date) + : null} +
+
{message.content}
+
+ {!(message.nickname === myNickname) + ? parseDate(message.written_date) + : null} +
+ + ) : ( + <> +
+ {message.nickname === myNickname + ? parseDate(message.written_date) + : null} +
+
+
{message.content}
+
+
- ), - [contents, imgBase64, myNickname] - )} - - {complete ? ( -
거래가 완료되었습니다.
- ) : null} - -
- - - - +
+
+ {!(message.nickname === myNickname) + ? parseDate(message.written_date) + : null} +
+ + )}
+ ))} +
+ {imgBase64 !== null ? ( +
+ + +
+ ) : null} +
- - ); + ), + [contents, imgBase64, myNickname] + )} + + {complete ? ( +
거래가 완료되었습니다.
+ ) : null} + +
+ + + + +
+
+ + ); }; export default DMDetail; diff --git a/frontend/sweet-red-beans/src/components/DMPage/DMList.js b/frontend/sweet-red-beans/src/components/DMPage/DMList.js index ace2449..f716ec2 100644 --- a/frontend/sweet-red-beans/src/components/DMPage/DMList.js +++ b/frontend/sweet-red-beans/src/components/DMPage/DMList.js @@ -7,19 +7,43 @@ import { SELECTED_DM } from '../../actions/types'; import { useNavigate } from 'react-router'; import style from '../../css/DMPage/DMList.module.css'; -const DMList = ({ DMlist, DMListClick }) => { - console.log(DMlist); - return ( - <> -
- {DMlist.map((item, index) => ( -
DMListClick(item, e)}> - -
- ))} -
- - ); +const DMList = () => { + const dispatch = useDispatch(); + const [DMlist, setDMList] = useState([]); + useEffect(() => { + //DM 목록 조회 + axios + .get('http://localhost:8080/direct-message', { + withCredentials: true, + }) + .then((response) => { + setDMList(response.data.room_id); + }) + .catch((error) => {}); + + return () => { + setDMList(null); + }; + }, []); + + const DMListClick = (selectedRoom, e) => { + dispatch({ + type: SELECTED_DM, + payload: selectedRoom, + }); + }; + + return ( + <> +
+ {DMlist.map((item, index) => ( +
DMListClick(item, e)}> + +
+ ))} +
+ + ); }; export default DMList; diff --git a/frontend/sweet-red-beans/src/components/DMPage/DMListThumbnail.js b/frontend/sweet-red-beans/src/components/DMPage/DMListThumbnail.js index 0326a57..145f625 100644 --- a/frontend/sweet-red-beans/src/components/DMPage/DMListThumbnail.js +++ b/frontend/sweet-red-beans/src/components/DMPage/DMListThumbnail.js @@ -6,61 +6,55 @@ import { parseDate } from '../../parseDate/parseDate'; import user from '../../img/user.png'; const DMListThumbnail = ({ dm }) => { - //const cookies = Cookies(); - const dispatch = useDispatch(); - const navigation = useNavigate(); - const [currentRoom, setCurrentRoom] = useState(false); - const selectedRoomId = useSelector((s) => { - if (s === undefined) { - return null; - } else { - return s.selectedRoomId; - } - }); + //const cookies = Cookies(); + const dispatch = useDispatch(); + const navigation = useNavigate(); + const [currentRoom, setCurrentRoom] = useState(false); + const selectedRoomId = useSelector((s) => { + if (s === undefined) { + return null; + } else { + return s.selectedRoom; + } + }); - useEffect(() => { - console.log(dm); - if (selectedRoomId !== null) { - if (dm.chat_room_id === selectedRoomId) { - console.log('a의 번호: ', selectedRoomId); - console.log('같음 : ', dm.chat_room_id); - setCurrentRoom(true); - } else { - setCurrentRoom(false); - } - } - }, [selectedRoomId]); + useEffect(() => { + if (selectedRoomId !== null) { + if (dm.chat_room_id === selectedRoomId.chat_room_id) { + setCurrentRoom(true); + } else { + setCurrentRoom(false); + } + } + }, [selectedRoomId]); - return ( - <> -
- + return ( + <> +
+ -
-
- {dm.user_status === '정지' || dm.user_status === '탈퇴' - ? '(알수없음)' - : dm.not_mine_nickname} -
-
{dm.recent_message}
-
-
- {dm.recent_message_date === '2020-01-01T00:00:00' - ? '' - : parseDate(dm.recent_message_date)} -
-
- - ); +
+
+ {dm.user_status === '정지' || dm.user_status === '탈퇴' + ? '(알수없음)' + : dm.not_mine_nickname} +
+
{dm.recent_message}
+
+
+ {dm.recent_message_date === '2020-01-01T00:00:00' + ? '' + : parseDate(dm.recent_message_date)} +
+
+ + ); }; export default DMListThumbnail; diff --git a/frontend/sweet-red-beans/src/components/DMPage/DMPage.js b/frontend/sweet-red-beans/src/components/DMPage/DMPage.js index 3b6a322..b124ef6 100644 --- a/frontend/sweet-red-beans/src/components/DMPage/DMPage.js +++ b/frontend/sweet-red-beans/src/components/DMPage/DMPage.js @@ -8,61 +8,27 @@ import style from '../../css/DMPage/DMPage.module.css'; import { SELECTED_DM } from '../../actions/types'; const DMPage = () => { - const dispatch = useDispatch(); - const [DMlist, setDMList] = useState([]); - const [selectedRoomId, setSelectedRoomId] = useState(null); - - const navigation = useNavigate(); - const [renderError, setRenderError] = useState(true); - - useEffect(() => { - //DM 목록 조회 - axios - .get('http://localhost:8080/direct-message', { - withCredentials: true, - }) - .then((response) => { - setDMList(response.data.room_id); - setRenderError(false); - }) - .catch((error) => { - setRenderError(true); - alert('로그인을 먼저 해주세요'); - navigation('/'); - }); - - return () => { - dispatch({ - type: SELECTED_DM, - payload: null, - }); - }; - }, []); - - const DMListClick = (selectedRoom, e) => { - dispatch({ - type: SELECTED_DM, - payload: selectedRoom.chat_room_id, - }); - setSelectedRoomId(selectedRoom); - }; + const selectedRoomId = useSelector((s) => { + if (s === undefined) { + return null; + } else { + return s.selectedRoom; + } + }); return ( <> - {!renderError ? ( - <> -
-
- -
-
- {selectedRoomId !== null ? ( - - ) : null} -
-
- - ) : null} +
+
+ +
+ +
+ {selectedRoomId !== null ? ( + + ) : null} +
+
); }; diff --git a/frontend/sweet-red-beans/src/components/MainPage/MainMovieEvents.js b/frontend/sweet-red-beans/src/components/MainPage/MainMovieEvents.js index eb75b67..a47a732 100644 --- a/frontend/sweet-red-beans/src/components/MainPage/MainMovieEvents.js +++ b/frontend/sweet-red-beans/src/components/MainPage/MainMovieEvents.js @@ -11,71 +11,67 @@ import Test from './Test'; import EventMovieThumbnail from '../EventPage/EventMovieThumbnail'; const MainMovieEvents = ({ cinemaName }) => { - const dispatch = useDispatch(); - const [events, setEvents] = useState([]); - const [thisEvents, setThisEvents] = useState([]); - const filterMovieList = []; + const dispatch = useDispatch(); + const [events, setEvents] = useState([]); + const [thisEvents, setThisEvents] = useState([]); + const filterMovieList = []; - useEffect(() => { - axios - .get('http://localhost:8080/main/event-limit', { - withCredentials: true, - }) - .then((response) => { - setEvents(response.data); - }); - }, []); + useEffect(() => { + axios + .get('http://localhost:8080/main/event-limit', { + withCredentials: true, + }) + .then((response) => { + setEvents(response.data); + }); + }, []); - useEffect(() => { - console.log(events); - events.map((item, index) => { - if (item.cinema_name === cinemaName) { - filterMovieList.push(item); - } - }); - setThisEvents(filterMovieList); - dispatch({ - type: MAIN_CINEMA_EVENTS, - mainCinemaEvents: { - cinemaName: cinemaName, - mainCinemaEvents: filterMovieList, - }, - }); - }, [events]); + useEffect(() => { + console.log(events); + events.map((item, index) => { + if (item.cinema_name === cinemaName) { + filterMovieList.push(item); + } + }); + setThisEvents(filterMovieList); + dispatch({ + type: MAIN_CINEMA_EVENTS, + mainCinemaEvents: { + cinemaName: cinemaName, + mainCinemaEvents: filterMovieList, + }, + }); + }, [events]); - useEffect(() => {}, [thisEvents]); - - const settings = { - dots: false, - arrows: true, - infinite: true, - speed: 500, - slidesToShow: 3, - slidesToScroll: 3, - }; - return ( - <> -
- {cinemaName} -
-
-
- {thisEvents !== [] ? ( - - { - thisEvents.map((item, index) => ( -
- -
- )) - //thisEvents!==[] ? thisEvents.map((item, index) =>
) : null - //test.map((item, index) =>
{item}
) - } -
- ) : null} -
- - ); + const settings = { + dots: false, + arrows: true, + infinite: true, + speed: 500, + slidesToShow: 1, + slidesToScroll: 1, + }; + return ( + <> +
+ {cinemaName} +
+
+
+ {thisEvents.length !== 0 ? ( + + {thisEvents.map((item, index) => ( +
+ +
+ ))} +
+ ) : ( +
업데이트 된 이벤트가 없어요
+ )} +
+ + ); }; export default MainMovieEvents; diff --git a/frontend/sweet-red-beans/src/components/MainPage/MainPage.js b/frontend/sweet-red-beans/src/components/MainPage/MainPage.js index cc5c7c8..a7c444b 100644 --- a/frontend/sweet-red-beans/src/components/MainPage/MainPage.js +++ b/frontend/sweet-red-beans/src/components/MainPage/MainPage.js @@ -11,58 +11,53 @@ import { Link } from 'react-router-dom'; import { useNavigate } from 'react-router'; const MainPage = () => { - const [cinemaNames, setCinemaNames] = useState([ - 'CGV', - '롯데시네마', - '메가박스', - '씨네큐', - ]); - const dispatch = useDispatch(); - const [mainVideo, setMainVideo] = useState(''); - const navigation = useNavigate(); + const [cinemaNames, setCinemaNames] = useState([ + 'CGV', + '롯데시네마', + '메가박스', + '씨네큐', + ]); + const dispatch = useDispatch(); + const [mainVideo, setMainVideo] = useState(''); + const navigation = useNavigate(); - dispatch({ - type: CINEMA_NAMES, - cinemaNames: cinemaNames, - }); - - useEffect(() => { - axios - .get('http://localhost:8080/main/video', { - withCredentials: true, - }) - .then((response) => { - setMainVideo(response.data.src); - }) - .catch((error) => console.log(error)); - return () => { - setMainVideo(''); - }; - }, []); - - const arrowClick = () => { - navigation('/event'); + useEffect(() => { + axios + .get('http://localhost:8080/main/video', { + withCredentials: true, + }) + .then((response) => { + setMainVideo(response.data.src); + }) + .catch((error) => console.log(error)); + return () => { + setMainVideo(''); }; + }, []); + + const arrowClick = () => { + navigation('/event'); + }; - return ( - <> -
- -
-
- EVENTS -
-
- {cinemaNames.map((item, index) => ( -
- -
- ))} + return ( + <> +
+ +
+
+ EVENTS +
+
+ {cinemaNames.map((item, index) => ( +
+ +
+ ))} -
TODAY'S POSTS
- - - ); +
TODAY'S POSTS
+ + + ); }; export default MainPage; diff --git a/frontend/sweet-red-beans/src/components/MainPage/MainPosts.js b/frontend/sweet-red-beans/src/components/MainPage/MainPosts.js index 73e0fba..aacd29c 100644 --- a/frontend/sweet-red-beans/src/components/MainPage/MainPosts.js +++ b/frontend/sweet-red-beans/src/components/MainPage/MainPosts.js @@ -11,6 +11,7 @@ const MainPosts = () => { useEffect(() => { axios + .get('http://localhost:8080/main/daily-community', { withCredentials: true, params: { @@ -35,6 +36,11 @@ const MainPosts = () => { setDailyGeneralPosts(response.data); }) .catch((error) => console.log(error)); + + // return () => { + // setDailyInfoPosts(null); + // setDailyGeneralPosts(null); + // }; }, []); const writeClick = () => { @@ -56,6 +62,10 @@ const MainPosts = () => { key={index}>
  • {item.title}
    +
    +
    16
    +
    16
    +
  • ))} @@ -71,6 +81,10 @@ const MainPosts = () => { key={index}>
  • {item.title}
    +
    +
    16
    +
    16
    +
  • ))} @@ -83,27 +97,6 @@ const MainPosts = () => {
    내 통장처럼 비어버린 오늘의 글...
    )} - - {/* {dailyGeneralPosts.length !== 0 ? ( -
      - {dailyGeneralPosts.map((item, index) => ( - -
    • -
      {item.title}
      -
    • - - ))} -
    - ) : ( -
    -
    지금 당장 글 쓰러 가기
    -
    -
    내 통장처럼 비어버린 오늘의 글...
    -
    - )} */}
    ); diff --git a/frontend/sweet-red-beans/src/components/TransactionPage/TransactionDetail.js b/frontend/sweet-red-beans/src/components/TransactionPage/TransactionDetail.js index 88447a1..2a723b0 100644 --- a/frontend/sweet-red-beans/src/components/TransactionPage/TransactionDetail.js +++ b/frontend/sweet-red-beans/src/components/TransactionPage/TransactionDetail.js @@ -2,7 +2,7 @@ import React, { useEffect, useMemo, useState } from 'react'; import axios from 'axios'; import { useNavigate } from 'react-router'; import { useDispatch } from 'react-redux'; -import { DM_CREATE } from '../../actions/types'; +import { DM_CREATE, SELECTED_DM } from '../../actions/types'; import style from '../../css/TransactionPage/TransactionDetail.module.css'; import Modal from '../Modals/TransactionModal'; import Switch from 'react-switch'; @@ -93,8 +93,14 @@ const TransactionDetail = ({ transaction }) => { ); const DMClick = () => { + if ( + transaction.user_status === '정지' || + transaction.user_status === '탈퇴' + ) { + alert('정지되거나 탈퇴한 사용자입니다.'); + return; + } const body = { - user_id: '1', transaction_id: transaction.transaction_id, }; axios @@ -103,7 +109,7 @@ const TransactionDetail = ({ transaction }) => { }) .then((response) => { dispatch({ - type: DM_CREATE, + type: SELECTED_DM, DMCreate: response.data, }); navigation('/DM'); diff --git a/frontend/sweet-red-beans/src/css/MainPage/MainMovieEvents.module.css b/frontend/sweet-red-beans/src/css/MainPage/MainMovieEvents.module.css index feaac14..a1279cf 100644 --- a/frontend/sweet-red-beans/src/css/MainPage/MainMovieEvents.module.css +++ b/frontend/sweet-red-beans/src/css/MainPage/MainMovieEvents.module.css @@ -1,29 +1,39 @@ .cinemaName { - cursor: default; - display: inline-block; - position: relative; - text-align: left; - margin-bottom: 50px; - margin-left: -870px; - font-size: 20px; - z-index: 5; - font-family: 'ROKAFSansBold'; + cursor: default; + display: inline-block; + position: relative; + text-align: left; + margin-bottom: 50px; + margin-left: -870px; + font-size: 20px; + z-index: 5; + font-family: 'ROKAFSansBold'; } .underline { - display: inline-block; - z-index: 0; - position: absolute; - content: ''; - bottom: -8px; - left: 50%; - transform: translate(-50%, 0%); - width: 120%; - height: 5px; - background-color: #f23333; - border-radius: 10px; + display: inline-block; + z-index: 0; + position: absolute; + content: ''; + bottom: -8px; + left: 50%; + transform: translate(-50%, 0%); + width: 120%; + height: 5px; + background-color: #f23333; + border-radius: 10px; } .movieThumbnails { - margin-bottom: 50px; + margin-bottom: 50px; +} + +.nullEvents { + height: 280px; + display: flex; + justify-content: center; + align-items: center; + font-size: 20px; + color: #5a5a5a; + font-family: 'ROKAFSansBold'; } diff --git a/frontend/sweet-red-beans/src/css/MainPage/MainPosts.module.css b/frontend/sweet-red-beans/src/css/MainPage/MainPosts.module.css index de0dc94..b2198c9 100644 --- a/frontend/sweet-red-beans/src/css/MainPage/MainPosts.module.css +++ b/frontend/sweet-red-beans/src/css/MainPage/MainPosts.module.css @@ -10,9 +10,10 @@ .dailyInfoPosts, .dailyGeneralPosts { - border: #5a5a5a 1px solid; + border: #c4c4c4 1px solid; border-radius: 20px; width: 480px; + min-height: 480px; padding: 40px; box-sizing: border-box; } @@ -25,26 +26,65 @@ .posts li { padding: 30px 15px 0px 15px; box-sizing: border-box; + display: flex; + justify-content: space-between; } .posts li div { font-size: 16px; } -.posts li div:hover { +.title { + cursor: pointer; + display: inline-block; + font-size: 18px; + color: #5a5a5a; +} + +.title:hover { + color: #f23333; text-decoration: underline; } -.posts li:hover::after { - transform: translate(-50%, 0) scaleX(1); +.countArea { + font-size: 14px; + color: #5a5a5a; + font-family: 'Pretendard-Regular'; } -.title { - cursor: pointer; +.commentCount { display: inline-block; + margin-right: 5px; +} + +.commentCount::before { + display: inline-block; + content: ''; + width: 18px; + height: 18px; + background: url('../../img/main-comment.png'); + background-repeat: no-repeat; + background-size: 90%; + background-position: 50% 20%; vertical-align: middle; - font-size: 18px; - color: black; + margin-right: 5px; +} + +.views { + display: inline-block; +} + +.views::before { + display: inline-block; + content: ''; + width: 18px; + height: 18px; + background: url('../../img/view.png'); + background-repeat: no-repeat; + background-size: 100%; + background-position: 50% 20%; + vertical-align: top; + margin-right: 4px; } .nullMessage { diff --git a/frontend/sweet-red-beans/src/img/main-comment.png b/frontend/sweet-red-beans/src/img/main-comment.png new file mode 100644 index 0000000000000000000000000000000000000000..9854a3e8964467571386554daaf5b7966906c366 GIT binary patch literal 13202 zcmcIri9eLz_kYG1LP)ZdLJYE#>|4n4WDRAH$i9tzH#7NE)-Xa@i>XMKEE%#)C5k9R z+07uy5+-Y5=J)9PH~hTDYdrVd=iGbGx%b?2-secMvM^?6J;e$D06S=M$r=C{pg$Ra zBTUfOX7uo1=!-E-AGAFJ{lp)+nG8L%piCUX0DzS3Xi%G z>Ip6T)ve7=lG2|fWxf1 z`;r@jLd)u!*>hS<{|UE!40<8NEpTcrpCNatb_CY9Oq-B$^W364TsvsTbIbx4r7}~9 z--s(qp97Z?+YthqyMG4~rRp3mc{1CZo;sp+EyEKJGx)VYS}Gl(1t_9iw-(&p4ECyI zwp5q_>$m`x72AwrtUB=((ahSoQ&vH?B53ei4ik*CKEw)z-rCthze>I^CtL||0C;yZ zpu}itGRn)txYI`YDf8E=2`xsMithbZS9xLfV?|(=(MK3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POi?bOe>q7uY=#jugNH0DrmQuI+f7z;-6k63V}l_y}{b+DwMuATMyVzn~ZzK)GpPQ z-pjO#tlz^rnKUQS><_kN@$60blJ9_eQPiSLq~ojAdn*P^W=C(Uopxjj-* z7%jOFrqFQ8X|Om=-PnU=UD&sPhFz*%gY(*9~x6rdvI-Mf!hRr`*EUcL&>oE zh?d^CZRL-_R@d4Z+D^|)c>eHAq`0|~QLq~6*UO^DC@d13@yd?;o4R`XwKh#Z_Jsuw zk8;XZp(h_U42TC-%7E5{#qb5ezn-a{_dNul)G228kE>xk^H_g~>|#qal%%|&;XCy3 zCr7=LhxVe+bVzxE9un;B52nS;)e^bN6O|!o60S*)hw2=w(QhkU*&&ddIH2n~c~L{r z5{I{@mY_@QncDdHHUH-8?+pxkd{=y>NS zfiwDypfHqsQ0)A}$Hxg5x-m2~4<$LzXwu!?)fZpt?5yP@b4!ZR%T%?>xza(m2?(Np zJJ8u=ufMe09N0JmB>>zP$ni43G|ViB@Kp?Cy}3Ykc80YbDc0A?#T{ zl2+KwMB1b+67`^}R3!MsbD`8-9mTO&LW`7bsz6qHNA$jt8^V%-yO->c#N$x)|NPg| z5r$<0e<<}5U9157d@_J$M@gf!1vK|{?|y?a2D!aDz|U_3XlprOU38hy80{|7`n_M!j) literal 0 HcmV?d00001 diff --git a/frontend/sweet-red-beans/src/store.js b/frontend/sweet-red-beans/src/store.js index 9111c37..709635a 100644 --- a/frontend/sweet-red-beans/src/store.js +++ b/frontend/sweet-red-beans/src/store.js @@ -1,84 +1,82 @@ -import { createStore } from "redux"; -import { LOGIN_USER, MAIN_EVENTS, CINEMA_NAMES, MAIN_CINEMA_EVENTS, EVENTS, EVENT_ISEND, EVENT_SORT, INFO, -DM_CREATE, MYPAGE_USER, MYPAGE_TRANSACTIONS, MYPAGE_COMMENTS, MYPAGE_EVENTS, MYPAGE_POSTS, MYPAGE_LIKE_TRANSACTIONS, SELECTED_DM } from "./actions/types"; +import { createStore } from 'redux'; +import { + LOGIN_USER, + MAIN_EVENTS, + CINEMA_NAMES, + MAIN_CINEMA_EVENTS, + EVENTS, + EVENT_ISEND, + EVENT_SORT, + INFO, + DM_CREATE, + MYPAGE_USER, + MYPAGE_TRANSACTIONS, + MYPAGE_COMMENTS, + MYPAGE_EVENTS, + MYPAGE_POSTS, + MYPAGE_LIKE_TRANSACTIONS, + SELECTED_DM, +} from './actions/types'; - -const reducer = (state={}, action) => { - - if(action.type === LOGIN_USER){ - //user : nickname, profileURL이 있음 - return{...state, user: action.user} - } - else if(action.type === MAIN_EVENTS){ - //전체 이벤트(배열) - return {...state, mainEvents: action.events} - } - else if(action.type === CINEMA_NAMES){ - // - return {...state, cinemaNames: action.cinemaNames} - } - else if(action.type === MAIN_CINEMA_EVENTS){ - //각 영화사 별 이벤트(배열) - // if (action.mainCinemaEvents.cinemaName === "CGV") { - // return {...state, mainCGVEvents: action.mainCinemaEvents.mainCinemaEvents} - // } - // else if(action.mainCinemaEvents.cinemaName === "롯데시네마"){ - // return {...state, mainLCEvents: action.mainCinemaEvents.mainCinemaEvents} - // } - // else if(action.mainCinemaEvents.cinemaName === "메가박스"){ - // return {...state, mainLMBvents: action.mainCinemaEvents.mainCinemaEvents} - // } - // else if(action.mainCinemaEvents.cinemaName === "씨네큐"){ - // return {...state, mainLCQvents: action.mainCinemaEvents.mainCinemaEvents} - // } - } - else if (action.type === EVENTS){ - //이벤트 페이지에서 전체 이벤트 조회 - // cinema_name : string - // event_id : long - // thumbnail_url : string - // title : string - // start_date : date - // end_date : date - // is_like : boolean - return {...state, events: action.events} - } - else if (action.type === EVENT_ISEND){ - return {...state, eventIsEnd: action.payload} - } - else if (action.type === EVENT_SORT){ - return {...state, eventSort: action.payload} - } - else if (action.type === INFO){ - return {...state, info: action.info} - } - else if (action.type === DM_CREATE){ - return {...state, DMCreate: action.DMCreate} - } - else if (action.type === MYPAGE_USER){ - return {...state, mypageUser: action.payload} - } - else if (action.type === MYPAGE_TRANSACTIONS){ - return {...state, mypageTransactions: action.payload} - } - else if (action.type === MYPAGE_COMMENTS){ - return {...state, mypageComments: action.payload} - } - else if (action.type === MYPAGE_EVENTS){ - return {...state, mypageEvents: action.payload} - } - else if (action.type === MYPAGE_POSTS){ - return {...state, mypagePosts: action.payload} - } - else if (action.type === MYPAGE_LIKE_TRANSACTIONS){ - return {...state, mypageLikeTransactions: action.payload} - } - else if (action.type === SELECTED_DM){ - return {...state, selectedRoomId: action.payload} - } - -} +const reducer = (state = {}, action) => { + if (action.type === LOGIN_USER) { + //user : nickname, profileURL이 있음 + return { ...state, user: action.user }; + } else if (action.type === MAIN_EVENTS) { + //전체 이벤트(배열) + return { ...state, mainEvents: action.events }; + } else if (action.type === CINEMA_NAMES) { + // + return { ...state, cinemaNames: action.cinemaNames }; + } else if (action.type === MAIN_CINEMA_EVENTS) { + //각 영화사 별 이벤트(배열) + // if (action.mainCinemaEvents.cinemaName === "CGV") { + // return {...state, mainCGVEvents: action.mainCinemaEvents.mainCinemaEvents} + // } + // else if(action.mainCinemaEvents.cinemaName === "롯데시네마"){ + // return {...state, mainLCEvents: action.mainCinemaEvents.mainCinemaEvents} + // } + // else if(action.mainCinemaEvents.cinemaName === "메가박스"){ + // return {...state, mainLMBvents: action.mainCinemaEvents.mainCinemaEvents} + // } + // else if(action.mainCinemaEvents.cinemaName === "씨네큐"){ + // return {...state, mainLCQvents: action.mainCinemaEvents.mainCinemaEvents} + // } + } else if (action.type === EVENTS) { + //이벤트 페이지에서 전체 이벤트 조회 + // cinema_name : string + // event_id : long + // thumbnail_url : string + // title : string + // start_date : date + // end_date : date + // is_like : boolean + return { ...state, events: action.events }; + } else if (action.type === EVENT_ISEND) { + return { ...state, eventIsEnd: action.payload }; + } else if (action.type === EVENT_SORT) { + return { ...state, eventSort: action.payload }; + } else if (action.type === INFO) { + return { ...state, info: action.info }; + } else if (action.type === DM_CREATE) { + return { ...state, DMCreate: action.DMCreate }; + } else if (action.type === MYPAGE_USER) { + return { ...state, mypageUser: action.payload }; + } else if (action.type === MYPAGE_TRANSACTIONS) { + return { ...state, mypageTransactions: action.payload }; + } else if (action.type === MYPAGE_COMMENTS) { + return { ...state, mypageComments: action.payload }; + } else if (action.type === MYPAGE_EVENTS) { + return { ...state, mypageEvents: action.payload }; + } else if (action.type === MYPAGE_POSTS) { + return { ...state, mypagePosts: action.payload }; + } else if (action.type === MYPAGE_LIKE_TRANSACTIONS) { + return { ...state, mypageLikeTransactions: action.payload }; + } else if (action.type === SELECTED_DM) { + return { ...state, selectedRoom: action.payload }; + } +}; const store = createStore(reducer); -export default store; \ No newline at end of file +export default store;