From 5da2602d76dbf2c068e1d19201d446d8e645332d Mon Sep 17 00:00:00 2001 From: xxxjinn Date: Sun, 18 Aug 2024 03:39:05 +0900 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=ED=96=89=EC=82=AC=20detail=20?= =?UTF-8?q?=ED=8E=98=EC=9D=B4=EC=A7=80=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20list=EC=97=90=20img=EB=A7=8C=20=EC=9E=88?= =?UTF-8?q?=EC=9D=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/content/ui/CommonDetailComponent.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/features/content/ui/CommonDetailComponent.tsx b/src/features/content/ui/CommonDetailComponent.tsx index 4c02c73..1bfdbd1 100644 --- a/src/features/content/ui/CommonDetailComponent.tsx +++ b/src/features/content/ui/CommonDetailComponent.tsx @@ -1,3 +1,5 @@ +'use client'; + import DateText from '@/widgets/DateText'; import Title from '@/widgets/Title'; import { formatDate } from '@/shared/lib/utils'; @@ -6,12 +8,16 @@ import ReactMarkdown from 'react-markdown'; import rehypeRaw from 'rehype-raw'; import { TbDownload } from 'react-icons/tb'; import { CommonDetailItem } from '../api/types'; +import { usePathname } from 'next/navigation'; const CommonDetailComponent = ({ content: data, }: { content: CommonDetailItem | undefined; }) => { + const pathname = usePathname(); + const isEventDetailPage = pathname.includes('event'); + if (data) { return (
@@ -33,9 +39,15 @@ const CommonDetailComponent = ({ {data.content} + {isEventDetailPage && + data.fileInfo.length > 0 && + data.fileInfo.map((data, index) => ( + + ))}

- {data.fileInfo.length > 0 && + {!isEventDetailPage && + data.fileInfo.length > 0 && data.fileInfo.map((data, index) => ( Date: Sun, 18 Aug 2024 03:46:07 +0900 Subject: [PATCH 2/6] =?UTF-8?q?style:=20=ED=96=89=EC=82=AC=20content=20?= =?UTF-8?q?=EC=9D=B4=EB=AF=B8=EC=A7=80=20styling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../content/ui/CommonDetailComponent.tsx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/features/content/ui/CommonDetailComponent.tsx b/src/features/content/ui/CommonDetailComponent.tsx index 1bfdbd1..070d0f9 100644 --- a/src/features/content/ui/CommonDetailComponent.tsx +++ b/src/features/content/ui/CommonDetailComponent.tsx @@ -18,6 +18,8 @@ const CommonDetailComponent = ({ const pathname = usePathname(); const isEventDetailPage = pathname.includes('event'); + const arr = [1, 2, 3, 4, 5, 6, 2]; + if (data) { return (
@@ -35,15 +37,17 @@ const CommonDetailComponent = ({

-
+
{data.content} - {isEventDetailPage && - data.fileInfo.length > 0 && - data.fileInfo.map((data, index) => ( - - ))} +
+ {isEventDetailPage && + data.fileInfo.length > 0 && + data.fileInfo.map((data, index) => ( + + ))} +

{!isEventDetailPage && From 668fe8910771c933fe1bf587aabefbf8c2b5dfb9 Mon Sep 17 00:00:00 2001 From: xxxjinn Date: Sun, 18 Aug 2024 03:52:42 +0900 Subject: [PATCH 3/6] =?UTF-8?q?refactor:=20=ED=9A=8C=EC=9D=98=EB=A1=9D,=20?= =?UTF-8?q?=ED=95=99=EC=B9=99=20api=20=EC=97=B0=EA=B2=B0=20(=EB=A8=B8?= =?UTF-8?q?=EC=A7=80=ED=95=98=EB=8B=A4=20=EC=8B=A4=EC=88=98=EB=A1=9C=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=96=88=EB=82=98=EB=B4=84)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/features/content/api/queries.ts | 38 +++++++++++++++++++++- src/features/content/model/usePdfDetail.ts | 9 ++--- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/src/features/content/api/queries.ts b/src/features/content/api/queries.ts index 7206db3..493c5fc 100644 --- a/src/features/content/api/queries.ts +++ b/src/features/content/api/queries.ts @@ -4,8 +4,16 @@ import { GetNoticeDetailResData, GetEventDetailResData, GetTransactionDetailResData, + GetRuleDetailResData, + GetProceedingDetailResData, } from './types'; -import { EVENT_DETAIL_API, NOTICE_DETAIL_API, TRANSACTION_DETAIL_API } from '.'; +import { + EVENT_DETAIL_API, + NOTICE_DETAIL_API, + PROCEEDING_DETAIL_API, + RULE_DETAIL_API, + TRANSACTION_DETAIL_API, +} from '.'; //학교 공지 detail export const useGetCampusNoticeDetail = ( @@ -68,3 +76,31 @@ export const useGetTransactionDetail = ( ...options, }); }; + +export const useGetProceedingDetail = ( + proceedingId: number, + options?: UseQueryOptions, +) => { + return useQuery({ + queryKey: ['proceedingDetail', proceedingId], + queryFn: async () => { + const data = await PROCEEDING_DETAIL_API.proceedingDetail(proceedingId); + return data; + }, + ...options, + }); +}; + +export const useGetRuleDetail = ( + ruleId: number, + options?: UseQueryOptions, +) => { + return useQuery({ + queryKey: ['ruleDetail', ruleId], + queryFn: async () => { + const data = await RULE_DETAIL_API.ruleDetail(ruleId); + return data; + }, + ...options, + }); +}; diff --git a/src/features/content/model/usePdfDetail.ts b/src/features/content/model/usePdfDetail.ts index f3fc82c..17f45d4 100644 --- a/src/features/content/model/usePdfDetail.ts +++ b/src/features/content/model/usePdfDetail.ts @@ -1,3 +1,5 @@ +import { useGetRuleDetail, useGetProceedingDetail } from '../api/queries'; + const usePdfDetail = () => { //회칙/학칙 detail const returnRuleDetailItem = (organization: string, id: number) => { @@ -49,10 +51,3 @@ const usePdfDetail = () => { }; export default usePdfDetail; -function useGetRuleDetail(id: number): { data: any; isSuccess: any } { - throw new Error('Function not implemented.'); -} - -function useGetProceedingDetail(id: number): { data: any; isSuccess: any } { - throw new Error('Function not implemented.'); -} From c45c6a480b4dded4ec39f038392e55c3a89a7bf8 Mon Sep 17 00:00:00 2001 From: xxxjinn Date: Sun, 18 Aug 2024 03:55:53 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20pdf=20viewer=20-=20pdf=20url=20data?= =?UTF-8?q?=20resopnse=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/features/content/ui/PdfViewerDetailComponent.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/features/content/ui/PdfViewerDetailComponent.tsx b/src/features/content/ui/PdfViewerDetailComponent.tsx index 9a5ee27..00a0a9c 100644 --- a/src/features/content/ui/PdfViewerDetailComponent.tsx +++ b/src/features/content/ui/PdfViewerDetailComponent.tsx @@ -18,9 +18,8 @@ const PdfViewerDetailComponent = ({

- +
-
From 0b6cc0aec37bb095328deeb13d6ef923dd117dbd Mon Sep 17 00:00:00 2001 From: xxxjinn Date: Sun, 18 Aug 2024 14:38:27 +0900 Subject: [PATCH 5/6] =?UTF-8?q?feat:api=20=EC=97=90=EB=9F=AC=20=EC=8B=9C?= =?UTF-8?q?=20404=ED=8E=98=EC=9D=B4=EC=A7=80=EB=A1=9C=20=EB=A6=AC=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EB=A0=89=EC=85=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/api/instance.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/api/instance.ts b/src/shared/api/instance.ts index 8118358..3c6459b 100644 --- a/src/shared/api/instance.ts +++ b/src/shared/api/instance.ts @@ -67,6 +67,6 @@ instance.interceptors.response.use( return; } } - return Promise.reject(error); + window.location.replace('/404'); }, ); From 4f979da7281cce73af9d0e09bba9b8b39d9f28ba Mon Sep 17 00:00:00 2001 From: xxxjinn Date: Sun, 18 Aug 2024 14:55:05 +0900 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=EC=97=90=EB=9F=AC=EC=B2=98=EB=A6=AC?= =?UTF-8?q?=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/api/instance.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/shared/api/instance.ts b/src/shared/api/instance.ts index 3c6459b..fa2dbd1 100644 --- a/src/shared/api/instance.ts +++ b/src/shared/api/instance.ts @@ -67,6 +67,18 @@ instance.interceptors.response.use( return; } } - window.location.replace('/404'); + + if ( + error.config.url.includes('transactions') || + error.config.url.includes('notice') || + error.config.url.includes('meetings') || + error.config.url.includes('faq') || + error.config.url.includes('event') || + error.config.url.includes('rule') || + error.config.url.includes('campusnotice') + ) { + window.location.replace('/404'); + } + return Promise.reject(error); }, );