diff --git a/src/seed/assets/attend-events.svg b/src/seed/assets/attend-events.svg new file mode 100644 index 0000000..c4cf422 --- /dev/null +++ b/src/seed/assets/attend-events.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/seed/assets/carousel-1.png b/src/seed/assets/carousel-1.png new file mode 100644 index 0000000..8a879f9 Binary files /dev/null and b/src/seed/assets/carousel-1.png differ diff --git a/src/seed/assets/carousel-2.png b/src/seed/assets/carousel-2.png new file mode 100644 index 0000000..26355ce Binary files /dev/null and b/src/seed/assets/carousel-2.png differ diff --git a/src/seed/assets/carousel-3.png b/src/seed/assets/carousel-3.png new file mode 100644 index 0000000..7f18b16 Binary files /dev/null and b/src/seed/assets/carousel-3.png differ diff --git a/src/seed/assets/carousel-4.png b/src/seed/assets/carousel-4.png new file mode 100644 index 0000000..cd2ab9f Binary files /dev/null and b/src/seed/assets/carousel-4.png differ diff --git a/src/seed/assets/give-a-talk.svg b/src/seed/assets/give-a-talk.svg new file mode 100644 index 0000000..e3b4145 --- /dev/null +++ b/src/seed/assets/give-a-talk.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/seed/assets/join-our-community.svg b/src/seed/assets/join-our-community.svg new file mode 100644 index 0000000..00e2872 --- /dev/null +++ b/src/seed/assets/join-our-community.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/seed/default/collections/Media.ts b/src/seed/default/collections/Media.ts index d8fdb7a..789b03c 100644 --- a/src/seed/default/collections/Media.ts +++ b/src/seed/default/collections/Media.ts @@ -3,23 +3,40 @@ import path from 'path' import { Payload, PayloadRequest } from 'payload' import { COLLECTIONS } from '@/constants/collections' +const mediaAssets = [ + { fileName: 'durianpy-logo.png', alt: 'DurianPy Logo', mimetype: 'image/png' }, + { fileName: 'carousel-1.png', alt: 'PyConf 2024', mimetype: 'image/png' }, + { fileName: 'carousel-2.png', alt: 'Meetup #1', mimetype: 'image/png' }, + { fileName: 'carousel-3.png', alt: 'Meetup #2', mimetype: 'image/png' }, + { fileName: 'carousel-4.png', alt: 'Meetup #3', mimetype: 'image/png' }, + { fileName: 'join-our-community.svg', alt: 'Join Our Community', mimetype: 'image/svg+xml' }, + { fileName: 'attend-events.svg', alt: 'Attend Events', mimetype: 'image/svg+xml' }, + { fileName: 'give-a-talk.svg', alt: 'Give a Talk', mimetype: 'image/svg+xml' }, +] + export async function seedMedia({ payload, req }: { payload: Payload; req?: PayloadRequest }) { - const imagePath = path.resolve(process.cwd(), 'src/seed/assets/durianpy-logo.png') - const imageBuffer = fs.readFileSync(imagePath) + const createdMedia = await Promise.all( + mediaAssets.map(async (asset) => { + const assetPath = path.resolve(process.cwd(), `src/seed/assets/${asset.fileName}`) + if (!fs.existsSync(assetPath)) return null + + const imageBuffer = fs.readFileSync(assetPath) - const mediaItem = await payload.create({ - collection: COLLECTIONS.MEDIA, - data: { - alt: 'DurianPy Logo', - }, - file: { - data: imageBuffer, - name: 'durianpy-logo.png', - mimetype: 'image/png', - size: imageBuffer.length, - }, - req, - }) + return payload.create({ + collection: COLLECTIONS.MEDIA, + data: { + alt: asset.alt, + }, + file: { + data: imageBuffer, + name: asset.fileName, + mimetype: asset.mimetype, + size: imageBuffer.length, + }, + req, + }) + }), + ) - return [mediaItem] + return createdMedia.filter(Boolean) } diff --git a/src/seed/durianpy-website/globals/CTASection.ts b/src/seed/durianpy-website/globals/CTASection.ts index d9c62c2..1d63ffd 100644 --- a/src/seed/durianpy-website/globals/CTASection.ts +++ b/src/seed/durianpy-website/globals/CTASection.ts @@ -1,32 +1,56 @@ import { Payload, PayloadRequest } from 'payload' +import { COLLECTIONS } from '@/constants/collections' import { GLOBALS } from '@/constants/globals' export async function seedCTASection({ payload, req }: { payload: Payload; req?: PayloadRequest }) { - const { docs: mediaDocs } = await payload.find({ - collection: 'media', + const { docs: joinDocs } = await payload.find({ + collection: COLLECTIONS.MEDIA, + where: { alt: { equals: 'Join Our Community' } }, limit: 1, req, }) - const mediaId = mediaDocs[0]?.id + const { docs: attendDocs } = await payload.find({ + collection: COLLECTIONS.MEDIA, + where: { alt: { equals: 'Attend Events' } }, + limit: 1, + req, + }) + const { docs: giveTalkDocs } = await payload.find({ + collection: COLLECTIONS.MEDIA, + where: { alt: { equals: 'Give a Talk' } }, + limit: 1, + req, + }) + + const joinIcon = joinDocs[0]?.id + const attendIcon = attendDocs[0]?.id + const giveTalkIcon = giveTalkDocs[0]?.id await payload.updateGlobal({ slug: GLOBALS.DURIANPY_WEBSITE_CTA_SECTION, data: { cards: [ { - link: 'https://durianpy.org/join', - whiteText: 'Join our', + link: 'https://www.meetup.com/durianpy/', + whiteText: 'Join Our', yellowText: 'Community', - icon: mediaId, + icon: joinIcon, }, { - link: 'https://durianpy.org/sponsor', - whiteText: 'Become a', - yellowText: 'Sponsor', - icon: mediaId, + link: 'https://www.meetup.com/durianpy/events/', + whiteText: 'Attend', + yellowText: 'Events', + icon: attendIcon, + }, + { + link: 'https://forms.gle/x2cc6CrRhbhDeaxe9', + whiteText: 'Give a', + yellowText: 'Talk', + icon: giveTalkIcon, }, ], _status: 'published', }, + req, }) } diff --git a/src/seed/durianpy-website/globals/Carousel.ts b/src/seed/durianpy-website/globals/Carousel.ts index bff06e9..7f138d6 100644 --- a/src/seed/durianpy-website/globals/Carousel.ts +++ b/src/seed/durianpy-website/globals/Carousel.ts @@ -1,21 +1,33 @@ import { Payload, PayloadRequest } from 'payload' +import { COLLECTIONS } from '@/constants/collections' import { GLOBALS } from '@/constants/globals' export async function seedCarousel({ payload, req }: { payload: Payload; req?: PayloadRequest }) { - const { docs: mediaDocs } = await payload.find({ - collection: 'media', - limit: 1, + const { docs: carouselMedia } = await payload.find({ + collection: COLLECTIONS.MEDIA, + where: { + or: [ + { alt: { equals: 'PyConf 2024' } }, + { alt: { equals: 'Meetup #1' } }, + { alt: { equals: 'Meetup #2' } }, + { alt: { equals: 'Meetup #3' } }, + ], + }, + sort: 'createdAt', + limit: 10, req, }) - const mediaId = mediaDocs[0]?.id + + const photos = carouselMedia.map((media) => ({ image: media.id })) await payload.updateGlobal({ slug: GLOBALS.DURIANPY_WEBSITE_CAROUSEL, data: { - title: 'Our Community', - subtitle: 'See what we are up to in Davao', - photos: [{ image: mediaId }, { image: mediaId }], + title: 'Davao Python Community', + subtitle: 'where Pythonistas and enthusiasts gather to discuss trends and share knowledge', + photos: photos.length > 0 ? photos : [{ image: carouselMedia[0]?.id }], _status: 'published', }, + req, }) } diff --git a/src/seed/durianpy-website/globals/CodeOfConduct.ts b/src/seed/durianpy-website/globals/CodeOfConduct.ts index 60f7508..e1a65da 100644 --- a/src/seed/durianpy-website/globals/CodeOfConduct.ts +++ b/src/seed/durianpy-website/globals/CodeOfConduct.ts @@ -11,27 +11,167 @@ export async function seedCodeOfConduct({ await payload.updateGlobal({ slug: GLOBALS.DURIANPY_WEBSITE_CODE_OF_CONDUCT, data: { - reportFormUrl: 'https://forms.gle/example', + reportFormUrl: 'https://forms.gle/R4MXsc2brwHEmgrE7', content: { root: { type: 'root', format: '', indent: 0, version: 1, + direction: 'ltr', children: [ + { + type: 'heading', + tag: 'h1', + format: '', + indent: 0, + version: 1, + direction: 'ltr', + children: [ + { + type: 'text', + text: 'Code of Conduct', + format: 0, + detail: 0, + mode: 'normal', + style: '', + version: 1, + }, + ], + }, + { + type: 'heading', + tag: 'h2', + format: '', + indent: 0, + version: 1, + direction: 'ltr', + children: [ + { + type: 'text', + text: 'We value respect and inclusivity in all events.', + format: 0, + detail: 0, + mode: 'normal', + style: '', + version: 1, + }, + ], + }, + { + type: 'paragraph', + format: '', + indent: 0, + version: 1, + direction: 'ltr', + children: [ + { + type: 'text', + text: 'The Python community is made up of members from around the globe with a diverse set of skills, personalities, and experiences. It is through these differences that our community experiences great successes and continued growth.', + format: 0, + detail: 0, + mode: 'normal', + style: '', + version: 1, + }, + ], + }, { type: 'paragraph', format: '', indent: 0, version: 1, + direction: 'ltr', children: [ { + type: 'text', + text: 'To clarify our expectations, all participants, including attendees, speakers, exhibitors, organizers, and volunteers at any DurianPy event, must adhere to the following ', + format: 0, + detail: 0, mode: 'normal', - text: 'DurianPy is dedicated to providing a harassment-free community experience for everyone.', + style: '', + version: 1, + }, + { + type: 'link', + fields: { + linkType: 'custom', + url: 'https://policies.python.org/python.org/code-of-conduct/', + newTab: true, + }, + format: '', + indent: 0, + version: 2, + direction: 'ltr', + children: [ + { + type: 'text', + text: 'Code of Conduct', + format: 0, + detail: 0, + mode: 'normal', + style: '', + version: 1, + }, + ], + }, + { type: 'text', + text: '.', + format: 0, + detail: 0, + mode: 'normal', style: '', + version: 1, + }, + ], + }, + { + type: 'paragraph', + format: '', + indent: 0, + version: 1, + direction: 'ltr', + children: [ + { + type: 'text', + text: 'If you witness or experience any violations of the Code of Conduct, please report them using the ', + format: 0, detail: 0, + mode: 'normal', + style: '', + version: 1, + }, + { + type: 'link', + fields: { + linkType: 'custom', + url: 'https://forms.gle/R4MXsc2brwHEmgrE7', + newTab: true, + }, + format: '', + indent: 0, + version: 2, + direction: 'ltr', + children: [ + { + type: 'text', + text: 'Code of Conduct Report Form', + format: 0, + detail: 0, + mode: 'normal', + style: '', + version: 1, + }, + ], + }, + { + type: 'text', + text: '.', format: 0, + detail: 0, + mode: 'normal', + style: '', version: 1, }, ], @@ -41,5 +181,6 @@ export async function seedCodeOfConduct({ }, _status: 'published', }, + req, }) } diff --git a/src/seed/durianpy-website/globals/HomepageConfig.ts b/src/seed/durianpy-website/globals/HomepageConfig.ts index aec4797..70ee845 100644 --- a/src/seed/durianpy-website/globals/HomepageConfig.ts +++ b/src/seed/durianpy-website/globals/HomepageConfig.ts @@ -1,4 +1,5 @@ import { Payload, PayloadRequest } from 'payload' +import { COLLECTIONS } from '@/constants/collections' import { GLOBALS } from '@/constants/globals' export async function seedHomepageConfig({ @@ -9,7 +10,12 @@ export async function seedHomepageConfig({ req?: PayloadRequest }) { const { docs: mediaDocs } = await payload.find({ - collection: 'media', + collection: COLLECTIONS.MEDIA, + where: { + alt: { + equals: 'DurianPy Logo', + }, + }, limit: 1, req, }) @@ -20,9 +26,10 @@ export async function seedHomepageConfig({ data: { heroImageDesktop: mediaId, heroImageMobile: mediaId, - heroTitle: 'Welcome to DurianPy', - heroSubtitle: 'The Python Community of Davao', + heroTitle: "Accelerating Davao's", + heroSubtitle: 'Tech Growth with Python', _status: 'published', }, + req, }) }