@@ -25,7 +28,7 @@ const OpenSeminarDetailSeminars = ({ data }: { data: OpenSeminar }) => {
- {data.seminars.map((seminar, index) => (
+ {detailSeminars.map((seminar) => (
{
className="w-full"
>
diff --git a/src/components/seminar/openSeminarDetail/kindOfSeminar/OpenSeminarsDetailBox.tsx b/src/components/seminar/openSeminarDetail/kindOfSeminar/OpenSeminarsDetailBox.tsx
index ca563e9..c5de192 100644
--- a/src/components/seminar/openSeminarDetail/kindOfSeminar/OpenSeminarsDetailBox.tsx
+++ b/src/components/seminar/openSeminarDetail/kindOfSeminar/OpenSeminarsDetailBox.tsx
@@ -1,3 +1,5 @@
+import { OpenSeminarDetailSeminar } from '@/interfaces/seminar/openSeminar';
+import { SeminarMember } from '@/interfaces/seminar/seminarMember';
import { SeminarThumbnail } from '@/interfaces/seminar/seminarThumbnail';
import Image from 'next/image';
import React from 'react';
@@ -13,25 +15,24 @@ import React from 'react';
* Renders the header component for the recruitment section.
* @returns The rendered header component.
*/
-const OpenSeminarsDetailBox = ({ data }: { data: SeminarThumbnail }) => {
+const OpenSeminarsDetailBox = ({ seminar }: { seminar:OpenSeminarDetailSeminar }) => {
return (
- {data.presenter_name}
{data.presenter_role}
+ {seminar.member_name}
{seminar.member_role}
-
{data.title}
+
{seminar.seminar_title}
);
diff --git a/src/hooks/seminar/changePathtoNumber.ts b/src/hooks/seminar/changePathtoNumber.ts
index 0e609cb..cc33a9e 100644
--- a/src/hooks/seminar/changePathtoNumber.ts
+++ b/src/hooks/seminar/changePathtoNumber.ts
@@ -1,8 +1,8 @@
// path 'seminar/${seminar.id} 중 seminar.id만 반환
-export const changePathtoSeperate = (pathname: string) => {
+export const changePathtoSeperate = (pathname: string, value: string) => {
// URL에서 '/seminar/' 다음에 오는 부분을 추출하여 직접 반환
- const basePath = '/seminar/';
+ const basePath = `/${value}/`;
const start = pathname.indexOf(basePath) + basePath.length;
const seminarId = pathname.substring(start); // 이 부분이 바로 seminarId
diff --git a/src/hooks/seminar/notionDataRefactor.ts b/src/hooks/seminar/notionDataRefactor.ts
index 235bec8..2d17a6c 100644
--- a/src/hooks/seminar/notionDataRefactor.ts
+++ b/src/hooks/seminar/notionDataRefactor.ts
@@ -3,23 +3,51 @@ 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 { OpenSeminar, OpenSeminarDetailSeminar, Relation } from "@/interfaces/seminar/openSeminar";
// seminar data
export function refactorSeminarData(items: any[]): SeminarThumbnail[] {
return items.map(item => ({
- id: item.id,
+ id: item.id ?? '',
flag: 1,
type: item.properties.Tags?.multi_select[0]?.name ?? 'Unknown',
- topic: item.properties.Topic?.select?.name ?? 'all', // static value as per example
+ topic: item.properties.Topic?.select?.name ?? 'all',
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 ?? 'No Location',
title: item.properties.Name?.title[0]?.plain_text ?? 'Unknown Title',
- description: item.properties.Description?.rich_text[0]?.plain_text ?? 'No Description', // static value as per example
+ description: item.properties.Description?.rich_text[0]?.plain_text ?? 'No Description',
seminar_image_url: item.cover?.file?.url ?? SeminarThumbnailCardImg.src,
pdf_url: item.properties['Files & media']?.files[0]?.file?.url ?? PresenterProfileImg.src, // 임시 pdf 데이터
}));
}
+ // open seminar data
+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',
+ location: item.properties.Location?.rich_text[0]?.plain_text ?? 'No Location', // 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,
+ status: (item.properties.status?.status?.name === "종료" ? false : true) ?? false,
+ seminars: item.properties.Seminars?.relation ?? [{id: '1'}, {id: '2'}, {id: '3'}, {id: '4'}],
+ }));
+}
+
+/*
+export function refactorOpenSeminarInformationData(items: any[]): SeminarThumbnail[] {
+ return items.map(item => ({
+ id: item.id,
+ open_seminar_id:
+ information:
+ }));
+}
+*/
+
+
// seminar review data
export function refactorSeminarReviewData(items: any[]): SeminarReview[] {
return items.map(item => ({
@@ -30,14 +58,33 @@ export function refactorSeminarData(items: any[]): SeminarThumbnail[] {
}));
}
- // seminar review data
- export function refactorSeminarMemberData(item: any): SeminarMember {
+ // seminar member data
+ export function refactorSeminarMemberData(item: any, id:string): SeminarMember {
return {
id: item.id ?? 'Unknown',
- seminar_id: item.properties.Seminars?.relation[0]?.id ?? 'Unknown',
+ seminar_id: id ?? 'Unknown',
name: item.properties['이름']?.title[0]?.plain_text ?? 'Unknown',
role: item.properties.Part?.multi_select[0]?.name ?? 'Unknown',
profile_img: item.properties.ProfileImage?.url ?? PresenterProfileImg.src,
};
}
-
\ No newline at end of file
+
+ // seminar review data
+ export function refactorOpenSeminarDetailSeminarsData(seminar: any, member: any): OpenSeminarDetailSeminar {
+ return {
+ id: seminar.id,
+ seminar_id: seminar.id,
+ member_id: member.id ?? '',
+ member_name: member.name ?? 'Unknown',
+ member_role: member.role ?? 'Unknown',
+ member_profile_image: member.profileImage ?? PresenterProfileImg.src,
+ seminar_title: seminar.title,
+ };
+ }
+
+
+ // open seminar ids로 seminar 데이터 반환
+export function findSeminarsByIds(seminars: SeminarThumbnail[], ids: Relation[]): SeminarThumbnail[] {
+ const idList = ids.map(relation => relation.id);
+ return seminars.filter(seminar => idList.includes(seminar.id));
+}
\ No newline at end of file
diff --git a/src/interfaces/seminar/openSeminar.ts b/src/interfaces/seminar/openSeminar.ts
index 7150757..3473a37 100644
--- a/src/interfaces/seminar/openSeminar.ts
+++ b/src/interfaces/seminar/openSeminar.ts
@@ -1,15 +1,34 @@
import { SeminarThumbnail } from "./seminarThumbnail";
export interface OpenSeminar {
- id: number;
+ id: string;
flag: number;
type: string;
- seminar_opening_date: string;
- seminar_month_date: string;
+ date: string;
location: string;
+ title: string,
description: string;
- information: string;
image_url: string;
status: boolean;
- seminars: SeminarThumbnail[];
+ seminars: Relation[];
+}
+
+export interface OpenSeminarInfo {
+ id: number;
+ open_seminar_id: string;
+ information: string;
+}
+
+export interface Relation {
+ id: string;
+}
+
+export interface OpenSeminarDetailSeminar {
+ id: number;
+ seminar_id: string;
+ member_id: string;
+ member_name: string;
+ member_role: string;
+ member_profile_image: string;
+ seminar_title: string;
}
\ No newline at end of file