Skip to content

Commit

Permalink
♻️Refactor - 이미지 경로 변경, 더미 데이터 예외처리 변경 #44
Browse files Browse the repository at this point in the history
  • Loading branch information
bianbbc87 committed May 15, 2024
1 parent fb122e8 commit ff6765f
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import Image from 'next/image';
import { motion } from 'framer-motion';
import { seminarCardVariants } from '@/constants/seminar/seminarCardVariants';
import TranslateImg from '@/svg/seminar/translate_img.png';
import TranslateImg from '@/images/seminar/presenter/presenter_profile_img.png';
import { OpenSeminar } from '@/interfaces/seminar/openSeminar';
import SeminarDetailBannerInform from '../../seminarDetail/banner/SeminarDetailBannerInform';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import React from 'react';
import Image from 'next/image';
import { SeminarThumbnail } from '@/interfaces/seminar/seminarThumbnail';
import TranslateImg from '@/svg/seminar/translate_img.png';
import TranslateImg from '@/images/seminar/translate_img.png';
import { motion } from 'framer-motion';
import { seminarCardVariants } from '@/constants/seminar/seminarCardVariants';
import SeminarDetailBannerInform from './SeminarDetailBannerInform';
Expand Down
30 changes: 18 additions & 12 deletions src/components/seminar/seminarDetail/pdf/SeminarDetailPdf.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,25 @@ const SeminarDetailPdf = ({seminar}:{seminar:SeminarThumbnail}) => {
style={{ transformOrigin: '10% 60%' }}
className="mt-10 p-5 bg-mono_900 rounded-xl"
>
<motion.section
whileHover={{ scale: 1.05, transition: { duration: 0.2 } }}
whileTap={{ scale: 0.8 }}
viewport={{ once: true, amount: 0.9 }}
variants={seminarCardVariants}
style={{ transformOrigin: '10% 60%' }}
className="flex gap-2 cursor-pointer"
>
<PinImg />
<a href={seminar.pdf_url} download={`${seminar.title}_${seminar.date}`} className="B1">
세미나 자료 보기
</a>
{seminar.pdf_url === "" ? (
<p className="B1">
자료가 없습니다.
</p>
):(
<motion.section
whileHover={{ scale: 1.05, transition: { duration: 0.2 } }}
whileTap={{ scale: 0.8 }}
viewport={{ once: true, amount: 0.9 }}
variants={seminarCardVariants}
style={{ transformOrigin: '10% 60%' }}
className="flex gap-2 cursor-pointer"
>
<PinImg />
<a href={seminar.pdf_url} download={`${seminar.title}_${seminar.date}`} className="B1">
세미나 자료 보기
</a>
</motion.section>
)}
</motion.section>
);
};
Expand Down
81 changes: 31 additions & 50 deletions src/constants/seminar/openSeminarData.ts
Original file line number Diff line number Diff line change
@@ -1,78 +1,61 @@
import SeminarThumbnailCardImg from '@/svg/seminar/seminar_thumbnail_card.png';
import PresenterProfileImg from '@/svg/seminar/presenter_profile_img.png';
import SeminarThumbnailCardImg from '@/images/seminar/default_seminar.png';
import OpenSeminarThumbnailCardImg from '@/images/seminar/default_open_seminar.png';
import { OpenSeminar, OpenSeminarDetailSeminar, OpenSeminarInfo } from '@/interfaces/seminar/openSeminar';
import { SeminarThumbnail } from '@/interfaces/seminar/seminarThumbnail';
import { SEMINAR_REVIEWS_DATA } from './seminarReviewData';

export const OPEN_DETAIL_SEMINAR_DATA:SeminarThumbnail [] = [
{
id: '1',
flag: 1,
type: 'Open Seminar',
topic: 'DevTalk',
date: '2023.09.22 (FRI) 19:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
topic: '',
date: '',
location: '동국대학교',
title: `
휴, 하마터면
의사 될 뻔...
`,
description: `
의사를 목표로 공부를 하다가,
프로그래밍을 시작한 과정들을 토대로 개발 공부를 하며 깨달은 것들
`,
seminar_image_url: SeminarThumbnailCardImg.src,
pdf_url: SeminarThumbnailCardImg.src,
},
{
id: '2',
flag: 1,
type: 'Open Seminar',
topic: 'DevTalk',
date: '2023.09.22 (FRI) 19:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
topic: '',
date: '',
location: '동국대학교',
title: `
휴, 하마터면
의사 될 뻔...
`,
description: `
의사를 목표로 공부를 하다가,
프로그래밍을 시작한 과정들을 토대로 개발 공부를 하며 깨달은 것들
`,
seminar_image_url: SeminarThumbnailCardImg.src,
pdf_url: SeminarThumbnailCardImg.src,
},
{
id: '3',
flag: 1,
type: 'Open Seminar',
topic: 'DevTalk',
date: '2023.09.22 (FRI) 19:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
topic: '',
date: '',
location: '동국대학교',
title: `
휴, 하마터면
의사 될 뻔...
`,
description: `
의사를 목표로 공부를 하다가,
프로그래밍을 시작한 과정들을 토대로 개발 공부를 하며 깨달은 것들
`,
seminar_image_url: SeminarThumbnailCardImg.src,
pdf_url: SeminarThumbnailCardImg.src,
},
{
id: '4',
flag: 1,
type: 'Open Seminar',
topic: 'DevTalk',
date: '2023.09.22 (FRI) 19:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
topic: '',
date: '',
location: '동국대학교',
title: `
휴, 하마터면
의사 될 뻔...
`,
description: `
의사를 목표로 공부를 하다가,
프로그래밍을 시작한 과정들을 토대로 개발 공부를 하며 깨달은 것들
`,
seminar_image_url: SeminarThumbnailCardImg.src,
pdf_url: SeminarThumbnailCardImg.src,
Expand All @@ -83,42 +66,42 @@ export const OPEN_SEMINAR_DATA: OpenSeminar[] = [
{
id: '',
flag: 1,
type: 'Open Seminar',
date: '2024.05.16 (THU) 18:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
date: '',
location: '동국대학교',
title: '',
description: `
GDSC DGU의 소속이 아니더라도 기술과 경험을 공유하는 것에 관심이 있는 학생들을 대상으로 진행하는 세미나입니다.
`,
image_url: SeminarThumbnailCardImg.src,
image_url: OpenSeminarThumbnailCardImg.src,
status: true,
seminars: [{id: '1'}, {id: '2'}, {id: '3'}, {id: '4'}],
},
{
id: '',
flag: 1,
type: 'Open Seminar',
date: '2024.05.16 (THU) 18:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
date: '',
location: '동국대학교',
title: '',
description: `
GDSC DGU의 소속이 아니더라도 기술과 경험을 공유하는 것에 관심이 있는 학생들을 대상으로 진행하는 세미나입니다.
`,
image_url: SeminarThumbnailCardImg.src,
image_url: OpenSeminarThumbnailCardImg.src,
status: false,
seminars: [{id: '1'}, {id: '2'}, {id: '3'}, {id: '4'}],
},
{
id: '',
flag: 1,
type: 'Open Seminar',
date: '2024.05.16 (THU) 18:30',
location: '동국대학교 원흥관 PBL',
type: '🌲 Open Seminar',
date: '',
location: '동국대학교',
title: '',
description: `
GDSC DGU의 소속이 아니더라도 기술과 경험을 공유하는 것에 관심이 있는 학생들을 대상으로 진행하는 세미나입니다.
`,
image_url: SeminarThumbnailCardImg.src,
image_url: OpenSeminarThumbnailCardImg.src,
status: false,
seminars: [{id: '1'}, {id: '2'}, {id: '3'}, {id: '4'}],
},
Expand All @@ -127,9 +110,7 @@ export const OPEN_SEMINAR_DATA: OpenSeminar[] = [
export const OPEN_SEMINAR_INFO_DATA: OpenSeminarInfo = {
id: 1,
open_seminar_id: '',
information: `
CONG(콩) : 축하 아카이빙 서비스<br><br>CONG은 왜 필요할까?<br><br>Unlearn Point 1️⃣ : 좋은 일이라도 나서서 축하해달라고 요청하는 것은 왠지 눈치보여 ...<br>Unlearn Point 2️⃣ : 축하는 대단한 일이어야만 받을 수 있겠지?<br>축하의 문제점 : 온/오프라인으로 축하받은 내용이 쉽게 휘발된다. <br>🥲 졸전 포스트잇들이 자꾸 떨어져..<br>간직하고 싶은데 <br>아쉬워요. <br>🥲 구두로 축하를 받거나, 내가 자리에 없을 때 누가 온지 파악이 힘들어요.<br>🥲 졸전 포스트잇 집에 들고 갔는데 지금은 어디에 있는지 몰라요.<br><br>작은 일이라도 좋은 일이 생겼을 때, <br>내가 먼저 🙌🏻 축하해달라고 하면?<br>이렇게 받은 축하를 오래 간직할 수 있다면? 📁<br><br>'CONG'을 통해 축하받고 싶은 일을 알리고 축하 노트를 받아요! <br>축하의 순간, 사라지지 않게 콩
`
information: ``
}

export const OPEN_SEMINAR_DETAIL_SEMINAR_DATA: OpenSeminarDetailSeminar[] = [
Expand Down
24 changes: 8 additions & 16 deletions src/constants/seminar/seminarData.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import SeminarThumbnailCardImg from '@/svg/seminar/seminar_thumbnail_card.png';
import SeminarThumbnailCardImg from '@/images/seminar/default_seminar.png';
import { SeminarThumbnail } from '@/interfaces/seminar/seminarThumbnail';

export const SEMINAR_NONE_DATA: SeminarThumbnail[] = [
{
id: '1',
flag: 1,
type: 'Camping Seminar',
topic: 'DevTalk',
type: '🏕️ Camping Seminar',
topic: '',
date: '',
location: '동국대학교 원흥관 PBL',
location: '동국대학교',
title: `
휴, 하마터면
의사 될 뻔...
`,
description: `
의사를 목표로 공부를 하다가,
프로그래밍을 시작한 과정들을 토대로 개발 공부를 하며 깨달은 것들
`,
seminar_image_url: '',
pdf_url: SeminarThumbnailCardImg.src,
Expand All @@ -26,17 +22,13 @@ export const SEMINAR_DATA: SeminarThumbnail[] = [
{
id: '1',
flag: 1,
type: 'Camping Seminar',
topic: 'DevTalk',
date: '2023.09.22 (FRI) 19:30',
location: '동국대학교 원흥관 PBL',
type: '🏕️ Camping Seminar',
topic: '',
date: '',
location: '동국대학교',
title: `
휴, 하마터면
의사 될 뻔...
`,
description: `
의사를 목표로 공부를 하다가,
프로그래밍을 시작한 과정들을 토대로 개발 공부를 하며 깨달은 것들
`,
seminar_image_url: SeminarThumbnailCardImg.src,
pdf_url: SeminarThumbnailCardImg.src,
Expand Down
2 changes: 1 addition & 1 deletion src/constants/seminar/seminarMemberData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SeminarMember } from "@/interfaces/seminar/seminarMember";
import PresenterProfileImg from '@/svg/seminar/presenter_profile_img.png';
import PresenterProfileImg from '@/images/seminar/presenter/presenter_profile_img.png';

export const SEMINAR_MEMBER_DATA: SeminarMember = {
id: 1,
Expand Down
28 changes: 2 additions & 26 deletions src/constants/seminar/seminarReviewData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,8 @@ export const SEMINAR_REVIEWS_DATA: SeminarReview[][] = [
{
id: 1,
seminar_id: '',
author: '서희찬',
content:'리뷰입니다.',
},
{
id: 2,
seminar_id: '',
author: '서희찬',
content:'리뷰입니다.',
},
{
id: 3,
seminar_id: '',
author: '서희찬',
content:'리뷰입니다.',
},
{
id: 4,
seminar_id: '',
author: '서희찬',
content:'리뷰입니다.',
},
{
id: 5,
seminar_id: '',
author: '서희찬',
content:'리뷰입니다.',
author: '',
content:'',
},
],
[
Expand Down
19 changes: 10 additions & 9 deletions src/hooks/seminar/notionDataRefactor.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { SeminarMember } from "@/interfaces/seminar/seminarMember";
import { SeminarReview } from "@/interfaces/seminar/seminarReview";
import { SeminarThumbnail } from "@/interfaces/seminar/seminarThumbnail";
import SeminarThumbnailCardImg from '@/svg/seminar/seminar_thumbnail_card.png';
import PresenterProfileImg from '@/svg/seminar/presenter_profile_img.png';
import SeminarThumbnailCardImg from '@/images/seminar/default_seminar.png';
import OpenSeminarThumbnailCardImg from '@/images/seminar/default_open_seminar.png';
import PresenterProfileImg from '@/images/seminar/presenter/presenter_profile_img.png';
import { OpenSeminar, OpenSeminarDetailSeminar, Relation } from "@/interfaces/seminar/openSeminar";

// seminar data
Expand All @@ -11,13 +12,13 @@ export function refactorSeminarData(items: any[]): SeminarThumbnail[] {
id: item.id ?? '',
flag: 1,
type: item.properties.Tags?.multi_select[0]?.name ?? 'Unknown',
topic: item.properties.Topic?.select?.name ?? 'all',
topic: item.properties.Topic?.select?.name ?? 'Unknown',
date: item.properties.Date?.date?.start ?? 'Unknown Date',
location: item.properties.Location?.rich_text[0]?.plain_text ?? 'No Location',
location: item.properties.Location?.rich_text[0]?.plain_text ?? '동국대학교',
title: item.properties.Name?.title[0]?.plain_text ?? 'Unknown Title',
description: item.properties.Description?.rich_text[0]?.plain_text ?? 'No Description',
description: item.properties.Description?.rich_text[0]?.plain_text ?? '',
seminar_image_url: item.cover?.file?.url ?? SeminarThumbnailCardImg.src,
pdf_url: item.properties['Files & media']?.files[0]?.file?.url ?? PresenterProfileImg.src, // 임시 pdf 데이터
pdf_url: item.properties['Files & media']?.files[0]?.file?.url ?? "", // 임시 pdf 데이터
}));
}

Expand All @@ -28,10 +29,10 @@ export function refactorOpenSeminarData(items: any[]): OpenSeminar[] {
flag: 1,
type: item.properties['다중 선택'].multi_select[0]?.name ?? 'Unknown',
date: item.properties.Date?.date?.start ?? 'Unknown Date',
location: item.properties.Location?.rich_text[0]?.plain_text ?? 'No Location', // static value as per example
location: item.properties.Location?.rich_text[0]?.plain_text ?? '동국대학교', // static value as per example
title: item.properties['이름']?.title[0]?.plain_text ?? 'Unknown Title',
description: item.properties.Description?.rich_text[0]?.plain_text ?? 'No Description',
image_url: item.cover?.file?.url ?? SeminarThumbnailCardImg.src,
description: item.properties.Description?.rich_text[0]?.plain_text ?? '',
image_url: item.cover?.file?.url ?? OpenSeminarThumbnailCardImg.src,
status: (item.properties.status?.status?.name === "종료" ? false : true) ?? false,
seminars: item.properties.Seminars?.relation ?? [{id: '1'}, {id: '2'}, {id: '3'}, {id: '4'}],
}));
Expand Down

0 comments on commit ff6765f

Please sign in to comment.