@@ -9,10 +9,15 @@ import styles from './argentina.module.scss'
99import Oblisk from '../../public/scroll-video/Oblisk_4K0125.webp'
1010import cn from 'classnames'
1111import NewSchedule from 'lib/components/event-schedule-new'
12+ import { formatResult } from 'lib/helpers/notion-normalizer'
13+ // import dateFns from 'date-fns'
14+ import moment from 'moment'
1215
13- const Argentina = ( ) => {
16+ const Argentina = ( props : any ) => {
1417 const { selectedEvent, selectedDay, setSelectedEvent, setSelectedDay } = useCalendarStore ( )
1518
19+ console . log ( props . events )
20+
1621 return (
1722 < >
1823 < Header active />
@@ -37,8 +42,8 @@ const Argentina = () => {
3742 </ div >
3843 < div className = "flex flex-col gap-4 text-black" >
3944 < div className = "section my-1 mb-8" >
40- < div className = "flex justify-between gap-4 items-end" > </ div >
4145 < NewSchedule
46+ events = { props . events }
4247 selectedEvent = { selectedEvent }
4348 selectedDay = { selectedDay }
4449 setSelectedEvent = { setSelectedEvent }
@@ -57,45 +62,104 @@ export async function getStaticProps({ locale }: { locale: string }) {
5762 const translationPath = locale === 'en' ? 'global.json' : locale + '/global.json'
5863 const translations = await client . queries . global_translations ( { relativePath : translationPath } )
5964
60- // https:// www.notion.so/ef-events/1f5638cdc41580be9117f4963f021d8b?v=1f5638cdc415816c9277000ccc6cda85&pvs=4
65+ //www.notion.so/ef-events/1f5638cdc41580be9117f4963f021d8b?v=1f5638cdc415816c9277000ccc6cda85&pvs=4
6166
6267 const notion = new Client ( {
6368 auth : process . env . NOTION_SECRET ,
6469 } )
6570
6671 const query = {
6772 database_id : '1f5638cdc41580be9117f4963f021d8b' ,
68- sorts : [
69- {
70- property : '[HOST] Event Date' ,
71- direction : 'ascending' ,
72- } ,
73- {
74- property : '[WEB] Priority (sort)' ,
75- direction : 'descending' ,
76- } ,
77- ] ,
78- filter : {
79- and : [
80- {
81- property : '[HOST] Event Date' ,
82- date : {
83- is_not_empty : true ,
84- } ,
85- } ,
86- {
87- property : '[WEB] Live' ,
88- checkbox : {
89- equals : true ,
90- } ,
91- } ,
92- ] ,
93- } ,
73+ // sorts: [
74+ // {
75+ // property: '[HOST] Event Date',
76+ // direction: 'ascending',
77+ // },
78+ // {
79+ // property: '[WEB] Priority (sort)',
80+ // direction: 'descending',
81+ // },
82+ // ],
83+ // filter: {
84+ // and: [
85+ // {
86+ // property: '[HOST] Event Date',
87+ // date: {
88+ // is_not_empty: true,
89+ // },
90+ // },
91+ // {
92+ // property: '[WEB] Live',
93+ // checkbox: {
94+ // equals: true,
95+ // },
96+ // },
97+ // ],
98+ // },
9499 }
95100
96- const events = await notion . databases . query ( query as any )
101+ const notionEvents = await notion . databases . query ( query as any )
102+
103+ /*
104+ export interface Event {
105+ id: string;
106+ name: string;
107+ isFairEvent?: boolean;
108+ isCoreEvent?: boolean;
109+ description: string;
110+ organizer: string;
111+ difficulty: string;
112+ amountPeople?: string;
113+ location: {
114+ url: string;
115+ text: string;
116+ coordinates?: {
117+ lat: number;
118+ lng: number;
119+ };
120+ };
121+ timeblocks: {
122+ start: string;
123+ end: string;
124+ name?: string;
125+ location?: string;
126+ }[];
127+ priority: number;
128+ categories: string[];
129+ }
130+
131+ */
132+
133+ // console.log(notionEvents)
134+
135+ const events = notionEvents . results
136+ . map ( event => {
137+ const formattedEvent = formatResult ( event )
138+
139+ const startDate = moment ( '2025-11-17T09:00:00Z' ) . add ( Math . floor ( Math . random ( ) * 6 ) , 'days' )
140+
141+ return {
142+ id : event . id ,
143+ name : formattedEvent [ 'Event name' ] ,
144+ description : formattedEvent [ 'Description' ] || '' ,
145+ capacity : formattedEvent [ 'Capacity' ] ,
146+ size : formattedEvent [ 'Size' ] ,
147+ location : formattedEvent [ 'Location' ] || { text : 'TBD' , url : '' } ,
148+ timeblocks : [
149+ {
150+ start : startDate . format ( 'YYYY-MM-DDTHH:mm:ss[Z]' ) ,
151+ end : startDate . clone ( ) . add ( 4 , 'hours' ) . format ( 'YYYY-MM-DDTHH:mm:ss[Z]' ) ,
152+ } ,
153+ ] ,
154+ difficulty : 'Beginner' ,
155+ }
156+ } )
157+ . sort ( ( a , b ) => moment ( a . timeblocks [ 0 ] . start ) . valueOf ( ) - moment ( b . timeblocks [ 0 ] . start ) . valueOf ( ) )
97158
98- console . log ( events )
159+ // @ts -ignore
160+ events [ 0 ] . isFairEvent = true
161+ // @ts -ignore
162+ events [ 1 ] . isCoreEvent = true
99163
100164 return {
101165 props : {
0 commit comments