Skip to content

Commit

Permalink
♻️Refactor - 오픈세미나 flag 데이터 notion db로 변경 #44
Browse files Browse the repository at this point in the history
  • Loading branch information
bianbbc87 committed May 15, 2024
1 parent f3012c3 commit d4111df
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import React, { useState } from 'react';
* @returns The rendered header component.
*/
const OpenSeminarDetailHeader = ({ openSeminar }: { openSeminar: OpenSeminar }) => {
const [categoryData, setCategoryData] = useState([openSeminar.type, `${openSeminar.flag}st`]);
const [categoryData, setCategoryData] = useState([openSeminar.type, openSeminar.flag]);

return (
<>
Expand Down
20 changes: 10 additions & 10 deletions src/constants/seminar/openSeminarData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const OPEN_DETAIL_SEMINAR_DATA:SeminarThumbnail [] = [
{
id: '1',
flag: 1,
type: '🌲 Open Seminar',
type: 'Open Seminar',
topic: '',
date: '',
location: '동국대학교',
Expand All @@ -21,7 +21,7 @@ export const OPEN_DETAIL_SEMINAR_DATA:SeminarThumbnail [] = [
{
id: '2',
flag: 1,
type: '🌲 Open Seminar',
type: 'Open Seminar',
topic: '',
date: '',
location: '동국대학교',
Expand All @@ -35,7 +35,7 @@ export const OPEN_DETAIL_SEMINAR_DATA:SeminarThumbnail [] = [
{
id: '3',
flag: 1,
type: '🌲 Open Seminar',
type: 'Open Seminar',
topic: '',
date: '',
location: '동국대학교',
Expand All @@ -49,7 +49,7 @@ export const OPEN_DETAIL_SEMINAR_DATA:SeminarThumbnail [] = [
{
id: '4',
flag: 1,
type: '🌲 Open Seminar',
type: 'Open Seminar',
topic: '',
date: '',
location: '동국대학교',
Expand All @@ -65,8 +65,8 @@ export const OPEN_DETAIL_SEMINAR_DATA:SeminarThumbnail [] = [
export const OPEN_SEMINAR_DATA: OpenSeminar[] = [
{
id: '',
flag: 1,
type: '🌲 Open Seminar',
flag: '1st',
type: 'Open Seminar',
date: '',
location: '동국대학교',
title: '',
Expand All @@ -79,8 +79,8 @@ export const OPEN_SEMINAR_DATA: OpenSeminar[] = [
},
{
id: '',
flag: 1,
type: '🌲 Open Seminar',
flag: '1st',
type: 'Open Seminar',
date: '',
location: '동국대학교',
title: '',
Expand All @@ -93,8 +93,8 @@ export const OPEN_SEMINAR_DATA: OpenSeminar[] = [
},
{
id: '',
flag: 1,
type: '🌲 Open Seminar',
flag: '1st',
type: 'Open Seminar',
date: '',
location: '동국대학교',
title: '',
Expand Down
28 changes: 14 additions & 14 deletions src/hooks/seminar/notionDataRefactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ export function refactorSeminarData(items: any[]): SeminarThumbnail[] {
return items.map(item => ({
id: item.id ?? '',
flag: 1,
type: item.properties.Tags?.multi_select[0]?.name ?? 'Unknown',
topic: item.properties.Topic?.select?.name ?? 'Unknown',
date: item.properties.Date?.date?.start ?? 'Unknown Date',
type: item.properties.Tags?.multi_select[0]?.name ?? '',
topic: item.properties.Topic?.select?.name ?? '',
date: item.properties.Date?.date?.start ?? '',
location: item.properties.Location?.rich_text[0]?.plain_text ?? '동국대학교',
title: item.properties.Name?.title[0]?.plain_text ?? 'Unknown Title',
title: item.properties.Name?.title[0]?.plain_text ?? '',
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 ?? "", // 임시 pdf 데이터
Expand All @@ -26,11 +26,11 @@ export function refactorSeminarData(items: any[]): SeminarThumbnail[] {
export function refactorOpenSeminarData(items: any[]): OpenSeminar[] {
return items.map(item => ({
id: item.id ?? '',
flag: 1,
type: item.properties['다중 선택'].multi_select[0]?.name ?? 'Unknown',
date: item.properties.Date?.date?.start ?? 'Unknown Date',
flag: item.properties['다중 선택'].multi_select[1]?.name ?? '',
type: item.properties['다중 선택'].multi_select[0]?.name ?? '',
date: item.properties.Date?.date?.start ?? '',
location: item.properties.Location?.rich_text[0]?.plain_text ?? '동국대학교', // static value as per example
title: item.properties['이름']?.title[0]?.plain_text ?? 'Unknown Title',
title: item.properties['이름']?.title[0]?.plain_text ?? '',
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,
Expand All @@ -54,8 +54,8 @@ export function refactorOpenSeminarInformationData(items: any[]): SeminarThumbna
return items.map(item => ({
id: item.id ?? '',
seminar_id: item.properties.Seminar.relation[0]?.id ?? '',
author: item.properties.name?.title[0]?.plain_text ?? 'Unknown',
content: item.properties.Review.rich_text[0]?.plain_text ?? 'No Review'
author: item.properties.name?.title[0]?.plain_text ?? '',
content: item.properties.Review.rich_text[0]?.plain_text ?? ''
}));
}

Expand All @@ -64,8 +64,8 @@ export function refactorOpenSeminarInformationData(items: any[]): SeminarThumbna
return {
id: item.id ?? 'Unknown',
seminar_id: id ?? 'Unknown',
name: item.properties['이름']?.title[0]?.plain_text ?? 'Unknown',
role: item.properties.Part?.multi_select[0]?.name ?? 'Unknown',
name: item.properties['이름']?.title[0]?.plain_text ?? '',
role: item.properties.Part?.multi_select[0]?.name ?? '',
profile_img: item.properties.ProfileImage?.url ?? PresenterProfileImg.src,
};
}
Expand All @@ -76,8 +76,8 @@ export function refactorOpenSeminarInformationData(items: any[]): SeminarThumbna
id: seminar.id,
seminar_id: seminar.id,
member_id: member.id ?? '',
member_name: member.name ?? 'Unknown',
member_role: member.role ?? 'Unknown',
member_name: member.name ?? '',
member_role: member.role ?? '',
member_profile_image: member.profileImage ?? PresenterProfileImg.src,
seminar_title: seminar.title,
};
Expand Down
2 changes: 1 addition & 1 deletion src/interfaces/seminar/openSeminar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { SeminarThumbnail } from "./seminarThumbnail";

export interface OpenSeminar {
id: string;
flag: number;
flag: string;
type: string;
date: string;
location: string;
Expand Down

0 comments on commit d4111df

Please sign in to comment.