diff --git a/postcss.config.js b/postcss.config.js index d42d40e..d8820f5 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,30 +1,31 @@ -const colours = require('./src/styles/config/colours.cjs') -const variables = require('./src/styles/config/variables.cjs'); +const colours = require(`./src/styles/config/colours.cjs`); +const variables = require(`./src/styles/config/variables.cjs`); module.exports = { plugins: [ [ - 'postcss-advanced-variables', + `postcss-advanced-variables`, { variables: { ...colours, - ...variables + ...variables, }, - } + }, ], - 'postcss-hexrgba', + `postcss-hexrgba`, [ - 'postcss-nesting', + `postcss-nesting`, { - noIsPseudoSelector: true - } + noIsPseudoSelector: true, + }, ], [ - 'stylelint', + `stylelint`, { configFile: `./config/stylelint.config.cjs`, - fix: true - } - ] + fix: true, + quiet: true, + }, + ], ], -}; \ No newline at end of file +}; diff --git a/src/types/runsheet.d.ts b/src/types/runsheet.d.ts index 96c4a14..51dc68e 100644 --- a/src/types/runsheet.d.ts +++ b/src/types/runsheet.d.ts @@ -24,9 +24,13 @@ export type NotionRunsheetEvent = { } Guests: { rollup: { - array: { - id: string - }[] + array: [ + { + relation: { + id: string + }[] + } + ] } } GuestIds: { diff --git a/utils/formatRunsheet.ts b/utils/formatRunsheet.ts index c3e0cf6..59eff40 100644 --- a/utils/formatRunsheet.ts +++ b/utils/formatRunsheet.ts @@ -64,6 +64,8 @@ const formatRunsheet = (props: formatRunsheetProps) => const { sheets, events, guestName, type } = props let formattedEvents: RunsheetData = {} + console.log({sheets, events}) + sheets?.forEach(({ id, name }) => { formattedEvents[id.replaceAll('-', '')] = { @@ -92,6 +94,27 @@ const formatRunsheet = (props: formatRunsheetProps) => formattedEvents[id].eventIds?.push(event.id) } }) + + event.properties.Guests.rollup.array + .map(array => array.relation + .map(({ id }) => id) + .join(',') + ).join(',') + .replaceAll('-', '') + .split(',') + .filter((value, index, self) => self.indexOf(value) === index) + .forEach((id: string) => + { + if ( + formattedEvents?.[id] + && formattedEvents[id].eventIds + && !formattedEvents[id].eventIds?.includes(event.id) + ) + { + formattedEvents[id].events.push(eventData) + formattedEvents[id].eventIds?.push(event.id) + } + }) } else if (type === 'vendor') {