From 9d85a80a74aa29c5d4f6b59a49b40c1e92de8441 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Fri, 13 Oct 2023 21:13:36 +0900 Subject: [PATCH 001/142] =?UTF-8?q?Style:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EB=94=94=EC=9E=90?= =?UTF-8?q?=EC=9D=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/AnnounceCard/index.tsx | 60 +++++++++++++++------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/src/components/Card/AnnounceCard/index.tsx b/src/components/Card/AnnounceCard/index.tsx index 073e9c4e..af7deb46 100644 --- a/src/components/Card/AnnounceCard/index.tsx +++ b/src/components/Card/AnnounceCard/index.tsx @@ -1,6 +1,7 @@ import Icon from '@components/Icon'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; +import useMajor from '@hooks/useMajor'; import { THEME } from '@styles/ThemeProvider/theme'; import { AnnounceItem } from '@type/announcement'; @@ -14,6 +15,8 @@ const AnnounceCard = ({ uploadDate, pinned = false, }: AnnounceCardProps) => { + const { major } = useMajor(); + const onClick = () => { window.open(link, '_blank'); }; @@ -23,17 +26,18 @@ const AnnounceCard = ({ return ( - {pinned && } - {title} - - {uploadDate} + + {pinned && } + {title} + + + + {major} + + {uploadDate} + + ); }; @@ -41,8 +45,8 @@ const AnnounceCard = ({ export default AnnounceCard; const Card = styled.div` - height: 28px; - padding: 10px; + min-height: 28px; + padding: 4px; display: flex; flex-direction: column; justify-content: center; @@ -52,19 +56,18 @@ const Card = styled.div` const ContentContainer = styled.div` display: flex; - align-items: center; + line-height: 1.5; + flex-direction: column; `; const AnnounceTitle = styled.span<{ pinned: boolean }>` + display: flex; + align-items: center; flex: 9; font-size: 15px; font-weight: ${({ pinned }) => (pinned ? 'bold' : 500)}; margin-left: ${({ pinned }) => (pinned ? '' : '28px')}; - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - &: hover { cursor: pointer; } @@ -86,8 +89,29 @@ const AnnounceDate = styled.span` flex: 1; font-size: 10px; font-weight: bold; - text-align: end; white-space: nowrap; color: ${THEME.TEXT.GRAY}; `; + +const Contour = styled.div` + width: 90%; + padding-top: 5px; + margin: 0 auto; + border-bottom: 1px solid ${THEME.BACKGROUND}; +`; + +const FlexWrapper = styled.div` + display: flex; +`; + +const SubTitle = styled.div` + display: flex; + align-items: center; + padding: 5px 0 0 26px; +`; + +const Source = styled.div` + font-size: 11px; + color: gray; +`; From 311b520fb60b3bf85b3072003760faf7e1aecec7 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Sun, 15 Oct 2023 17:26:35 +0900 Subject: [PATCH 002/142] =?UTF-8?q?Design:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EB=A6=AC=EC=8A=A4=ED=8A=B8=20UI=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/AnnounceCard/index.tsx | 37 ++++++++++------------ 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/components/Card/AnnounceCard/index.tsx b/src/components/Card/AnnounceCard/index.tsx index af7deb46..70d7a496 100644 --- a/src/components/Card/AnnounceCard/index.tsx +++ b/src/components/Card/AnnounceCard/index.tsx @@ -1,19 +1,17 @@ -import Icon from '@components/Icon'; -import { css } from '@emotion/react'; import styled from '@emotion/styled'; import useMajor from '@hooks/useMajor'; import { THEME } from '@styles/ThemeProvider/theme'; import { AnnounceItem } from '@type/announcement'; interface AnnounceCardProps extends AnnounceItem { - pinned?: boolean; + Author?: string; } const AnnounceCard = ({ title, link, uploadDate, - pinned = false, + Author, }: AnnounceCardProps) => { const { major } = useMajor(); @@ -27,14 +25,12 @@ const AnnounceCard = ({ - {pinned && } - {title} + {title} + 20{uploadDate} - {major} - - {uploadDate} + {Author ? Author : major} @@ -45,8 +41,7 @@ const AnnounceCard = ({ export default AnnounceCard; const Card = styled.div` - min-height: 28px; - padding: 4px; + min-height: 50px; display: flex; flex-direction: column; justify-content: center; @@ -55,18 +50,19 @@ const Card = styled.div` `; const ContentContainer = styled.div` + padding: 20px 0 20px 0; display: flex; line-height: 1.5; flex-direction: column; `; -const AnnounceTitle = styled.span<{ pinned: boolean }>` +const AnnounceTitle = styled.span` display: flex; align-items: center; flex: 9; - font-size: 15px; - font-weight: ${({ pinned }) => (pinned ? 'bold' : 500)}; - margin-left: ${({ pinned }) => (pinned ? '' : '28px')}; + font-size: 16px; + font-weight: 500; + margin-left: 28px; &: hover { cursor: pointer; @@ -86,17 +82,15 @@ const VertialSeparator = styled.div` `; const AnnounceDate = styled.span` - flex: 1; - font-size: 10px; - font-weight: bold; + font-size: 13px; white-space: nowrap; color: ${THEME.TEXT.GRAY}; + padding-right: 5px; `; const Contour = styled.div` width: 90%; - padding-top: 5px; margin: 0 auto; border-bottom: 1px solid ${THEME.BACKGROUND}; `; @@ -108,10 +102,11 @@ const FlexWrapper = styled.div` const SubTitle = styled.div` display: flex; align-items: center; - padding: 5px 0 0 26px; + padding: 10px 0 0 28px; `; const Source = styled.div` - font-size: 11px; + font-size: 13px; color: gray; + padding-left: 5px; `; From 5f293fc58181a91363929674f3b7feb2bcb10ec0 Mon Sep 17 00:00:00 2001 From: Lee sang Yeop Date: Sun, 15 Oct 2023 17:46:29 +0900 Subject: [PATCH 003/142] =?UTF-8?q?Test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EC=BD=94=EB=93=9C=EC=97=90=20=EC=A0=84=EC=97=AD=20=EC=83=81?= =?UTF-8?q?=ED=83=9C=EA=B0=92=EC=9D=84=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20=EC=9C=84=ED=95=B4=20=ED=94=84=EB=A1=9C=EB=B0=94?= =?UTF-8?q?=EC=9D=B4=EB=8D=94=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/AnnounceCard/index.test.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Card/AnnounceCard/index.test.tsx b/src/components/Card/AnnounceCard/index.test.tsx index 6558704d..02d09044 100644 --- a/src/components/Card/AnnounceCard/index.test.tsx +++ b/src/components/Card/AnnounceCard/index.test.tsx @@ -1,4 +1,5 @@ import http from '@apis/http'; +import MajorProvider from '@components/MajorProvider'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { AnnounceItemList } from '@type/announcement'; @@ -34,7 +35,12 @@ describe('공지사항 카드 컴포넌트 테스트', () => { const { 고정, 일반 } = announceList; 일반.forEach(async (annouce) => { - render(, { wrapper: MemoryRouter }); + render( + + + , + { wrapper: MemoryRouter }, + ); }); const annouceCards = screen.getAllByTestId('card'); From 3bfca87b4898c205257fc6b6474986ad995991a9 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 15:48:56 +0900 Subject: [PATCH 004/142] =?UTF-8?q?Delete:=20=EC=82=AC=EC=9A=A9=ED=95=98?= =?UTF-8?q?=EC=A7=80=20=EC=95=8A=EB=8A=94=20.gitkeep=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/.gitkeep | 0 src/utils/.gitkeep | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/constants/.gitkeep delete mode 100644 src/utils/.gitkeep diff --git a/src/constants/.gitkeep b/src/constants/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/utils/.gitkeep b/src/utils/.gitkeep deleted file mode 100644 index e69de29b..00000000 From 875de9e7de876fe98ceef0265bf9909cc70432eb Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:00:30 +0900 Subject: [PATCH 005/142] =?UTF-8?q?Config:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B4=80=EB=A0=A8=20=ED=83=80=EC=9E=85=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AnnouncementCategory : 'shool', 'major'와 같이 공지사항 분류 타입을 설정 - AnnouncementType : '일반', '고정' 처럼 확인 가능한 공지사항의 분류 타입을 설정 --- src/@types/announcement.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/@types/announcement.ts b/src/@types/announcement.ts index db26c25f..451930ee 100644 --- a/src/@types/announcement.ts +++ b/src/@types/announcement.ts @@ -1,3 +1,8 @@ +import { + ANNOUNCEMENT_CATEGORY, + ANNOUNCEMENT_TYPE, +} from '@constants/announcement'; + type AnnounceItemType = '고정' | '일반'; export interface AnnounceItem { @@ -11,3 +16,9 @@ export interface AnnounceItem { export type AnnounceItemList = { [key in AnnounceItemType]: AnnounceItem[]; }; + +export type AnnouncementCategory = + (typeof ANNOUNCEMENT_CATEGORY)[keyof typeof ANNOUNCEMENT_CATEGORY]; + +export type AnnouncementType = + (typeof ANNOUNCEMENT_TYPE)[keyof typeof ANNOUNCEMENT_TYPE]; From c4b960d3dcff2f68a8ca4c5a5341e5b6fb25742f Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:02:41 +0900 Subject: [PATCH 006/142] =?UTF-8?q?Refactor:=20=EB=A7=81=ED=81=AC=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=ED=95=A8=EC=88=98=20=EB=B3=80=EA=B2=BD,?= =?UTF-8?q?=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 컴포넌트 내부에서 정의한 onClick 메서드 대신, 유틸 함수 openLink 함수 사용 - 경계선을 표현하는 스타일 컴포넌트 이름 변경 -> Vertical, Horizon 으로 종류를 구분 --- src/components/Card/AnnounceCard/index.tsx | 58 ++++++++-------------- 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/src/components/Card/AnnounceCard/index.tsx b/src/components/Card/AnnounceCard/index.tsx index 70d7a496..42346fbd 100644 --- a/src/components/Card/AnnounceCard/index.tsx +++ b/src/components/Card/AnnounceCard/index.tsx @@ -2,38 +2,33 @@ import styled from '@emotion/styled'; import useMajor from '@hooks/useMajor'; import { THEME } from '@styles/ThemeProvider/theme'; import { AnnounceItem } from '@type/announcement'; +import openLink from '@utils/router/openLink'; interface AnnounceCardProps extends AnnounceItem { - Author?: string; + author?: string; } const AnnounceCard = ({ title, link, uploadDate, - Author, + author, }: AnnounceCardProps) => { const { major } = useMajor(); - const onClick = () => { - window.open(link, '_blank'); - }; - uploadDate = uploadDate.slice(2); return ( - + openLink(link)} data-testid="card"> - - {title} - - + {title} + 20{uploadDate} - - {Author ? Author : major} - + + {author ? author : major} + - + ); }; @@ -45,8 +40,13 @@ const Card = styled.div` display: flex; flex-direction: column; justify-content: center; - color: ${THEME.TEXT.BLACK}; + + transition: 0.3s; + &:active { + transform: scale(0.95); + opacity: 0.6; + } `; const ContentContainer = styled.div` @@ -54,6 +54,8 @@ const ContentContainer = styled.div` display: flex; line-height: 1.5; flex-direction: column; + + gap: 10px; `; const AnnounceTitle = styled.span` @@ -62,20 +64,9 @@ const AnnounceTitle = styled.span` flex: 9; font-size: 16px; font-weight: 500; - margin-left: 28px; - - &: hover { - cursor: pointer; - } - - transition: 0.3s; - &:active { - transform: scale(0.95); - opacity: 0.6; - } `; -const VertialSeparator = styled.div` +const VertialBoundaryLine = styled.div` border-left: 1px solid gray; height: 12px; margin: 0 5px; @@ -89,20 +80,13 @@ const AnnounceDate = styled.span` padding-right: 5px; `; -const Contour = styled.div` - width: 90%; - margin: 0 auto; +const HorizonBoundaryLine = styled.div` border-bottom: 1px solid ${THEME.BACKGROUND}; `; -const FlexWrapper = styled.div` - display: flex; -`; - -const SubTitle = styled.div` +const SubContent = styled.div` display: flex; align-items: center; - padding: 10px 0 0 28px; `; const Source = styled.div` From ee30cb0ad40fcd4118175c1f1027124840f9ec7f Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:07:36 +0900 Subject: [PATCH 007/142] =?UTF-8?q?Refactor:=20url=EC=97=90=20=EB=94=B0?= =?UTF-8?q?=EB=9D=BC=20=EB=8B=A4=EB=A5=B8=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=EC=9D=84=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prop으로 받는 type은 normal, pinned, search 셋 중 하나이며 type에 따라 다른 데이터를 사용해 렌더링 하도록 함 - search 같은 경우는 검색, 검색 결과를 확인, 검색 결과를 렌더링등 로직이 많기 때문에 AnnounceSearchList 컴포넌트를 추가로 구현 --- .../Card/AnnounceCard/AnnounceList/index.tsx | 49 +++++++++++++------ 1 file changed, 34 insertions(+), 15 deletions(-) diff --git a/src/components/Card/AnnounceCard/AnnounceList/index.tsx b/src/components/Card/AnnounceCard/AnnounceList/index.tsx index d6f28700..ffdb7032 100644 --- a/src/components/Card/AnnounceCard/AnnounceList/index.tsx +++ b/src/components/Card/AnnounceCard/AnnounceList/index.tsx @@ -1,5 +1,10 @@ -import { AnnounceItemList } from '@type/announcement'; +import { ANNOUNCEMENT_TYPE } from '@constants/announcement'; +import styled from '@emotion/styled'; +import { AnnounceSearchList } from '@pages/Announcement/components'; +import { THEME } from '@styles/ThemeProvider/theme'; +import { AnnounceItemList, AnnouncementType } from '@type/announcement'; import { AxiosError, AxiosResponse } from 'axios'; +import { Fragment } from 'react'; import AnnounceCard from '..'; @@ -13,30 +18,44 @@ interface AnnounceListProps { resource: { read: () => Resource; }; + type: AnnouncementType; } -const AnnounceList = ({ resource }: AnnounceListProps) => { +const AnnounceList = ({ resource, type }: AnnounceListProps) => { const announceList: Resource = resource.read(); - if (announceList === null || announceList instanceof Error) { - return null; + return <>; } - const { 고정: pinned, 일반: normal } = announceList as AnnounceItemList; + + const { 고정: pinnedAnnouncement, 일반: normalAnnouncemnet } = + announceList as AnnounceItemList; return ( <> - {pinned.map((announce, idx) => ( -
- -
- ))} - {normal.map((announce, idx) => ( -
- -
- ))} + + {type === ANNOUNCEMENT_TYPE.NORMAL && + normalAnnouncemnet.map((announce, idx) => ( + + + + ))} + {type === ANNOUNCEMENT_TYPE.PINNED && + pinnedAnnouncement.map((announce, idx) => ( + + + + ))} + {type === ANNOUNCEMENT_TYPE.SEARCH && ( + + )} ); }; export default AnnounceList; + +const BoundaryLine = styled.div` + border-bottom: 1px solid ${THEME.TEXT.BLACK}; +`; From c4d5a2a99415545705ae6b85294e927c90d11415 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:08:06 +0900 Subject: [PATCH 008/142] =?UTF-8?q?Test:=20=EB=AA=A8=ED=82=B9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20useMajor=20=ED=9B=85=EC=97=90=20graduationLink=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/InformCard/index.test.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Card/InformCard/index.test.tsx b/src/components/Card/InformCard/index.test.tsx index 0eda9a28..a32daa6b 100644 --- a/src/components/Card/InformCard/index.test.tsx +++ b/src/components/Card/InformCard/index.test.tsx @@ -43,12 +43,13 @@ const setMajorMock = (isRender: boolean) => { jest.mock('react', () => ({ ...jest.requireActual('react'), - useState: () => [mockMajor, mockSetMajor], + useState: () => [mockMajor, mockSetMajor, graduationLink], })); return { major: mockMajor, setMajor: mockSetMajor, + graduationLink, }; }; From dc2f6aeaa8f5280262dda089d22020b967704c7c Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:08:41 +0900 Subject: [PATCH 009/142] =?UTF-8?q?Style:=20InformCard=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EC=8A=A4=ED=83=80=EC=9D=BC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/InformCard/index.tsx | 93 +++++++++--------------- 1 file changed, 36 insertions(+), 57 deletions(-) diff --git a/src/components/Card/InformCard/index.tsx b/src/components/Card/InformCard/index.tsx index 3261abaa..5d3e688f 100644 --- a/src/components/Card/InformCard/index.tsx +++ b/src/components/Card/InformCard/index.tsx @@ -23,9 +23,10 @@ const InformCard = ({ }: InformCardProps) => { const { major } = useMajor(); const { routerTo } = useRouter(); - const routerToMajorDecision = () => routerTo('/major-decision'); const { openModal, closeModal } = useModals(); + const routeToMajorDecisionPage = () => routerTo('/major-decision'); + const handleMajorModal = () => { if (!majorRequired || major) { onClick(); @@ -38,7 +39,7 @@ const InformCard = ({ onClose: () => closeModal(modals.alert), routerTo: () => { closeModal(modals.alert); - routerToMajorDecision(); + routeToMajorDecisionPage(); }, }); }; @@ -46,40 +47,13 @@ const InformCard = ({ return ( <> - -
- -
-
- - - {title} - - - {title} 보러가기 - - + + + + + {title} + {title} 보러가기 +
); @@ -89,33 +63,38 @@ export default InformCard; const Card = styled.div` display: flex; - flex-direction: row; + align-items: center; padding: 3% 1% 2% 0; - color: ${THEME.TEXT.GRAY}; - height: 70px; - - & > svg { - margin: 10px 0; - } - cursor: pointer; + height: 4rem; transition: all 0.2s ease-in-out; - &:active { - transform: scale(0.95); - opacity: 0.6; + span:nth-of-type(1) { + font-size: 12px; + color: ${THEME.TEXT.GRAY}; } -`; -const Wrapper = styled.div` - &:first-of-type { - display: flex; - align-items: center; + span:nth-of-type(2) { + font-size: 16px; + font-weight: bold; + color: ${THEME.TEXT.BLACK}; } +`; - &:nth-of-type(2) { - display: flex; - flex-direction: column; - padding: 4% 0 3% 3%; - } +const TextContainer = styled.div` + display: flex; + flex-direction: column; + gap: 5px; +`; + +const IconContainer = styled.div` + height: 45px; + width: 45px; + display: flex; + justify-content: center; + align-items: center; + margin-right: 10px; + + border-radius: 50%; + background-color: ${THEME.PRIMARY}; `; From 90fbb379b838001f8b9fcacdac546b246d13e1a6 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:09:15 +0900 Subject: [PATCH 010/142] =?UTF-8?q?Chore:=20css=20selector=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=9D=84=EC=96=B4=EC=93=B0=EA=B8=B0=EB=A1=9C=20?= =?UTF-8?q?=EC=9D=B8=ED=95=9C=20=EB=A6=B0=ED=8A=B8=20=EC=97=90=EB=9F=AC?= =?UTF-8?q?=EB=A5=BC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Carousel/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Carousel/index.tsx b/src/components/Carousel/index.tsx index 58336a48..9ae046b2 100644 --- a/src/components/Carousel/index.tsx +++ b/src/components/Carousel/index.tsx @@ -67,7 +67,7 @@ const CarouselContainer = styled.div` padding: 1rem 0 1rem; width: 100%; margin: 0 auto; - &: hover { + &:hover { cursor: pointer; } `; @@ -100,7 +100,7 @@ const Button = styled.button` border-radius: 0.5rem; margin-top: 1rem; - &: hover { + &:hover { cursor: pointer; } `; From 9864252f88dc1f967cc98d7a109037c8a97f69cd Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:09:32 +0900 Subject: [PATCH 011/142] =?UTF-8?q?Test:=20=EB=AA=A8=ED=82=B9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20useMajor=20=ED=9B=85=EC=97=90=20graduationLink=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/List/DepartmentList/index.test.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/List/DepartmentList/index.test.tsx b/src/components/List/DepartmentList/index.test.tsx index dadb8d8b..6a231171 100644 --- a/src/components/List/DepartmentList/index.test.tsx +++ b/src/components/List/DepartmentList/index.test.tsx @@ -31,6 +31,7 @@ jest.mock('@hooks/useModals', () => { }); describe.skip('학과선택 테스트', () => { + const mockGraduationLink = 'https://ce.pknu.ac.kr/ce/2889'; const mockUseMajor = useMajor as jest.MockedFunction; const mockSetMajor = jest.fn(); @@ -38,6 +39,7 @@ describe.skip('학과선택 테스트', () => { mockUseMajor.mockReturnValue({ setMajor: mockSetMajor, major: '컴퓨터공학과', + graduationLink: mockGraduationLink, }); }); From fc159c66150017f733af621be07f55660e682c6c Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:11:36 +0900 Subject: [PATCH 012/142] =?UTF-8?q?Refactor:=20MajorProvider=EA=B0=80=20gr?= =?UTF-8?q?aduationLink=EB=8F=84=20=EC=B1=85=EC=9E=84=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 전공 컨텍스트에서 전공과 관련되어 있는 졸업요건 링크도 책임을 져야 한다고 판단 --- src/components/MajorProvider/index.tsx | 33 +++++++++++++++----------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/src/components/MajorProvider/index.tsx b/src/components/MajorProvider/index.tsx index 7bc2feaf..b60ac618 100644 --- a/src/components/MajorProvider/index.tsx +++ b/src/components/MajorProvider/index.tsx @@ -1,36 +1,41 @@ +import http from '@apis/http'; import MajorContext from '@contexts/major'; +import { AxiosResponse } from 'axios'; import React, { useEffect, useState } from 'react'; +interface GraduationLink { + department: string; + link: string | null; +} + interface MajorProviderProps { children: React.ReactNode; } const MajorProvider = ({ children }: MajorProviderProps) => { const [major, setMajor] = useState(null); + const [graduationLink, setGraduationLink] = useState(''); useEffect(() => { const storedMajor = localStorage.getItem('major'); - if (!storedMajor) return; setMajor(storedMajor); }, []); useEffect(() => { - const handleStorageChange = (event: StorageEvent) => { - if (event.key === 'major') { - const storedMajor = event.newValue; - if (storedMajor !== null) setMajor(storedMajor); - } - }; - window.addEventListener('storage', handleStorageChange); - - return () => { - window.removeEventListener('storage', handleStorageChange); - }; - }, []); + if (!major) return; + + (async () => { + const response: AxiosResponse = await http.get( + `/api/graduation?major=${major}`, + ); + const graduationLink = response.data.link; + setGraduationLink(graduationLink); + })(); + }, [major]); return ( - + {children} ); From fc8d60791c9867253535a1c262965b65b066880e Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:12:02 +0900 Subject: [PATCH 013/142] =?UTF-8?q?Style:=20ConfirmModal=20=EB=84=A4,=20?= =?UTF-8?q?=EC=95=84=EB=8B=88=EC=98=A4=20=EC=9C=84=EC=B9=98=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Modal/ConfirmModal/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Modal/ConfirmModal/index.tsx b/src/components/Modal/ConfirmModal/index.tsx index 161f3536..d0016eb3 100644 --- a/src/components/Modal/ConfirmModal/index.tsx +++ b/src/components/Modal/ConfirmModal/index.tsx @@ -41,8 +41,8 @@ const ConfirmModal = ({ justify-content: center; `} > - + From 0737cb073b3f323ab5f4bc037700379e46db54aa Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:13:29 +0900 Subject: [PATCH 014/142] =?UTF-8?q?Config:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B4=80=EB=A0=A8=20=EC=83=81=EC=88=98=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TITLE: 공지사항 제목 - CATEGORY: 공지사항 분류, 어학 취업정보가 추가될 경우 여기에 추가할 수 있도록 함 - TYPE: API를 통해 가져온 공지사항을 분류 --- src/constants/announcement.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/constants/announcement.ts diff --git a/src/constants/announcement.ts b/src/constants/announcement.ts new file mode 100644 index 00000000..0b8e547a --- /dev/null +++ b/src/constants/announcement.ts @@ -0,0 +1,15 @@ +export const ANNOUNCEMENT_TITLE = { + SCHOOL: '학교 공지사항', + MAROR: '학과 공지사항', +}; + +export const ANNOUNCEMENT_CATEGORY = { + SCHOOL: 'school', + MAJOR: 'major', +} as const; + +export const ANNOUNCEMENT_TYPE = { + NORMAL: 'normal', + PINNED: 'pinned', + SEARCH: 'search', +} as const; From 8a2739e2076957736b60025d4d2a7e39910ca21b Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:14:23 +0900 Subject: [PATCH 015/142] =?UTF-8?q?Config:=20=EA=B2=BD=EB=A1=9C=EB=93=A4?= =?UTF-8?q?=EC=9D=84=20=EC=83=81=EC=88=98=EB=A1=9C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 아직 상수로 빼지 못한 path들은 이 후 작업에서 빼도록 함 --- src/constants/path.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/constants/path.ts diff --git a/src/constants/path.ts b/src/constants/path.ts new file mode 100644 index 00000000..45e2d1e6 --- /dev/null +++ b/src/constants/path.ts @@ -0,0 +1,14 @@ +type Category = 'school' | 'major'; + +const PATH = { + SCHOOL_ANNOUNCEMENT: '/school/:type', + MAJOR_ANNOUNCEMENT: '/major/:type', + NORMAL_ANNOUNCEMENT: (category: Category) => + `/announcement/${category}/normal`, + PINNED_ANNOUNCEMENT: (category: Category) => + `/announcement/${category}/pinned`, + SEARCH_ANNOUNCEMENT: (category: Category, keyword: string) => + `/announcement/${category}/search?q=${keyword}`, +} as const; + +export default PATH; From 5b987fe12d19cdc7aa6a247114fe3ae76e3f03c0 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:14:45 +0900 Subject: [PATCH 016/142] =?UTF-8?q?Chore:=20placeholder=EC=97=90=20?= =?UTF-8?q?=EA=B3=B5=EC=A7=80=EC=82=AC=ED=95=AD=20=EA=B2=80=EC=83=89=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/placeholder-message.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/placeholder-message.ts b/src/constants/placeholder-message.ts index 3ad0c513..553ee67a 100644 --- a/src/constants/placeholder-message.ts +++ b/src/constants/placeholder-message.ts @@ -1,6 +1,7 @@ const PLCACEHOLDER_MESSAGES = { SUGGESTION: '건의사항을 5글자 이상 남겨주세요', SEARCH_BUILDING: '건물번호 또는 건물이름을 검색해주세요', + SEARCH_TITLE: '제목을 검색하세요', } as const; export default PLCACEHOLDER_MESSAGES; From ac95f84b4640d225ba1868b7d9c98c94628ecb03 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:15:05 +0900 Subject: [PATCH 017/142] =?UTF-8?q?Chore:=20=ED=86=A0=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EB=A9=94=EC=84=B8=EC=A7=80=EC=97=90=20=EA=B3=B5=EC=A7=80?= =?UTF-8?q?=EC=82=AC=ED=95=AD=20=EA=B2=80=EC=83=89=20=ED=82=A4=EC=9B=8C?= =?UTF-8?q?=EB=93=9C=EA=B0=80=20=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0?= =?UTF-8?q?=EC=9D=98=20=EB=A9=94=EC=84=B8=EC=A7=80=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/constants/toast-message.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/constants/toast-message.ts b/src/constants/toast-message.ts index bef46bad..08f04ef3 100644 --- a/src/constants/toast-message.ts +++ b/src/constants/toast-message.ts @@ -1,7 +1,8 @@ const TOAST_MESSAGES = { OUT_OF_BOUNDARY: '학교 외부로 이동할 수 없어요!', OUT_OF_SHOOL: '학교 밖에서는 내 위치 정보를 제공하지 않아요!', - SHARE_LOCATION: '위치 정보를 공유해 주세요.', + SHARE_LOCATION: '위치 정보를 공유해 주세요', + SEARCH_KEYWORD: '검색어를 입력해주세요', } as const; export default TOAST_MESSAGES; From 394655b5278c1fa5439bcc23c52f6a1b060f7177 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:15:39 +0900 Subject: [PATCH 018/142] =?UTF-8?q?Refactor:=20MajorContext=EC=97=90=20gra?= =?UTF-8?q?duationLink=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/contexts/major.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/contexts/major.ts b/src/contexts/major.ts index 750de426..4cf8a5be 100644 --- a/src/contexts/major.ts +++ b/src/contexts/major.ts @@ -4,6 +4,7 @@ import { createContext } from 'react'; interface MajorState { major: Major; setMajor: React.Dispatch>; + graduationLink: string | null; } const MajorContext = createContext(null); From c4ee69502f7c9dfbb62af49913d6c171714421e7 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:18:03 +0900 Subject: [PATCH 019/142] =?UTF-8?q?Refactor:=20Announcement=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=8A=94=20=EB=9D=BC=EC=9A=B0?= =?UTF-8?q?=ED=8C=85=20=EC=B1=85=EC=9E=84=EB=A7=8C=20=EC=A7=80=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - announcement// 에 따라서 컴포넌트를 렌더링 하도록 함 --- src/pages/Announcement/index.tsx | 155 ++++++------------------------- 1 file changed, 30 insertions(+), 125 deletions(-) diff --git a/src/pages/Announcement/index.tsx b/src/pages/Announcement/index.tsx index 69c17be7..4044c138 100644 --- a/src/pages/Announcement/index.tsx +++ b/src/pages/Announcement/index.tsx @@ -1,136 +1,41 @@ -import fetchAnnounceList from '@apis/Suspense/fetch-announce-list'; -import Button from '@components/Button'; -import AnnounceList from '@components/Card/AnnounceCard/AnnounceList'; -import AnnounceCardSkeleton from '@components/Card/AnnounceCard/Skeleton'; -import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; -import { css, keyframes } from '@emotion/react'; -import styled from '@emotion/styled'; +import { + ANNOUNCEMENT_CATEGORY, + ANNOUNCEMENT_TITLE, +} from '@constants/announcement'; +import PATH from '@constants/path'; import useMajor from '@hooks/useMajor'; -import useModals, { modals } from '@hooks/useModals'; -import useRouter from '@hooks/useRouter'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { Suspense } from 'react'; +import React from 'react'; +import { Route, Routes } from 'react-router-dom'; + +import { AnnounceContainer } from './components'; const Announcement = () => { const { major } = useMajor(); - const { routerTo } = useRouter(); - const { openModal, closeModal } = useModals(); - - const announceKeyword = decodeURI(window.location.pathname.split('/')[2]); - const isActiveSchoolAnnouncement = () => announceKeyword === 'undefined'; - - const routerToMajorDecision = () => routerTo('/major-decision'); - const routerToSchoolAnnouncement = () => routerTo(''); - const routerToMajorAnnouncement = () => { - if (!major) { - openModal(modals.alert, { - message: MODAL_MESSAGE.ALERT.SET_MAJOR, - buttonMessage: MODAL_BUTTON_MESSAGE.SET_MAJOR, - iconKind: 'plus', - onClose: () => closeModal(modals.alert), - routerTo: () => { - closeModal(modals.alert); - routerToMajorDecision(); - }, - }); - } - routerTo(`${major}`); - }; return ( - - - - - - - - }> - + - - - + } + /> + + } + /> + ); }; export default Announcement; - -const Container = styled.div` - overflow-x: hidden; -`; - -const ButtonContainer = styled.div` - width: 100%; - display: flex; - position: relative; - overflow-x: none; -`; - -const ButtonBottomBar = styled.span<{ isActiveSchool: boolean }>` - &:before { - content: ''; - position: absolute; - bottom: 0; - left: ${({ isActiveSchool }) => (isActiveSchool ? '0' : '50%')}; - width: 50%; - height: 3px; - background-color: ${THEME.PRIMARY}; - transition: left 0.3s ease-in-out; - } -`; - -const AnnounceContainer = styled.div<{ isActiveSchool: boolean }>` - width: 100%; - overflow: hidden; - animation: ${({ isActiveSchool }) => - isActiveSchool ? AnnounceSlideLeft : AnnounceSlideRight} - 0.3s forwards; -`; - -const AnnounceSlideRight = keyframes` - from { - transform: translateX(-100%); - } - to { - transform: translateX(0%); - } -`; - -const AnnounceSlideLeft = keyframes` - from { - transform: translateX(100%); - } - to { - transform: translateX(0%); - } -`; From d774d20fad9e9357ed6a7549ac3285b469fb5a7f Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:21:40 +0900 Subject: [PATCH 020/142] =?UTF-8?q?Feat:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=ED=8E=98=EC=9D=B4=EC=A7=80=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=ED=84=B4=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - title : 공지사항 제목을 표현 ex) 학교 공지사항 - category : 공지사항 분류를 표현 ex) announcement/school -> 학교 공지사항 - endPoint : 공지사항을 가져오기 위한 api endPoint를 표현 - 이 3가지 props만 전달하면 검색, 일반 & 공지 필터링, 공지사항 리스트 렌더링을 책임지는 컴포넌트를 렌더링 할 수 있음 --- .../components/AnnounceContainer.tsx | 120 ++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 src/pages/Announcement/components/AnnounceContainer.tsx diff --git a/src/pages/Announcement/components/AnnounceContainer.tsx b/src/pages/Announcement/components/AnnounceContainer.tsx new file mode 100644 index 00000000..dd8bedce --- /dev/null +++ b/src/pages/Announcement/components/AnnounceContainer.tsx @@ -0,0 +1,120 @@ +import fetchAnnounceList from '@apis/Suspense/fetch-announce-list'; +import AnnounceList from '@components/Card/AnnounceCard/AnnounceList'; +import AnnounceCardSkeleton from '@components/Card/AnnounceCard/Skeleton'; +import { ANNOUNCEMENT_TYPE } from '@constants/announcement'; +import PATH from '@constants/path'; +import { keyframes } from '@emotion/react'; +import styled from '@emotion/styled'; +import useRouter from '@hooks/useRouter'; +import { + AnnounceItemList, + AnnouncementCategory, + AnnouncementType, +} from '@type/announcement'; +import React, { Suspense, useMemo } from 'react'; +import { useParams } from 'react-router-dom'; + +import AnnounceSearch from './AnnounceSearch'; +import AnnounceTypeButtons from './AnnounceTypeButtons'; + +interface AnnounceContainerProps { + title: string; + category: AnnouncementCategory; + endPoint: string | null; +} + +const AnnounceContainer = ({ + title, + category, + endPoint, +}: AnnounceContainerProps) => { + const { type } = useParams(); + if (!type) return <>; + + const { routerTo } = useRouter(); + + const showNormalAnnouncement = () => + routerTo(PATH.NORMAL_ANNOUNCEMENT(category)); + const showPinnedAnnouncement = () => + routerTo(PATH.PINNED_ANNOUNCEMENT(category)); + + const resource = useMemo( + () => fetchAnnounceList(endPoint), + [], + ); + + return ( + + {title} + + + + + + + }> + + + + + ); +}; + +export default AnnounceContainer; + +const Container = styled.div` + overflow-x: hidden; + display: flex; + flex-direction: column; + + row-gap: 15px; + padding: 10px; +`; + +const AnnounceTitle = styled.span` + margin-top: 1rem; + font-size: 1.5rem; + font-weight: bold; +`; + +const ButtonContainer = styled.div` + display: flex; + column-gap: 10px; +`; + +const getAnimationType = (type: AnnouncementType) => { + if (type === 'search') return 'none'; + return type === 'normal' ? AnnounceSlideLeft : AnnounceSlideRight; +}; + +const AnnounceListContainer = styled.div<{ type: AnnouncementType }>` + width: 100%; + overflow: hidden; + animation: ${({ type }) => getAnimationType(type)} 0.3s forwards; +`; + +const AnnounceSlideRight = keyframes` + from { + transform: translateX(-100%); + } + to { + transform: translateX(0%); + } +`; + +const AnnounceSlideLeft = keyframes` + from { + transform: translateX(100%); + } + to { + transform: translateX(0%); + } +`; From 2611491bd5822c439e427da0aefd1831d3de8762 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:21:59 +0900 Subject: [PATCH 021/142] =?UTF-8?q?Feat:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B2=80=EC=83=89=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AnnounceSearch.tsx | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 src/pages/Announcement/components/AnnounceSearch.tsx diff --git a/src/pages/Announcement/components/AnnounceSearch.tsx b/src/pages/Announcement/components/AnnounceSearch.tsx new file mode 100644 index 00000000..79cca090 --- /dev/null +++ b/src/pages/Announcement/components/AnnounceSearch.tsx @@ -0,0 +1,86 @@ +import Icon from '@components/Icon'; +import PATH from '@constants/path'; +import PLCACEHOLDER_MESSAGES from '@constants/placeholder-message'; +import TOAST_MESSAGES from '@constants/toast-message'; +import styled from '@emotion/styled'; +import useRouter from '@hooks/useRouter'; +import useToasts from '@hooks/useToast'; +import React, { useRef } from 'react'; + +interface AnnounceSearchProps { + category: 'school' | 'major'; +} + +const AnnounceSearch = ({ category }: AnnounceSearchProps) => { + const { routerTo } = useRouter(); + const { addToast } = useToasts(); + + const inputRef = useRef(null); + + const handleSubmit = (e: React.FormEvent) => { + if (!inputRef.current) return; + e.preventDefault(); + if (inputRef.current.value.length === 0) { + addToast(TOAST_MESSAGES.SEARCH_KEYWORD); + return; + } + + routerTo(PATH.SEARCH_ANNOUNCEMENT(category, inputRef.current.value)); + inputRef.current.value = ''; + inputRef.current.blur(); + }; + + return ( +
+ + + handleSubmit}> + + + +
+ ); +}; + +export default AnnounceSearch; + +const StyledForm = styled.form` + display: flex; + position: relative; +`; + +const StyledInput = styled.input` + -webkit-appearance: none; + appearance: none; + + width: 100%; + padding: 10px; + border: 0; + border-radius: 15px; + background-color: #7a9dd30f; + color: #7a9dd366; + font-size: 14px; + text-indent: 5px; + + &::placeholder { + color: #7a9dd366; + font-size: 14px; + } + box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.15); + &:focus { + outline: none; + box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.2); + } +`; + +const StyledIconWrapper = styled.button` + position: absolute; + right: 0.5rem; + top: 50%; + transform: translateY(-50%); + background-color: transparent; +`; From f95add6b9e5c9c93c93f6c2e0f7ae830b00b4b75 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:22:19 +0900 Subject: [PATCH 022/142] =?UTF-8?q?Feat:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B2=80=EC=83=89=20=EA=B2=B0=EA=B3=BC=20=EB=A0=8C?= =?UTF-8?q?=EB=8D=94=EB=A7=81=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AnnounceSearchList.tsx | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/pages/Announcement/components/AnnounceSearchList.tsx diff --git a/src/pages/Announcement/components/AnnounceSearchList.tsx b/src/pages/Announcement/components/AnnounceSearchList.tsx new file mode 100644 index 00000000..26089384 --- /dev/null +++ b/src/pages/Announcement/components/AnnounceSearchList.tsx @@ -0,0 +1,55 @@ +import AnnounceCard from '@components/Card/AnnounceCard'; +import Icon from '@components/Icon'; +import styled from '@emotion/styled'; +import { THEME } from '@styles/ThemeProvider/theme'; +import { AnnounceItem } from '@type/announcement'; +import React, { Fragment } from 'react'; +import { useLocation } from 'react-router-dom'; + +interface AnnounceSearchProps { + announceList: AnnounceItem[]; +} + +const AnnounceSearchList = ({ announceList }: AnnounceSearchProps) => { + const { search } = useLocation(); + + const searchKeyword = decodeURI(search.split('=')[1]); + const searchResult = announceList.filter((announceItem) => + announceItem.title.includes(searchKeyword), + ); + const hasSearchResult = () => searchResult.length === 0; + + return ( + + {hasSearchResult() ? ( + searchResult.map((announce, idx) => ( + + + + )) + ) : ( + + + + {`"${searchKeyword}"`}에 관한 공지사항이 없습니다. + + + )} + + ); +}; + +export default AnnounceSearchList; + +const AnnounceNotFound = styled.div` + height: 20rem; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 10px; +`; + +const NotFoundTitle = styled.span` + color: ${THEME.TEXT.GRAY}; +`; From adb21aef7b305c03753eac6f7c17d26524f21cb5 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:22:55 +0900 Subject: [PATCH 023/142] =?UTF-8?q?Feat:=20=EA=B3=B5=EC=A7=80=20&=20?= =?UTF-8?q?=EC=9D=BC=EB=B0=98=20=EA=B5=AC=EB=B6=84=20=EB=B2=84=ED=8A=BC=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AnnounceTypeButtons.tsx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/pages/Announcement/components/AnnounceTypeButtons.tsx diff --git a/src/pages/Announcement/components/AnnounceTypeButtons.tsx b/src/pages/Announcement/components/AnnounceTypeButtons.tsx new file mode 100644 index 00000000..1b309767 --- /dev/null +++ b/src/pages/Announcement/components/AnnounceTypeButtons.tsx @@ -0,0 +1,35 @@ +import Button from '@components/Button'; +import { css } from '@emotion/react'; +import { THEME } from '@styles/ThemeProvider/theme'; +import React from 'react'; + +interface AnnounceTypeButtonsProps { + type: '일반' | '고정'; + isActive: boolean; + onClick: () => void; +} + +const AnnounceTypeButtons = ({ + type, + isActive, + onClick, +}: AnnounceTypeButtonsProps) => { + return ( + + ); +}; + +export default AnnounceTypeButtons; From 6d33105a82fcfd55157ff3c36b77b1cfc7e1367a Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:23:17 +0900 Subject: [PATCH 024/142] =?UTF-8?q?Chore:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A5=BC=20=EA=B5=AC?= =?UTF-8?q?=EC=84=B1=ED=95=98=EB=8A=94=20=EC=BB=B4=ED=8F=AC=EB=84=8C?= =?UTF-8?q?=ED=8A=B8=20=ED=95=9C=EB=B2=88=EC=97=90=20export?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Announcement/components/index.ts | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 src/pages/Announcement/components/index.ts diff --git a/src/pages/Announcement/components/index.ts b/src/pages/Announcement/components/index.ts new file mode 100644 index 00000000..2bce755e --- /dev/null +++ b/src/pages/Announcement/components/index.ts @@ -0,0 +1,4 @@ +export { default as AnnounceContainer } from './AnnounceContainer'; +export { default as AnnounceSearch } from './AnnounceSearch'; +export { default as AnnounceSearchList } from './AnnounceSearchList'; +export { default as AnnounceTypeButtons } from './AnnounceTypeButtons'; From a4ef78999c1f9d08b17bf1ea2aa130f8f59faac2 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:23:41 +0900 Subject: [PATCH 025/142] =?UTF-8?q?Test:=20=ED=99=88=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=20=EB=A0=8C=EB=8D=94=EB=A7=81=20=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/Home.test.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/Home/Home.test.tsx b/src/pages/Home/Home.test.tsx index 4a962a09..1cc65f48 100644 --- a/src/pages/Home/Home.test.tsx +++ b/src/pages/Home/Home.test.tsx @@ -6,7 +6,7 @@ import '@testing-library/jest-dom'; import Home from './index'; -describe('App 컴포넌트 테스트', () => { +describe('Home Page 컴포넌트 테스트', () => { it('페이지에 공지사항 및 졸업요건 컴포넌트가 렌더링된다.', () => { render( @@ -18,7 +18,7 @@ describe('App 컴포넌트 테스트', () => { wrapper: MemoryRouter, }, ); - const notificationText = screen.getByText('공지사항'); + const notificationText = screen.getByText('학교 공지사항'); expect(notificationText).toBeInTheDocument(); const requirementText = screen.getByText('졸업요건'); From bec98e356e879c63bed5c542fa06eea64a5f3643 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:25:38 +0900 Subject: [PATCH 026/142] =?UTF-8?q?Refactor:=20=ED=99=88=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EA=B5=AC?= =?UTF-8?q?=EC=84=B1=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - InformCardList: 공지사항 관련 카드 컴포넌트를 추상화 - 홈페이지 컴포넌트에서 담당하던 graduationLink의 상태 관리를 MajorPovider로 이전 --- src/pages/Home/index.tsx | 45 +++------------------------------------- 1 file changed, 3 insertions(+), 42 deletions(-) diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index e4eff870..5bbe61b6 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -1,49 +1,15 @@ -import http from '@apis/http'; -import InformCard from '@components/Card/InformCard'; import Carousel from '@components/Carousel'; import styled from '@emotion/styled'; -import useMajor from '@hooks/useMajor'; -import useRouter from '@hooks/useRouter'; import { THEME } from '@styles/ThemeProvider/theme'; -import { AxiosResponse } from 'axios'; -import { useEffect, useState } from 'react'; -const Home = () => { - const [graduationLink, setGraduationLink] = useState(''); - const { routerTo } = useRouter(); - const { major } = useMajor(); - - const routerToGraduationRequiredPage = (graduationLink: string | null) => { - graduationLink && window.open(graduationLink, '_blank'); - }; - - useEffect(() => { - if (!major) return; - const getGraduationLink = async () => { - const response: AxiosResponse = await http.get( - `/api/graduation?major=${major}`, - ); - setGraduationLink(response.data.link); - }; - getGraduationLink(); - }, [major]); +import InformCardList from './components/InformCardList'; +const Home = () => { return ( 학교 - routerTo('/announcement')} - /> - routerToGraduationRequiredPage(graduationLink)} - /> + 비교과 @@ -76,8 +42,3 @@ const InformTitle = styled.div` font-size: 20px; font-weight: bold; `; - -interface GraduationLink { - department: string; - link: string | null; -} From b26cbc157908d70c65958a7effa0ad704cf4c84f Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:26:01 +0900 Subject: [PATCH 027/142] =?UTF-8?q?Feat:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B4=80=EB=A0=A8=20=EC=B9=B4=EB=93=9C=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EB=AC=B6=EC=9D=80=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/Home/components/InformCardList.tsx | 37 ++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/pages/Home/components/InformCardList.tsx diff --git a/src/pages/Home/components/InformCardList.tsx b/src/pages/Home/components/InformCardList.tsx new file mode 100644 index 00000000..e7102cba --- /dev/null +++ b/src/pages/Home/components/InformCardList.tsx @@ -0,0 +1,37 @@ +import InformCard from '@components/Card/InformCard'; +import { ANNOUNCEMENT_TITLE } from '@constants/announcement'; +import PATH from '@constants/path'; +import useMajor from '@hooks/useMajor'; +import useRouter from '@hooks/useRouter'; +import openLink from '@utils/router/openLink'; +import React from 'react'; + +const InformCardList = () => { + const { graduationLink } = useMajor(); + const { routerTo } = useRouter(); + + return ( + <> + routerTo(PATH.NORMAL_ANNOUNCEMENT('school'))} + /> + routerTo(PATH.NORMAL_ANNOUNCEMENT('major'))} + /> + openLink(graduationLink)} + /> + + ); +}; + +export default InformCardList; From dc62ac5b4f9ee1e697991b91583dab79685d25d9 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:26:16 +0900 Subject: [PATCH 028/142] =?UTF-8?q?Test:=20=EB=AA=A8=ED=82=B9=ED=95=98?= =?UTF-8?q?=EB=8A=94=20useMajor=20=ED=9B=85=EC=97=90=20graduationLink=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/MajorDecision/index.test.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/MajorDecision/index.test.tsx b/src/pages/MajorDecision/index.test.tsx index 9793ddf2..301c8177 100644 --- a/src/pages/MajorDecision/index.test.tsx +++ b/src/pages/MajorDecision/index.test.tsx @@ -15,7 +15,9 @@ jest.mock('react-router-dom', () => ({ })); describe.skip('학과선택 페이지 로직 테스트', () => { + const mockGraduationLink = 'https://ce.pknu.ac.kr/ce/2889'; const mockSetMajor = jest.fn(); + beforeEach(() => { jest.mock('react', () => ({ ...jest.requireActual('react'), @@ -30,7 +32,13 @@ describe.skip('학과선택 페이지 로직 테스트', () => { it('전공 선택 버튼 클릭 후, 상태 변경 테스트', async () => { render( - + , From af319f7d9b9900fcfe5e0a739b6590d6fcf233ca Mon Sep 17 00:00:00 2001 From: hwinkr Date: Sat, 4 Nov 2023 16:26:31 +0900 Subject: [PATCH 029/142] =?UTF-8?q?Feat:=20=EB=A7=81=ED=81=AC=EB=A5=BC=20?= =?UTF-8?q?=EC=9D=B4=EB=8F=99=20=EC=8B=9C=ED=82=A4=EB=8A=94=20=EC=9C=A0?= =?UTF-8?q?=ED=8B=B8=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/router/openLink.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/utils/router/openLink.ts diff --git a/src/utils/router/openLink.ts b/src/utils/router/openLink.ts new file mode 100644 index 00000000..0a0bd152 --- /dev/null +++ b/src/utils/router/openLink.ts @@ -0,0 +1,5 @@ +export default function openLink(link: string | null) { + if (!link) return; + + window.open(link, '_blank'); +} From 31b547c67d2184cf7b50e8166bd552546588318f Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 00:15:44 +0900 Subject: [PATCH 030/142] =?UTF-8?q?Feat:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B2=80=EC=83=89=20=EA=B2=B0=EA=B3=BC=EA=B0=80=20?= =?UTF-8?q?=EC=97=86=EC=9D=84=20=EA=B2=BD=EC=9A=B0=20=EB=B3=B4=EC=97=AC=20?= =?UTF-8?q?=EC=A4=84=20=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20=EB=B6=84?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AnnounceNotFound.tsx | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/pages/Announcement/components/AnnounceNotFound.tsx diff --git a/src/pages/Announcement/components/AnnounceNotFound.tsx b/src/pages/Announcement/components/AnnounceNotFound.tsx new file mode 100644 index 00000000..4a7def4a --- /dev/null +++ b/src/pages/Announcement/components/AnnounceNotFound.tsx @@ -0,0 +1,32 @@ +import Icon from '@components/Icon'; +import styled from '@emotion/styled'; +import { THEME } from '@styles/ThemeProvider/theme'; +import React from 'react'; + +interface AnnounceNotFoundProps { + keyword: string; +} + +const AnnounceNotFound = ({ keyword }: AnnounceNotFoundProps) => { + return ( + + + {`"${keyword}"`}에 관한 공지사항이 없습니다. + + ); +}; + +export default AnnounceNotFound; + +const Container = styled.div` + height: 20rem; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 10px; +`; + +const Title = styled.span` + color: ${THEME.TEXT.GRAY}; +`; From 47b3c3bbd0f5046f58acd8f7201c393abb1b5bd5 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 00:16:59 +0900 Subject: [PATCH 031/142] =?UTF-8?q?Refactor:=20=EA=B3=B5=EC=A7=80=EC=82=AC?= =?UTF-8?q?=ED=95=AD=20=EA=B2=80=EC=83=89=20=EA=B2=B0=EA=B3=BC=EB=A5=BC=20?= =?UTF-8?q?=ED=8C=90=EB=8B=A8=ED=95=98=EB=8A=94=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/AnnounceSearchList.tsx | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/src/pages/Announcement/components/AnnounceSearchList.tsx b/src/pages/Announcement/components/AnnounceSearchList.tsx index 26089384..8788bf2c 100644 --- a/src/pages/Announcement/components/AnnounceSearchList.tsx +++ b/src/pages/Announcement/components/AnnounceSearchList.tsx @@ -1,11 +1,10 @@ import AnnounceCard from '@components/Card/AnnounceCard'; -import Icon from '@components/Icon'; -import styled from '@emotion/styled'; -import { THEME } from '@styles/ThemeProvider/theme'; import { AnnounceItem } from '@type/announcement'; import React, { Fragment } from 'react'; import { useLocation } from 'react-router-dom'; +import AnnounceNotFound from './AnnounceNotFound'; + interface AnnounceSearchProps { announceList: AnnounceItem[]; } @@ -17,7 +16,7 @@ const AnnounceSearchList = ({ announceList }: AnnounceSearchProps) => { const searchResult = announceList.filter((announceItem) => announceItem.title.includes(searchKeyword), ); - const hasSearchResult = () => searchResult.length === 0; + const hasSearchResult = () => searchResult.length !== 0; return ( @@ -28,28 +27,10 @@ const AnnounceSearchList = ({ announceList }: AnnounceSearchProps) => { )) ) : ( - - - - {`"${searchKeyword}"`}에 관한 공지사항이 없습니다. - - + )} ); }; export default AnnounceSearchList; - -const AnnounceNotFound = styled.div` - height: 20rem; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - gap: 10px; -`; - -const NotFoundTitle = styled.span` - color: ${THEME.TEXT.GRAY}; -`; From 4c9018c90dd944f536c4e1a7a62789bb7f557ac8 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 16:36:49 +0900 Subject: [PATCH 032/142] =?UTF-8?q?refactor:=20=ED=8F=B4=EB=8D=94=20?= =?UTF-8?q?=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD=20=EC=A0=84=20=ED=8C=8C=EC=9D=BC=EB=93=A4=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Button/Toggle/index.tsx | 50 ----- src/components/Button/index.tsx | 47 ----- .../Card/AnnounceCard/AnnounceList/index.tsx | 61 ------ src/components/Card/AnnounceCard/Skeleton.tsx | 54 ------ src/components/Icon/index.tsx | 69 ------- src/components/Image/index.tsx | 46 ----- src/components/List/Skeleton/college.tsx | 44 ----- src/components/List/Skeleton/department.tsx | 74 -------- src/components/MajorProvider/index.tsx | 44 ----- src/components/Modal/AlertModal/index.tsx | 60 ------ src/components/Modal/ConfirmModal/index.tsx | 54 ------ src/components/Modal/Modals/index.tsx | 17 -- .../Modal/SuggestionModal/index.tsx | 129 ------------- src/components/Modal/index.tsx | 64 ------- src/components/ModalsProvider/index.tsx | 20 -- src/components/Provider/Toast/index.tsx | 21 --- src/components/Toast/Toasts/index.tsx | 40 ---- src/components/Toast/index.tsx | 82 -------- src/contexts/.gitkeep | 0 src/pages/BodyLayout/index.tsx | 19 -- src/pages/Map/Provider/index.tsx | 21 --- src/pages/Map/handlers/overlays.ts | 178 ------------------ src/styles/.gitkeep | 0 23 files changed, 1194 deletions(-) delete mode 100644 src/components/Button/Toggle/index.tsx delete mode 100644 src/components/Button/index.tsx delete mode 100644 src/components/Card/AnnounceCard/AnnounceList/index.tsx delete mode 100644 src/components/Card/AnnounceCard/Skeleton.tsx delete mode 100644 src/components/Icon/index.tsx delete mode 100644 src/components/Image/index.tsx delete mode 100644 src/components/List/Skeleton/college.tsx delete mode 100644 src/components/List/Skeleton/department.tsx delete mode 100644 src/components/MajorProvider/index.tsx delete mode 100644 src/components/Modal/AlertModal/index.tsx delete mode 100644 src/components/Modal/ConfirmModal/index.tsx delete mode 100644 src/components/Modal/Modals/index.tsx delete mode 100644 src/components/Modal/SuggestionModal/index.tsx delete mode 100644 src/components/Modal/index.tsx delete mode 100644 src/components/ModalsProvider/index.tsx delete mode 100644 src/components/Provider/Toast/index.tsx delete mode 100644 src/components/Toast/Toasts/index.tsx delete mode 100644 src/components/Toast/index.tsx delete mode 100644 src/contexts/.gitkeep delete mode 100644 src/pages/BodyLayout/index.tsx delete mode 100644 src/pages/Map/Provider/index.tsx delete mode 100644 src/pages/Map/handlers/overlays.ts delete mode 100644 src/styles/.gitkeep diff --git a/src/components/Button/Toggle/index.tsx b/src/components/Button/Toggle/index.tsx deleted file mode 100644 index 4b3199e7..00000000 --- a/src/components/Button/Toggle/index.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import styled from '@emotion/styled'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { MouseEventHandler } from 'react'; - -interface Props { - isOn: boolean; - changeState: MouseEventHandler; - animation: boolean; -} - -interface Circle { - isOn: boolean; - animation: boolean; -} - -const ToggleButton = (props: Props) => { - const { isOn, changeState, animation } = props; - - return ( - - ); -}; - -export default ToggleButton; - -const Button = styled.button` - position: relative; - border: none; - width: 3.2rem; - height: 1.8rem; - - transition: ${(prop) => (prop.animation ? 'all 0.3s ease-in-out' : 'none')}; - - background-color: ${(prop) => (prop.isOn ? THEME.PRIMARY : THEME.BACKGROUND)}; - border-radius: 1rem; -`; - -const Circle = styled.div` - position: absolute; - border-radius: 50%; - width: 1.2rem; - height: 1.2rem; - transition: ${(prop) => (prop.animation ? 'all 0.3s ease-in-out' : 'none')}; - - background-color: #f5f5f5; - top: 0.3rem; - left: ${(prop) => (prop.isOn ? '1.7rem' : '0.4rem')}; -`; diff --git a/src/components/Button/index.tsx b/src/components/Button/index.tsx deleted file mode 100644 index fda2471d..00000000 --- a/src/components/Button/index.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import styled from '@emotion/styled'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { ButtonHTMLAttributes, ReactNode } from 'react'; - -interface ButtonProps extends ButtonHTMLAttributes { - children?: ReactNode; - onClick?: React.MouseEventHandler; - disabled?: boolean; -} - -const Button = ({ children, disabled = false, ...props }: ButtonProps) => { - return ( - - {children} - - ); -}; - -export default Button; - -const StyledButton = styled.button` - display: flex; - justify-content: center; - align-items: center; - - cursor: pointer; - - width: 100%; - height: 50px; - margin: 4px 0; - - border-radius: 8px; - padding: 10px; - - background-color: ${THEME.BUTTON.BLUE}; - color: #ffffff; - font-weight: bold; - - &:disabled { - background-color: ${THEME.BUTTON.GRAY}; - color: #868686; - cursor: auto; - } - & > svg { - margin-right: 5px; - } -`; diff --git a/src/components/Card/AnnounceCard/AnnounceList/index.tsx b/src/components/Card/AnnounceCard/AnnounceList/index.tsx deleted file mode 100644 index ffdb7032..00000000 --- a/src/components/Card/AnnounceCard/AnnounceList/index.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { ANNOUNCEMENT_TYPE } from '@constants/announcement'; -import styled from '@emotion/styled'; -import { AnnounceSearchList } from '@pages/Announcement/components'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { AnnounceItemList, AnnouncementType } from '@type/announcement'; -import { AxiosError, AxiosResponse } from 'axios'; -import { Fragment } from 'react'; - -import AnnounceCard from '..'; - -type Resource = - | AxiosResponse - | AnnounceItemList - | AxiosError - | null; - -interface AnnounceListProps { - resource: { - read: () => Resource; - }; - type: AnnouncementType; -} - -const AnnounceList = ({ resource, type }: AnnounceListProps) => { - const announceList: Resource = resource.read(); - if (announceList === null || announceList instanceof Error) { - return <>; - } - - const { 고정: pinnedAnnouncement, 일반: normalAnnouncemnet } = - announceList as AnnounceItemList; - - return ( - <> - - {type === ANNOUNCEMENT_TYPE.NORMAL && - normalAnnouncemnet.map((announce, idx) => ( - - - - ))} - {type === ANNOUNCEMENT_TYPE.PINNED && - pinnedAnnouncement.map((announce, idx) => ( - - - - ))} - {type === ANNOUNCEMENT_TYPE.SEARCH && ( - - )} - - ); -}; - -export default AnnounceList; - -const BoundaryLine = styled.div` - border-bottom: 1px solid ${THEME.TEXT.BLACK}; -`; diff --git a/src/components/Card/AnnounceCard/Skeleton.tsx b/src/components/Card/AnnounceCard/Skeleton.tsx deleted file mode 100644 index 03e746a2..00000000 --- a/src/components/Card/AnnounceCard/Skeleton.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { css } from '@emotion/react'; -import styled from '@emotion/styled'; -import SkeletomItem from '@styles/Skeleton/SkeletonItem'; - -interface AnnounceCardSkeletonProps { - length: number; -} - -const AnnounceCardSkeleton = ({ length }: AnnounceCardSkeletonProps) => { - return ( - <> - {Array.from({ length }, (_, idx) => ( - - - -
- - - - ))} - - ); -}; - -export default AnnounceCardSkeleton; - -const Card = styled.div` - height: 28px; - padding: 10px; - display: flex; - flex-direction: column; - justify-content: center; -`; - -const ContentContainer = styled.div` - display: flex; - align-items: center; -`; - -const AnnounceTitle = styled(SkeletomItem)` - flex: 9; -`; - -const AnnounceDate = styled(SkeletomItem)` - flex: 1; - height: 10px; - justify-content: flex-end; -`; diff --git a/src/components/Icon/index.tsx b/src/components/Icon/index.tsx deleted file mode 100644 index 7bb52d50..00000000 --- a/src/components/Icon/index.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { IconKind } from '@type/styles/icon'; -import { IconType } from 'react-icons/lib'; -import { - MdMap, - MdHome, - MdAccountCircle, - MdSchool, - MdNotifications, - MdMenu, - MdArrowBackIos, - MdAddCircleOutline, - MdChevronRight, - MdOutlineModeEdit, - MdOutlineQuestionAnswer, - MdRadioButtonUnchecked, - MdRadioButtonChecked, - MdOutlineCancel, - MdCampaign, - MdOutlineRestartAlt, - MdOutlineSearch, - MdLocalPrintshop, - MdHandshake, - MdEditDocument, - MdPersonSearch, - MdOutlineLightbulb, - MdOutlineMyLocation, - MdOutlineError, -} from 'react-icons/md'; - -const ICON: { [key in IconKind]: IconType } = { - home: MdHome, - map: MdMap, - accountCircle: MdAccountCircle, - menu: MdMenu, - notification: MdNotifications, - school: MdSchool, - arrowBack: MdArrowBackIos, - plus: MdAddCircleOutline, - edit: MdOutlineModeEdit, - suggest: MdOutlineQuestionAnswer, - right: MdChevronRight, - cancel: MdOutlineCancel, - reset: MdOutlineRestartAlt, - speaker: MdCampaign, - search: MdOutlineSearch, - print: MdLocalPrintshop, - handshake: MdHandshake, - document: MdEditDocument, - personSearch: MdPersonSearch, - light: MdOutlineLightbulb, - uncheckedRadio: MdRadioButtonUnchecked, - checkedRadio: MdRadioButtonChecked, - location: MdOutlineMyLocation, - warning: MdOutlineError, -}; - -interface IconProps { - kind: IconKind; - onClick?: () => void; - color?: string; - size?: string; -} - -const Icon = ({ kind, ...props }: IconProps) => { - const TargetIcon = ICON[kind]; - return ; -}; - -export default Icon; diff --git a/src/components/Image/index.tsx b/src/components/Image/index.tsx deleted file mode 100644 index 519e1231..00000000 --- a/src/components/Image/index.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import styled from '@emotion/styled'; -import { ImageSize, ImageProps } from '@type/styles/image'; -import { setSize } from '@utils/styles/size'; -import { CSSProperties } from 'react'; - -const imageSize: ImageSize = { - large: setSize(200), - medium: setSize(150), - small: setSize(100), - tiny: setSize(45), -}; - -const Image = ({ - src, - outline = false, - size = 'medium', - ...props -}: ImageProps) => { - return ( - - ); -}; - -type ImageStyleProps = Pick & { - width: CSSProperties['width']; - height: CSSProperties['height']; -}; - -const StyledImage = styled.img( - ({ width, height, outline }) => { - return { - width, - height, - border: outline ? '3px solid black' : '', - borderRadius: '10px', - }; - }, -); - -export default Image; diff --git a/src/components/List/Skeleton/college.tsx b/src/components/List/Skeleton/college.tsx deleted file mode 100644 index e6a339fc..00000000 --- a/src/components/List/Skeleton/college.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import styled from '@emotion/styled'; -import SkeletomItem from '@styles/Skeleton/SkeletonItem'; -import { THEME } from '@styles/ThemeProvider/theme'; -import React from 'react'; - -interface CollegeSkeletonProps { - length: number; -} - -const CollegeSkeleton = ({ length }: CollegeSkeletonProps) => { - return ( - <> - {Array.from({ length }, (_, idx) => ( - - - - - ))} - - ); -}; - -export default CollegeSkeleton; - -const ListWrapper = styled.div` - display: flex; - align-items: center; - justify-content: space-between; - - padding: 8% 4% 8% 4%; - width: 90%; - margin: 0 auto; - border-bottom: 1px solid ${THEME.BUTTON.GRAY}; -`; - -const College = styled(SkeletomItem)` - height: 28px; - width: 60%; -`; - -const Icon = styled(SkeletomItem)` - height: 28px; - width: 28px; -`; diff --git a/src/components/List/Skeleton/department.tsx b/src/components/List/Skeleton/department.tsx deleted file mode 100644 index 922ade50..00000000 --- a/src/components/List/Skeleton/department.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import Button from '@components/Button'; -import { css } from '@emotion/react'; -import styled from '@emotion/styled'; -import SkeletomItem from '@styles/Skeleton/SkeletonItem'; -import { THEME } from '@styles/ThemeProvider/theme'; -import React from 'react'; - -interface DepartmentSkeletonProps { - length: number; -} - -const DepartmentSkeleton = ({ length }: DepartmentSkeletonProps) => { - return ( - <> -
- {Array.from({ length }, (_, idx) => ( - - - - - ))} -
- - - - - ); -}; - -export default DepartmentSkeleton; - -const ListWrapper = styled.div` - display: flex; - align-items: center; - justify-content: space-between; - - padding: 8% 4% 8% 4%; - width: 90%; - margin: 0 auto; - border-bottom: 1px solid ${THEME.BUTTON.GRAY}; -`; - -const Department = styled(SkeletomItem)` - height: 28px; - width: 60%; -`; - -const Icon = styled(SkeletomItem)` - height: 28px; - width: 28px; -`; - -const ButtonContainer = styled.div` - position: fixed; - bottom: 4%; - z-index: 3; - width: 80%; - max-width: 480px; - left: 50%; - transform: translate(-50%, -50%); - - Button { - display: flex; - align-items: center; - padding: 10px; - & > svg { - margin-right: 15px; - } - } -`; diff --git a/src/components/MajorProvider/index.tsx b/src/components/MajorProvider/index.tsx deleted file mode 100644 index b60ac618..00000000 --- a/src/components/MajorProvider/index.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import http from '@apis/http'; -import MajorContext from '@contexts/major'; -import { AxiosResponse } from 'axios'; -import React, { useEffect, useState } from 'react'; - -interface GraduationLink { - department: string; - link: string | null; -} - -interface MajorProviderProps { - children: React.ReactNode; -} - -const MajorProvider = ({ children }: MajorProviderProps) => { - const [major, setMajor] = useState(null); - const [graduationLink, setGraduationLink] = useState(''); - - useEffect(() => { - const storedMajor = localStorage.getItem('major'); - if (!storedMajor) return; - setMajor(storedMajor); - }, []); - - useEffect(() => { - if (!major) return; - - (async () => { - const response: AxiosResponse = await http.get( - `/api/graduation?major=${major}`, - ); - const graduationLink = response.data.link; - setGraduationLink(graduationLink); - })(); - }, [major]); - - return ( - - {children} - - ); -}; - -export default MajorProvider; diff --git a/src/components/Modal/AlertModal/index.tsx b/src/components/Modal/AlertModal/index.tsx deleted file mode 100644 index f89a2551..00000000 --- a/src/components/Modal/AlertModal/index.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import Button from '@components/Button'; -import Icon from '@components/Icon'; -import { css } from '@emotion/react'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { IconKind } from '@type/styles/icon'; -import React from 'react'; - -import Modal from '..'; - -interface AlertModalProps { - message: string; - buttonMessage?: string; - open: boolean; - iconKind?: IconKind; - onClose?: () => void; - routerTo?: () => void; -} - -const AlertModal = ({ - message, - buttonMessage, - open, - iconKind, - onClose = () => undefined, - routerTo = onClose, -}: AlertModalProps) => { - return ( - <> - {open && ( - - <> - - {message} - - {buttonMessage && ( - - )} - - - )} - - ); -}; - -export default AlertModal; diff --git a/src/components/Modal/ConfirmModal/index.tsx b/src/components/Modal/ConfirmModal/index.tsx deleted file mode 100644 index d0016eb3..00000000 --- a/src/components/Modal/ConfirmModal/index.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import Button from '@components/Button'; -import { css } from '@emotion/react'; -import { THEME } from '@styles/ThemeProvider/theme'; -import React from 'react'; - -import Modal from '..'; - -interface ConfirmModalProps { - message: string; - open: boolean; - onConfirmButtonClick: () => void; - onCancelButtonClick: () => void; -} - -const ConfirmModal = ({ - message, - open, - onConfirmButtonClick, - onCancelButtonClick, -}: ConfirmModalProps) => { - return ( - <> - {open && ( - - <> - - {message} - -
- - -
- -
- )} - - ); -}; - -export default ConfirmModal; diff --git a/src/components/Modal/Modals/index.tsx b/src/components/Modal/Modals/index.tsx deleted file mode 100644 index 3e47c916..00000000 --- a/src/components/Modal/Modals/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import ModalContext from '@contexts/modals'; -import React, { Fragment, useContext } from 'react'; - -const Modals = () => { - const modals = useContext(ModalContext.ModalState); - - return ( - <> - {modals && - modals.map(({ Component, props }, idx) => { - return ; - })} - - ); -}; - -export default Modals; diff --git a/src/components/Modal/SuggestionModal/index.tsx b/src/components/Modal/SuggestionModal/index.tsx deleted file mode 100644 index 27022104..00000000 --- a/src/components/Modal/SuggestionModal/index.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import http from '@apis/http'; -import Button from '@components/Button'; -import Icon from '@components/Icon'; -import { SERVER_URL } from '@config/index'; -import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; -import PLCACEHOLDER_MESSAGES from '@constants/placeholder-message'; -import { css } from '@emotion/react'; -import styled from '@emotion/styled'; -import useModals, { modals } from '@hooks/useModals'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { areaResize } from '@utils/styles/textarea-resize'; -import React, { useRef, useState } from 'react'; - -import Modal from '..'; - -interface SuggestionModalProps { - title: string; - buttonMessage: string; - onClose: () => void; -} - -const SuggestionModal = ({ - title, - buttonMessage, - onClose, -}: SuggestionModalProps) => { - const areaRef = useRef(null); - const [isInvalid, setIsInvalid] = useState(true); - const { openModal, closeModal } = useModals(); - - const postSuggestion = async () => { - await http.post( - `${SERVER_URL}/api/suggestion`, - { - content: areaRef.current?.value, - }, - { - headers: { - 'Content-Type': 'application/json', - }, - }, - ); - }; - - const handleSuggestionPostModal = () => { - postSuggestion(); - onClose(); - closeModal(modals.confirm); - openModal(modals.alert, { - message: MODAL_MESSAGE.SUCCEED.POST_SUGGESTION, - buttonMessage: MODAL_BUTTON_MESSAGE.CONFIRM, - onClose: () => closeModal(modals.alert), - }); - }; - - const handleSuggestionConfirmModal = () => { - openModal(modals.confirm, { - message: MODAL_MESSAGE.CONFIRM.POST_SUGGESTION, - onConfirmButtonClick: () => handleSuggestionPostModal(), - onCancelButtonClick: () => closeModal(modals.confirm), - }); - }; - - const onChange = (e: React.ChangeEvent) => { - if (!e.currentTarget.value || e.currentTarget.value.length < 5) { - setIsInvalid(true); - return; - } - setIsInvalid(false); - }; - const onResize = (e: React.KeyboardEvent) => { - areaResize(e.currentTarget); - }; - - return ( - - <> - - - {title} - - - - - - - - ); -}; - -export default SuggestionModal; - -const SuggestionArea = styled.textarea` - line-height: 1.5; - padding: 10px; - resize: none; - overflow-y: scoll; - - font-size: 16px; - font-weight: bold; - border-radius: 8px; - - &::placeholder { - color: ${THEME.TEXT.GRAY}; - font-weight: lighter; - } -`; - -const SuggestionHeader = styled.header` - display: flex; - align-items: center; - justify-content: space-between; - margin-bottom: 10px; -`; diff --git a/src/components/Modal/index.tsx b/src/components/Modal/index.tsx deleted file mode 100644 index 80376c6c..00000000 --- a/src/components/Modal/index.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { keyframes } from '@emotion/react'; -import styled from '@emotion/styled'; -import { THEME } from '@styles/ThemeProvider/theme'; -import React from 'react'; - -interface ModalProps { - onClose: () => void; - children: JSX.Element; -} - -const Modal = ({ children, onClose }: ModalProps) => { - const onClick = (e: React.MouseEvent) => { - if (e.target === e.currentTarget) { - onClose(); - } - }; - - return ( - - {children} - - ); -}; - -export default Modal; - -const ModalBackground = styled.div` - position: fixed; - top: 0; - left: 0; - right: 0; - bottom: 0; - display: flex; - justify-content: center; - align-items: center; - background-color: rgba(0, 0, 0, 0.6); - z-index: 9999; -`; -const modalIn = keyframes` - from{ - opacity: 0; - transform: translateY(-30px); - } - to{ - opacity: 1; - transform: translateY(0); - } -`; - -const ModalContent = styled.div` - display: flex; - flex-direction: column; - - animation: ${modalIn} 0.3s ease-out; - width: 80%; - max-width: 480px; - max-height: 70vh; - overflow: auto; - padding: 30px; - border-radius: 15px; - background-color: ${THEME.TEXT.WHITE}; - color: ${THEME.TEXT.GRAY}; - font-weight: bold; -`; diff --git a/src/components/ModalsProvider/index.tsx b/src/components/ModalsProvider/index.tsx deleted file mode 100644 index ef8f8452..00000000 --- a/src/components/ModalsProvider/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import ModalsContext from '@contexts/modals'; -import { Modals } from '@type/modals'; -import React, { useState } from 'react'; - -interface ModalsProviderProps { - children: React.ReactNode; -} - -const ModalsProvider = ({ children }: ModalsProviderProps) => { - const [modals, setModals] = useState([]); - return ( - - - {children} - - - ); -}; - -export default ModalsProvider; diff --git a/src/components/Provider/Toast/index.tsx b/src/components/Provider/Toast/index.tsx deleted file mode 100644 index 9702e611..00000000 --- a/src/components/Provider/Toast/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import ToastContext from '@contexts/toasts'; -import ToastState from '@type/toasts'; -import React, { useState } from 'react'; - -interface ToastProviderProps { - children: React.ReactNode; -} - -const ToastProvider = ({ children }: ToastProviderProps) => { - const [toasts, setToasts] = useState([]); - - return ( - - - {children} - - - ); -}; - -export default ToastProvider; diff --git a/src/components/Toast/Toasts/index.tsx b/src/components/Toast/Toasts/index.tsx deleted file mode 100644 index 363797d9..00000000 --- a/src/components/Toast/Toasts/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import ToastContext from '@contexts/toasts'; -import styled from '@emotion/styled'; -import React, { useContext } from 'react'; - -import Toast from '..'; - -const Toasts = () => { - const toasts = useContext(ToastContext.ToastStateContext); - if (toasts?.length === 0) return <>; - - return ( - - {toasts && - toasts.map((toast) => { - return ( - - - - ); - })} - - ); -}; - -export default Toasts; - -const ToastContainer = styled.section` - position: fixed; - right: 0; - left: 0; - bottom: 100px; - width: 100%; - opacity: 0.9; - - display: flex; - flex-direction: column-reverse; - align-items: center; - row-gap: 12px; - z-index: 9999; -`; diff --git a/src/components/Toast/index.tsx b/src/components/Toast/index.tsx deleted file mode 100644 index f2ed0e51..00000000 --- a/src/components/Toast/index.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { keyframes } from '@emotion/react'; -import styled from '@emotion/styled'; -import useToasts from '@hooks/useToast'; -import { THEME } from '@styles/ThemeProvider/theme'; -import React, { useEffect, useState } from 'react'; - -interface ToastProps { - id: string; - message: string; -} - -const Toast = ({ id, message }: ToastProps) => { - const [isClose, setIsClose] = useState(false); - const { removeToast } = useToasts(); - - useEffect(() => { - if (!isClose) return; - - const removeTimer = setTimeout(() => { - removeToast(id); - }, 500); - return () => { - clearTimeout(removeTimer); - }; - }, [isClose]); - - useEffect(() => { - const closeTimer = setTimeout(() => { - setIsClose(true); - }, 2000); - return () => { - clearTimeout(closeTimer); - }; - }, []); - - return ( - - {message} - - ); -}; - -export default Toast; - -const toastSlideIn = keyframes` - from{ - opacity: 0; - }to{ - opacity: 1; - } -`; - -const toastSlideOut = keyframes` - from{ - opacity: 1; - }to{ - opacity: 0; - } -`; - -const Container = styled.div<{ isClose: boolean }>` - position: relative; - padding: 0.8rem; - gap: 1rem; - - display: flex; - justify-content: center; - align-items: center; - border-radius: 25px; - background-color: ${THEME.PRIMARY}; - box-shadow: 0px 0px 5px rgba(0, 0, 0, 0.4); - animation: ${({ isClose }) => (isClose ? toastSlideOut : toastSlideIn)} 0.4s - ease-in-out forwards; - overflow-x: hidden; -`; - -const ToastMessage = styled.span` - font-size: 12px; - font-weight: 500; - line-height: normal; - color: ${THEME.TEXT.WHITE}; -`; diff --git a/src/contexts/.gitkeep b/src/contexts/.gitkeep deleted file mode 100644 index e69de29b..00000000 diff --git a/src/pages/BodyLayout/index.tsx b/src/pages/BodyLayout/index.tsx deleted file mode 100644 index dc97d7ed..00000000 --- a/src/pages/BodyLayout/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import styled from '@emotion/styled'; -import React from 'react'; -import { Outlet } from 'react-router-dom'; - -const BodyLayout = () => { - return ( - - - - ); -}; - -export default BodyLayout; - -const StyledBodyLayout = styled.div` - height: calc(100vh - 8vh - 90px); - padding: 8vh 0 8vh 0; - overflow-y: scroll; -`; diff --git a/src/pages/Map/Provider/index.tsx b/src/pages/Map/Provider/index.tsx deleted file mode 100644 index d2500d18..00000000 --- a/src/pages/Map/Provider/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import OverlayContext from '@contexts/overlays'; -import useModals from '@hooks/useModals'; -import useUserLocation from '@hooks/useUserLocation'; -import React from 'react'; -import { Outlet } from 'react-router-dom'; - -import { CustomOverlay } from '../handlers'; - -const MapProvider = () => { - const { openModal, closeModal } = useModals(); - const userLocation = useUserLocation(); - const customOverlay = new CustomOverlay(openModal, closeModal, userLocation); - - return ( - - - - ); -}; - -export default MapProvider; diff --git a/src/pages/Map/handlers/overlays.ts b/src/pages/Map/handlers/overlays.ts deleted file mode 100644 index 5d4bcdba..00000000 --- a/src/pages/Map/handlers/overlays.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; -import { PKNU_BUILDINGS } from '@constants/pknu-map'; -import { CloseModal, OpenModal, modals } from '@hooks/useModals'; -import { THEME } from '@styles/ThemeProvider/theme'; -import { BuildingType, Location, PKNUBuilding } from '@type/map'; -import { hasLocationPermission } from '@utils/map'; -import { CSSProperties } from 'react'; - -interface ICustomOverlay { - handleOverlays(buildingTypes: Record, map: any): void; - addOverlay( - buildingType: BuildingType, - building: PKNUBuilding, - map: any, - ): void; -} - -class CustomOverlay implements ICustomOverlay { - private overlays: Record; - private openModal: OpenModal; - private closeModal: CloseModal; - private userLocation: Location | null; - - constructor( - openModal: OpenModal, - closeModal: CloseModal, - userLocation: Location | null, - ) { - this.openModal = openModal; - this.closeModal = closeModal; - this.userLocation = userLocation; - this.overlays = { - A: [], - B: [], - C: [], - D: [], - E: [], - }; - } - - private isOverlayInMap(buildingType: BuildingType, building: PKNUBuilding) { - const type = buildingType as keyof typeof this.overlays; - if (this.overlays[type].length === 0) return false; - this.overlays[type].forEach((overlay) => { - if (overlay.cc.innerText === building.buildingName) return true; - }); - - return false; - } - - private isAllOverlayInMap(type: BuildingType) { - return this.overlays[type].length >= PKNU_BUILDINGS[type].buildings.length; - } - - private routeHandler(building: PKNUBuilding) { - const { buildingNumber, buildingName, latlng } = building; - const [lat, lng] = latlng; - - if (!this.userLocation) return; - hasLocationPermission(this.userLocation) - ? this.openModal(modals.confirm, { - message: `목적지(${buildingNumber})로 길찾기를 시작할까요?`, - onConfirmButtonClick: () => { - const kakaoMapWebURL = `https://map.kakao.com/link/from/현위치,${this.userLocation?.LAT},${this.userLocation?.LNG}/to/${buildingName},${lat},${lng}`; - const kakaoMapAppURL = `kakaomap://route?sp=${this.userLocation?.LAT},${this.userLocation?.LNG}&ep=${lat},${lng}`; - const isKakaoMapInstalled = /KAKAOMAP/i.test(navigator.userAgent); - window.open( - isKakaoMapInstalled ? kakaoMapAppURL : kakaoMapWebURL, - '_blank', - ); - this.closeModal(modals.confirm); - }, - onCancelButtonClick: () => this.closeModal(modals.confirm), - }) - : this.openModal(modals.alert, { - message: MODAL_MESSAGE.ALERT.NO_LOCATION_PERMISSON, - buttonMessage: MODAL_BUTTON_MESSAGE.CLOSE, - onClose: () => this.closeModal(modals.alert), - }); - } - - private createOverlayContent( - activeColor: CSSProperties['color'], - building: PKNUBuilding, - ) { - const content = document.createElement('span') as HTMLSpanElement; - Object.assign(content.style, { - backgroundColor: `${activeColor}`, - color: THEME.TEXT.WHITE, - padding: '5px', - borderRadius: '8px', - fontSize: '10px', - fontWeight: 'bold', - }); - const buildingNumberText = document.createTextNode(building.buildingNumber); - content.appendChild(buildingNumberText); - content.onclick = () => this.routeHandler(building); - - return content; - } - - private createOverlay(type: BuildingType, building: PKNUBuilding) { - const overlayContent = this.createOverlayContent( - PKNU_BUILDINGS[type].activeColor, - building, - ); - const overlay = new window.kakao.maps.CustomOverlay({ - position: new window.kakao.maps.LatLng( - building.latlng[0], - building.latlng[1], - ), - content: overlayContent, - removable: false, - yAnchor: -0.05, - }); - - return overlay; - } - - private getTypeOverlays(buildingType: BuildingType, map: any) { - const type = buildingType as keyof typeof this.overlays; - const typeOverlays: any[] = []; - PKNU_BUILDINGS[type].buildings.forEach((building) => { - const overlay = this.createOverlay(type, building); - overlay.setMap(map); - typeOverlays.push(overlay); - }); - - return typeOverlays; - } - - addOverlay(buildingType: BuildingType, building: PKNUBuilding, map: any) { - const type = buildingType as keyof typeof this.overlays; - if (!this.isOverlayInMap(buildingType, building)) { - const overlay = this.createOverlay(buildingType, building); - overlay.setMap(map); - this.overlays = { - ...this.overlays, - [type]: [...this.overlays[type], overlay], - }; - } - } - - handleOverlays(activeTypes: Record, map: any) { - const newOverlays: Record = { - A: [], - B: [], - C: [], - D: [], - E: [], - }; - - Object.keys(activeTypes).forEach((activeType) => { - const type = activeType as keyof typeof this.overlays; - - if (!activeTypes[type]) { - if (!this.isAllOverlayInMap(type)) { - newOverlays[type] = [...this.overlays[type]]; - return; - } - this.overlays[type].forEach((overlay) => { - overlay.setMap(null); - }); - return; - } - if (this.isAllOverlayInMap(type)) { - newOverlays[type] = [...this.overlays[type]]; - return; - } - const typeOverlays = this.getTypeOverlays(type, map); - newOverlays[type] = [...this.overlays[type], ...typeOverlays]; - }); - - this.overlays = newOverlays; - } -} - -export default CustomOverlay; diff --git a/src/styles/.gitkeep b/src/styles/.gitkeep deleted file mode 100644 index e69de29b..00000000 From 30149416cac60d0fdb11e8e4afb77a6371d7aa97 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 16:37:54 +0900 Subject: [PATCH 033/142] =?UTF-8?q?Test:=20=ED=8F=B4=EB=8D=94=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20Provider=20?= =?UTF-8?q?=EC=BB=B4=ED=8F=AC=EB=84=8C=ED=8A=B8=20import=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/AnnounceCard/index.test.tsx | 2 +- src/components/Card/InformCard/index.test.tsx | 6 +++--- src/components/List/DepartmentList/index.test.tsx | 6 +++--- src/pages/Home/Home.test.tsx | 8 ++++---- src/pages/MajorDecision/index.test.tsx | 2 +- src/pages/My/index.test.tsx | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/Card/AnnounceCard/index.test.tsx b/src/components/Card/AnnounceCard/index.test.tsx index 02d09044..aadaa992 100644 --- a/src/components/Card/AnnounceCard/index.test.tsx +++ b/src/components/Card/AnnounceCard/index.test.tsx @@ -1,5 +1,5 @@ import http from '@apis/http'; -import MajorProvider from '@components/MajorProvider'; +import MajorProvider from '@components/Providers/MajorProvider'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { AnnounceItemList } from '@type/announcement'; diff --git a/src/components/Card/InformCard/index.test.tsx b/src/components/Card/InformCard/index.test.tsx index a32daa6b..f5f16cbb 100644 --- a/src/components/Card/InformCard/index.test.tsx +++ b/src/components/Card/InformCard/index.test.tsx @@ -1,5 +1,5 @@ -import AlertModal from '@components/Modal/AlertModal'; -import ModalsProvider from '@components/ModalsProvider'; +import AlertModal from '@components/Common/Modal/AlertModal'; +import ModalsProvider from '@components/Providers/ModalsProvider'; import { MODAL_MESSAGE } from '@constants/modal-messages'; import MajorContext from '@contexts/major'; import useModals from '@hooks/useModals'; @@ -9,8 +9,8 @@ import Major from '@type/major'; import { IconKind } from '@type/styles/icon'; import { act } from 'react-dom/test-utils'; import { MemoryRouter } from 'react-router-dom'; - import '@testing-library/jest-dom'; + import InformCard from './index'; type INFORM_CARD_TYPE = 'ANNOUNCEMENT' | 'GRADUATION'; diff --git a/src/components/List/DepartmentList/index.test.tsx b/src/components/List/DepartmentList/index.test.tsx index 6a231171..6b0cd067 100644 --- a/src/components/List/DepartmentList/index.test.tsx +++ b/src/components/List/DepartmentList/index.test.tsx @@ -1,7 +1,7 @@ +import ConfirmModal from '@components/Common/Modal/ConfirmModal'; import DepartmentList from '@components/List/DepartmentList'; -import MajorProvider from '@components/MajorProvider'; -import ConfirmModal from '@components/Modal/ConfirmModal'; -import ModalsProvider from '@components/ModalsProvider'; +import MajorProvider from '@components/Providers/MajorProvider'; +import ModalsProvider from '@components/Providers/ModalsProvider'; import { MODAL_MESSAGE } from '@constants/modal-messages'; import useMajor from '@hooks/useMajor'; import useModals from '@hooks/useModals'; diff --git a/src/pages/Home/Home.test.tsx b/src/pages/Home/Home.test.tsx index 1cc65f48..54523aba 100644 --- a/src/pages/Home/Home.test.tsx +++ b/src/pages/Home/Home.test.tsx @@ -1,5 +1,5 @@ -import MajorProvider from '@components/MajorProvider'; -import ModalsProvier from '@components/ModalsProvider'; +import MajorProvider from '@components/Providers/MajorProvider'; +import ModalsProvider from '@components/Providers/ModalsProvider'; import { render, screen } from '@testing-library/react'; import { MemoryRouter } from 'react-router-dom'; import '@testing-library/jest-dom'; @@ -10,9 +10,9 @@ describe('Home Page 컴포넌트 테스트', () => { it('페이지에 공지사항 및 졸업요건 컴포넌트가 렌더링된다.', () => { render( - + - + , { wrapper: MemoryRouter, diff --git a/src/pages/MajorDecision/index.test.tsx b/src/pages/MajorDecision/index.test.tsx index 301c8177..32caf253 100644 --- a/src/pages/MajorDecision/index.test.tsx +++ b/src/pages/MajorDecision/index.test.tsx @@ -1,4 +1,4 @@ -import MajorProvider from '@components/MajorProvider'; +import MajorProvider from '@components/Providers/MajorProvider'; import MajorContext from '@contexts/major'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; diff --git a/src/pages/My/index.test.tsx b/src/pages/My/index.test.tsx index 70edbfc1..4ff828cd 100644 --- a/src/pages/My/index.test.tsx +++ b/src/pages/My/index.test.tsx @@ -1,5 +1,5 @@ -import MajorProvider from '@components/MajorProvider'; -import ModalsProvider from '@components/ModalsProvider'; +import MajorProvider from '@components/Providers/MajorProvider'; +import ModalsProvider from '@components/Providers/ModalsProvider'; import useModals, { modals } from '@hooks/useModals'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; From b6290badf9ed3f9eea79f161e527b53c756df8f7 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 16:43:50 +0900 Subject: [PATCH 034/142] =?UTF-8?q?chore(change=20import=20path):=20?= =?UTF-8?q?=ED=8F=B4=EB=8D=94=20=EA=B5=AC=EC=A1=B0=20=EB=B3=80=EA=B2=BD?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=9D=B8=ED=95=9C=20import=20=EA=B2=BD?= =?UTF-8?q?=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Card/InformCard/index.tsx | 3 +-- src/components/List/CollegeList/CollegeItem.tsx | 6 +----- src/components/List/CollegeList/index.tsx | 2 +- .../List/DepartmentList/DepartmentItem.tsx | 8 ++------ src/components/List/DepartmentList/index.tsx | 2 +- src/components/SideBar/Content/index.tsx | 2 +- src/components/SideBar/index.tsx | 4 ++-- src/hooks/useModals.ts | 6 +++--- src/main.tsx | 16 +++++++++------- .../components/AnnounceContainer.tsx | 4 ++-- .../Announcement/components/AnnounceNotFound.tsx | 2 +- .../Announcement/components/AnnounceSearch.tsx | 2 +- .../components/AnnounceTypeButtons.tsx | 2 +- src/pages/Map/components/MapHeader.tsx | 2 +- src/pages/Map/components/RefreshButtons.tsx | 2 +- src/pages/My/index.tsx | 6 +++--- src/pages/Tip/index.tsx | 4 ++-- 17 files changed, 33 insertions(+), 40 deletions(-) diff --git a/src/components/Card/InformCard/index.tsx b/src/components/Card/InformCard/index.tsx index 5d3e688f..6822bf2a 100644 --- a/src/components/Card/InformCard/index.tsx +++ b/src/components/Card/InformCard/index.tsx @@ -1,6 +1,5 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; -import { css } from '@emotion/react'; import styled from '@emotion/styled'; import useMajor from '@hooks/useMajor'; import useModals, { modals } from '@hooks/useModals'; diff --git a/src/components/List/CollegeList/CollegeItem.tsx b/src/components/List/CollegeList/CollegeItem.tsx index 25391d4a..bc6ea8f0 100644 --- a/src/components/List/CollegeList/CollegeItem.tsx +++ b/src/components/List/CollegeList/CollegeItem.tsx @@ -1,4 +1,4 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import styled from '@emotion/styled'; import useRouter from '@hooks/useRouter'; import { THEME } from '@styles/ThemeProvider/theme'; @@ -54,8 +54,4 @@ const ListWrapper = styled.div` transform: scale(0.95); opacity: 0.6; } - - &: hover { - cursor: pointer; - } `; diff --git a/src/components/List/CollegeList/index.tsx b/src/components/List/CollegeList/index.tsx index 68046a52..0c950a0f 100644 --- a/src/components/List/CollegeList/index.tsx +++ b/src/components/List/CollegeList/index.tsx @@ -4,7 +4,7 @@ import { THEME } from '@styles/ThemeProvider/theme'; import React, { Suspense } from 'react'; import CollegeItem from './CollegeItem'; -import CollegeSkeleton from '../Skeleton/college'; +import CollegeSkeleton from './Skeleton'; const CollegeList = () => { return ( diff --git a/src/components/List/DepartmentList/DepartmentItem.tsx b/src/components/List/DepartmentList/DepartmentItem.tsx index b0d65bec..f54ce020 100644 --- a/src/components/List/DepartmentList/DepartmentItem.tsx +++ b/src/components/List/DepartmentList/DepartmentItem.tsx @@ -1,6 +1,6 @@ import http from '@apis/http'; -import Button from '@components/Button'; -import Icon from '@components/Icon'; +import Button from '@components/Common/Button'; +import Icon from '@components/Common/Icon'; import { SERVER_URL } from '@config/index'; import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; import { css } from '@emotion/react'; @@ -115,10 +115,6 @@ const ListWrapper = styled.div` transform: scale(0.95); opacity: 0.6; } - - &: hover { - cursor: pointer; - } `; const ButtonContainer = styled.div` diff --git a/src/components/List/DepartmentList/index.tsx b/src/components/List/DepartmentList/index.tsx index b3d4b8e6..424e4194 100644 --- a/src/components/List/DepartmentList/index.tsx +++ b/src/components/List/DepartmentList/index.tsx @@ -6,7 +6,7 @@ import React, { Suspense } from 'react'; import { useParams } from 'react-router-dom'; import DepartmentItem from './DepartmentItem'; -import DepartmentSkeleton from '../Skeleton/department'; +import DepartmentSkeleton from './Skeleton'; const DepartmentList = () => { const { college } = useParams(); diff --git a/src/components/SideBar/Content/index.tsx b/src/components/SideBar/Content/index.tsx index ef466cc0..d0f5335f 100644 --- a/src/components/SideBar/Content/index.tsx +++ b/src/components/SideBar/Content/index.tsx @@ -1,4 +1,4 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import SIDEBAR_CONTENT from '@constants/sidebar'; import styled from '@emotion/styled'; import useRouter from '@hooks/useRouter'; diff --git a/src/components/SideBar/index.tsx b/src/components/SideBar/index.tsx index b8108179..af574ae9 100644 --- a/src/components/SideBar/index.tsx +++ b/src/components/SideBar/index.tsx @@ -1,5 +1,5 @@ -import Icon from '@components/Icon'; -import Image from '@components/Image'; +import Icon from '@components/Common/Icon'; +import Image from '@components/Common/Image'; import ASSET_PATH from '@constants/assets-path'; import { css, keyframes } from '@emotion/react'; import styled from '@emotion/styled'; diff --git a/src/hooks/useModals.ts b/src/hooks/useModals.ts index 0fdc32ac..d8b87b65 100644 --- a/src/hooks/useModals.ts +++ b/src/hooks/useModals.ts @@ -1,6 +1,6 @@ -import AlertModal from '@components/Modal/AlertModal'; -import ConfirmModal from '@components/Modal/ConfirmModal'; -import SuggestionModal from '@components/Modal/SuggestionModal'; +import AlertModal from '@components/Common/Modal/AlertModal'; +import ConfirmModal from '@components/Common/Modal/ConfirmModal'; +import SuggestionModal from '@components/Common/Modal/SuggestionModal'; import ModalsContext from '@contexts/modals'; import { ComponentProps, diff --git a/src/main.tsx b/src/main.tsx index 315ffdfa..ba9a15dd 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -1,8 +1,10 @@ -import MajorProvider from '@components/MajorProvider'; -import Modals from '@components/Modal/Modals'; -import ModalsProvider from '@components/ModalsProvider'; -import ToastProvider from '@components/Provider/Toast'; -import Toasts from '@components/Toast/Toasts'; +import Modals from '@components/Common/Modal/Modals'; +import Toasts from '@components/Common/Toast/Toasts'; +import { + MajorProvider, + ModalsProvider, + ToastsProvider, +} from '@components/Providers'; import ThemeProvider from '@styles/ThemeProvider'; import React from 'react'; import ReactDOM from 'react-dom/client'; @@ -29,11 +31,11 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - + - + diff --git a/src/pages/Announcement/components/AnnounceContainer.tsx b/src/pages/Announcement/components/AnnounceContainer.tsx index dd8bedce..36f693f8 100644 --- a/src/pages/Announcement/components/AnnounceContainer.tsx +++ b/src/pages/Announcement/components/AnnounceContainer.tsx @@ -1,6 +1,6 @@ import fetchAnnounceList from '@apis/Suspense/fetch-announce-list'; -import AnnounceList from '@components/Card/AnnounceCard/AnnounceList'; -import AnnounceCardSkeleton from '@components/Card/AnnounceCard/Skeleton'; +import AnnounceList from '@components/List/AnnounceList'; +import AnnounceCardSkeleton from '@components/List/AnnounceList/Skeleton'; import { ANNOUNCEMENT_TYPE } from '@constants/announcement'; import PATH from '@constants/path'; import { keyframes } from '@emotion/react'; diff --git a/src/pages/Announcement/components/AnnounceNotFound.tsx b/src/pages/Announcement/components/AnnounceNotFound.tsx index 4a7def4a..6a391392 100644 --- a/src/pages/Announcement/components/AnnounceNotFound.tsx +++ b/src/pages/Announcement/components/AnnounceNotFound.tsx @@ -1,4 +1,4 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import styled from '@emotion/styled'; import { THEME } from '@styles/ThemeProvider/theme'; import React from 'react'; diff --git a/src/pages/Announcement/components/AnnounceSearch.tsx b/src/pages/Announcement/components/AnnounceSearch.tsx index 79cca090..08e1804a 100644 --- a/src/pages/Announcement/components/AnnounceSearch.tsx +++ b/src/pages/Announcement/components/AnnounceSearch.tsx @@ -1,4 +1,4 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import PATH from '@constants/path'; import PLCACEHOLDER_MESSAGES from '@constants/placeholder-message'; import TOAST_MESSAGES from '@constants/toast-message'; diff --git a/src/pages/Announcement/components/AnnounceTypeButtons.tsx b/src/pages/Announcement/components/AnnounceTypeButtons.tsx index 1b309767..2a2c1323 100644 --- a/src/pages/Announcement/components/AnnounceTypeButtons.tsx +++ b/src/pages/Announcement/components/AnnounceTypeButtons.tsx @@ -1,4 +1,4 @@ -import Button from '@components/Button'; +import Button from '@components/Common/Button'; import { css } from '@emotion/react'; import { THEME } from '@styles/ThemeProvider/theme'; import React from 'react'; diff --git a/src/pages/Map/components/MapHeader.tsx b/src/pages/Map/components/MapHeader.tsx index 6fd03dad..1c3fb276 100644 --- a/src/pages/Map/components/MapHeader.tsx +++ b/src/pages/Map/components/MapHeader.tsx @@ -1,4 +1,4 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; import { PKNU_BUILDINGS } from '@constants/pknu-map'; import PLCACEHOLDER_MESSAGES from '@constants/placeholder-message'; diff --git a/src/pages/Map/components/RefreshButtons.tsx b/src/pages/Map/components/RefreshButtons.tsx index cea14d5d..615b0581 100644 --- a/src/pages/Map/components/RefreshButtons.tsx +++ b/src/pages/Map/components/RefreshButtons.tsx @@ -1,4 +1,4 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import { PKNU_MAP_CENTER } from '@constants/pknu-map'; import TOAST_MESSAGES from '@constants/toast-message'; import styled from '@emotion/styled'; diff --git a/src/pages/My/index.tsx b/src/pages/My/index.tsx index ce1e6f39..45ed7baa 100644 --- a/src/pages/My/index.tsx +++ b/src/pages/My/index.tsx @@ -1,7 +1,7 @@ import http from '@apis/http'; -import Button from '@components/Button'; -import ToggleButton from '@components/Button/Toggle'; -import Icon from '@components/Icon'; +import Button from '@components/Common/Button'; +import ToggleButton from '@components/Common/Button/Toggle'; +import Icon from '@components/Common/Icon'; import { SERVER_URL } from '@config/index'; import { MODAL_BUTTON_MESSAGE, MODAL_MESSAGE } from '@constants/modal-messages'; import { css } from '@emotion/react'; diff --git a/src/pages/Tip/index.tsx b/src/pages/Tip/index.tsx index ef525383..2e22085f 100644 --- a/src/pages/Tip/index.tsx +++ b/src/pages/Tip/index.tsx @@ -1,5 +1,5 @@ -import Icon from '@components/Icon'; -import Image from '@components/Image'; +import Icon from '@components/Common/Icon'; +import Image from '@components/Common/Image'; import TIP_CONTENT from '@constants/tip'; import { css } from '@emotion/react'; import styled from '@emotion/styled'; From 9bcc199f9f0abf2a5d2d6a7b29ee69eeafcc9851 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 16:44:49 +0900 Subject: [PATCH 035/142] =?UTF-8?q?refactor:=20App=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EC=97=90=EC=84=9C=20Header=20=EC=BB=B4?= =?UTF-8?q?=ED=8F=AC=EB=84=8C=ED=8A=B8=EC=9D=98=20=EB=A0=8C=EB=8D=94?= =?UTF-8?q?=EB=A7=81=EC=9D=84=20=EA=B2=B0=EC=A0=95=ED=95=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Header 컴포넌트에서 지도 페이지인지 확인 후, 렌더링 하지 않도록 결정하는 것으로 수정 --- src/App.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 18c1e4ed..672f92ae 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,23 +1,23 @@ +import BodyLayout from '@components/BodyLayout'; import FooterTab from '@components/FooterTab'; import Header from '@components/Header'; import Announcement from '@pages/Announcement'; -import BodyLayout from '@pages/BodyLayout'; import Home from '@pages/Home'; import MajorDecision from '@pages/MajorDecision'; import Map from '@pages/Map'; -import MapProvider from '@pages/Map/Provider'; import My from '@pages/My'; import Tip from '@pages/Tip'; import RouteChangeTracker from '@utils/routeChangeTracker'; -import { Routes, Route, useLocation } from 'react-router-dom'; +import { Routes, Route } from 'react-router-dom'; + +import { OverlayProvider } from './components/Providers'; const App = () => { - const location = useLocation(); RouteChangeTracker(); return ( <> - {location.pathname !== '/map' &&
} +
}> } /> @@ -26,7 +26,7 @@ const App = () => { } /> } /> - }> + }> } /> From c3d3bccf48215d0209caca9f6b33743559a6899a Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 16:45:20 +0900 Subject: [PATCH 036/142] =?UTF-8?q?refactor:=20=EC=A7=80=EB=8F=84=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A5=BC=20=EB=B0=A9=EB=AC=B8?= =?UTF-8?q?=ED=95=9C=20=EA=B2=BD=EC=9A=B0=20Header=20=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EB=84=8C=ED=8A=B8=EB=A5=BC=20=EB=A0=8C=EB=8D=94=EB=A7=81=20?= =?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header/index.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Header/index.tsx b/src/components/Header/index.tsx index de971f7c..91cccaf4 100644 --- a/src/components/Header/index.tsx +++ b/src/components/Header/index.tsx @@ -1,14 +1,19 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import SideBar from '@components/SideBar'; import SideBarContent from '@components/SideBar/Content'; import styled from '@emotion/styled'; import useRoter from '@hooks/useRouter'; import { THEME } from '@styles/ThemeProvider/theme'; import { useState } from 'react'; +import { useLocation } from 'react-router-dom'; const Header = () => { const { routerTo, goBack } = useRoter(); const [open, setOpen] = useState(false); + const location = useLocation(); + + if (location.pathname === '/map') return <>; + return ( From 86bc0eeb5004d8cd704b37187280b03bea970084 Mon Sep 17 00:00:00 2001 From: hwinkr Date: Fri, 17 Nov 2023 16:45:59 +0900 Subject: [PATCH 037/142] =?UTF-8?q?chore:=20=ED=8F=B4=EB=8D=94=20=EA=B5=AC?= =?UTF-8?q?=EC=A1=B0=20=EB=B3=80=EA=B2=BD=EC=9C=BC=EB=A1=9C=20=EC=9D=B8?= =?UTF-8?q?=ED=95=9C=20import=20=EA=B2=BD=EB=A1=9C=20=EC=88=98=EC=A0=95,?= =?UTF-8?q?=20=EC=83=81=EC=88=98=20=EC=BB=A8=EB=B2=A4=EC=85=98=20=EB=A7=9E?= =?UTF-8?q?=EC=B6=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/FooterTab/index.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/FooterTab/index.tsx b/src/components/FooterTab/index.tsx index f25fc173..545fcd6d 100644 --- a/src/components/FooterTab/index.tsx +++ b/src/components/FooterTab/index.tsx @@ -1,9 +1,9 @@ -import Icon from '@components/Icon'; +import Icon from '@components/Common/Icon'; import styled from '@emotion/styled'; import useRouter from '@hooks/useRouter'; import { THEME } from '@styles/ThemeProvider/theme'; -const footerTabs = [ +const FOOTER_TABS = [ { kind: 'map', label: '지도', path: '/map' }, { kind: 'home', label: '홈', path: '/' }, { kind: 'accountCircle', label: '마이', path: '/my' }, @@ -16,7 +16,7 @@ const FooterTab = () => { return (