diff --git a/front/src/components/Modal/Modal.tsx b/front/src/components/Modal/Modal.tsx index 6f2e48e..ffef571 100644 --- a/front/src/components/Modal/Modal.tsx +++ b/front/src/components/Modal/Modal.tsx @@ -1,10 +1,12 @@ import { useEffect, useRef, useState } from 'react'; import { createPortal } from 'react-dom'; -import { useSetRecoilState } from 'recoil'; +// import { useSetRecoilState } from 'recoil'; import styled from 'styled-components'; -import { axios, theme } from '@utils'; -import { useNav } from '@hooks'; -import { MessageListRecoil, SnowBallRecoil } from '@states'; +import { theme } from '@utils'; + +// add axios +// import { useNav } from '@hooks'; +// import { MessageListRecoil, SnowBallRecoil } from '@states'; interface MsgResponse { user_id: number; @@ -20,6 +22,8 @@ interface MsgResponse { is_deleted: boolean; opened: string; letter_id: number; + sentiment: 'positive' | 'neutral' | 'negative'; // temp + confidence: number; // temp } interface DeleteModalProps { @@ -112,11 +116,12 @@ const MButton = styled.button` `; const DeleteModal = (props: DeleteModalProps) => { - const navigate = useNav(); + // const navigate = useNav(); const [isModalOpened, setIsModalOpened] = useState(false); const modalRef = useRef(null); - const setMessageList = useSetRecoilState(MessageListRecoil); - const setSnowBallBox = useSetRecoilState(SnowBallRecoil); + console.log(props); // temp + // const setMessageList = useSetRecoilState(MessageListRecoil); + // const setSnowBallBox = useSetRecoilState(SnowBallRecoil); useEffect(() => { const closeModal = (e: MouseEvent) => { @@ -135,10 +140,10 @@ const DeleteModal = (props: DeleteModalProps) => { }; }, [isModalOpened]); - const deleteArrayElement = (arr: Array, index: number) => { - const newArr = arr.filter((_, idx) => idx !== index); - props.set(newArr); - }; + // const deleteArrayElement = (arr: Array, index: number) => { + // const newArr = arr.filter((_, idx) => idx !== index); + // props.set(newArr); + // }; const deleteMsg = async () => { setIsModalOpened(false); diff --git a/front/src/pages/Main/ListMsgs.tsx b/front/src/pages/Main/ListMsgs.tsx index a69e47f..6ce2d77 100644 --- a/front/src/pages/Main/ListMsgs.tsx +++ b/front/src/pages/Main/ListMsgs.tsx @@ -3,7 +3,7 @@ import { createPortal } from 'react-dom'; import { useRecoilValue } from 'recoil'; import styled from 'styled-components'; // import { axios } from '@utils'; -import { useLogout } from '@hooks'; +// import { useLogout } from '@hooks'; import { SnowBallRecoil } from '@states'; import { ListMsg, Prev } from '@components'; import { MSG_COLOR } from '@constants'; @@ -84,9 +84,9 @@ const ToastMsg = styled.div` `; const ListMsgs = (props: ListMsgProps) => { - const logout = useLogout(); + // const logout = useLogout(); const [messages, setMessages] = useState>([]); - const [toast, setToast] = useState(false); + const [toast] = useState(false); const { userData } = useRecoilValue(SnowBallRecoil); useEffect(() => { diff --git a/front/src/pages/Main/Main.tsx b/front/src/pages/Main/Main.tsx index b39bd4f..ab507ff 100644 --- a/front/src/pages/Main/Main.tsx +++ b/front/src/pages/Main/Main.tsx @@ -1,11 +1,12 @@ import { useEffect, useRef, useState } from 'react'; -import { useCookies } from 'react-cookie'; +// import { useCookies } from 'react-cookie'; import { createPortal } from 'react-dom'; import { useRecoilState, useSetRecoilState } from 'recoil'; import styled from 'styled-components'; import { Loading } from '@utils'; -import { useLogout, useNav } from '@hooks'; +import { useLogout } from '@hooks'; import { MessageListRecoil, SnowBallRecoil } from '@states'; +import { Message } from '@states'; import { SnowGlobeCanvas, UIContainer } from '@components'; import Introduce from '@pages/Intro/Introduce'; //temp @@ -82,9 +83,9 @@ const Main = () => { // document.cookie = `${cookieName2}=${cookieValue2}; expires=${expire2.toUTCString()}; secure=${secure2}; path=/`; // }; - const navigate = useNav(); + // const navigate = useNav(); const logout = useLogout(); - const [cookie] = useCookies(['loggedin']); + // const [cookie] = useCookies(['loggedin']); const setMessageList = useSetRecoilState(MessageListRecoil); const [{ snowBallData }, setSnowBallBox] = useRecoilState(SnowBallRecoil); @@ -132,7 +133,7 @@ const Main = () => { const messageList = mockData.snowball_data.message_list; setSnowBallBox(prev => ({ ...prev, snowBallData: resSnowballData })); - setMessageList(messageList); + setMessageList(messageList as Message[]); setIsLoading(true); }; diff --git a/front/src/pages/Main/MenuModal.tsx b/front/src/pages/Main/MenuModal.tsx index 7e62f00..f4149f1 100644 --- a/front/src/pages/Main/MenuModal.tsx +++ b/front/src/pages/Main/MenuModal.tsx @@ -1,7 +1,7 @@ import { useRef, useState } from 'react'; import { useRecoilValue } from 'recoil'; import styled from 'styled-components'; -import { useLogout, useNav } from '@hooks'; +import { useNav } from '@hooks'; import { SnowBallRecoil } from '@states'; interface ModalProps { diff --git a/front/src/pages/Make/Snowball/MainDeco/MakeButton.tsx b/front/src/pages/Make/Snowball/MainDeco/MakeButton.tsx index b78e4e3..4976e59 100644 --- a/front/src/pages/Make/Snowball/MainDeco/MakeButton.tsx +++ b/front/src/pages/Make/Snowball/MainDeco/MakeButton.tsx @@ -1,9 +1,10 @@ import { useState } from 'react'; -import { useRecoilValue } from 'recoil'; +// import { useRecoilValue } from 'recoil'; import styled from 'styled-components'; -import { LongButton, axios } from '@utils'; +import { LongButton } from '@utils'; import { useNav } from '@hooks'; -import { MakeDecoRecoil } from '@states'; + +// import { MakeDecoRecoil } from '@states'; interface MakeButtonProps { color: string; @@ -32,32 +33,32 @@ const StyledAlert = styled.div` const MakeButton = (props: ButtonProps) => { const navigate = useNav(); - const { snowballName, mainDecoID, mainColor, bottomID, bottomColor } = - useRecoilValue(MakeDecoRecoil); - const [alert, setAlert] = useState(false); + // const { snowballName, mainDecoID, mainColor, bottomID, bottomColor } = + // useRecoilValue(MakeDecoRecoil); + const [alert] = useState(false); - const ClickedMake = () => { - if (snowballName === '') { - setAlert(true); - return; - } + // const ClickedMake = () => { + // if (snowballName === '') { + // setAlert(true); + // return; + // } - const snowballInfo = { - title: snowballName, - main_decoration_id: mainDecoID, - main_decoration_color: mainColor, - bottom_decoration_id: bottomID, - bottom_decoration_color: bottomColor, - is_message_private: false - }; + // const snowballInfo = { + // title: snowballName, + // main_decoration_id: mainDecoID, + // main_decoration_color: mainColor, + // bottom_decoration_id: bottomID, + // bottom_decoration_color: bottomColor, + // is_message_private: false + // }; - axios - .post('/api/snowball', snowballInfo, { withCredentials: true }) - .catch(() => navigate('/')); + // axios + // .post('/api/snowball', snowballInfo, { withCredentials: true }) + // .catch(() => navigate('/')); - props.view[1](!props.view[0]); - props.visible[1](-1); - }; + // props.view[1](!props.view[0]); + // props.visible[1](-1); + // }; return ( <> diff --git a/front/src/pages/Make/Snowball/Snowball.tsx b/front/src/pages/Make/Snowball/Snowball.tsx index 81261f9..3463636 100644 --- a/front/src/pages/Make/Snowball/Snowball.tsx +++ b/front/src/pages/Make/Snowball/Snowball.tsx @@ -1,9 +1,9 @@ import { useEffect, useState } from 'react'; -import { useCookies } from 'react-cookie'; +// import { useCookies } from 'react-cookie'; import { useRecoilState } from 'recoil'; import styled from 'styled-components'; import { theme } from '@utils'; -import { useLogout, useNav } from '@hooks'; +import { useNav } from '@hooks'; import { SnowBallRecoil } from '@states'; import { Button, SnowGlobeCanvas } from '@components'; import { MainDeco } from './MainDeco'; @@ -63,10 +63,10 @@ const Home = styled.img` const Snowball = () => { const navigate = useNav(); - const logout = useLogout(); + // const logout = useLogout(); const [make, setMake] = useState(false); - const [cookie] = useCookies(['loggedin']); + // const [cookie] = useCookies(['loggedin']); const [{ snowBallData, userData }, setSnowball] = useRecoilState(SnowBallRecoil); diff --git a/front/src/router/Router.tsx b/front/src/router/Router.tsx index 7dc8a9b..dd7d0fc 100644 --- a/front/src/router/Router.tsx +++ b/front/src/router/Router.tsx @@ -3,8 +3,8 @@ import { BrowserRouter, Outlet, Route, Routes } from 'react-router-dom'; import { RecoilRoot } from 'recoil'; const Intro = lazy(() => import('@pages/Intro/Intro')); -const Visit = lazy(() => import('@pages/Visit/Visit')); -const Deco = lazy(() => import('@pages/Visit/Deco/Deco')); +// const Visit = lazy(() => import('@pages/Visit/Visit')); +// const Deco = lazy(() => import('@pages/Visit/Deco/Deco')); const Nickname = lazy(() => import('@pages/Make/Nickname/Nickname')); const Snowball = lazy(() => import('@pages/Make/Snowball/Snowball')); const Main = lazy(() => import('@pages/Main/Main'));