From 07da12c85a707aaf6b70b07c18edfdef7421279a Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 30 Jun 2026 12:26:34 +1200 Subject: [PATCH 1/4] feat: add barebones iframe and buttons for my-ayo page --- src/app/(frontend)/my-ayo/page.tsx | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/app/(frontend)/my-ayo/page.tsx diff --git a/src/app/(frontend)/my-ayo/page.tsx b/src/app/(frontend)/my-ayo/page.tsx new file mode 100644 index 0000000..070115e --- /dev/null +++ b/src/app/(frontend)/my-ayo/page.tsx @@ -0,0 +1,23 @@ +export default function MyAyoPage() { + return ( +
+ +
+ + + +
+
+ ) +} From 0b70c7931d37736eb0f5b8f2f88f9716320c1a4a Mon Sep 17 00:00:00 2001 From: simon Date: Tue, 30 Jun 2026 13:09:12 +1200 Subject: [PATCH 2/4] feat: add barebones login and passwords collection --- src/app/(frontend)/components/MyAYOLink.tsx | 24 ++++++++++++++++++++ src/app/(frontend)/login-test/page.tsx | 20 +++++++++++++++++ src/app/(frontend)/my-ayo/page.tsx | 14 ++++++------ src/collections/Passwords.ts | 11 +++++++++ src/payload-types.ts | 25 +++++++++++++++++++++ src/payload.config.ts | 4 ++-- 6 files changed, 89 insertions(+), 9 deletions(-) create mode 100644 src/app/(frontend)/components/MyAYOLink.tsx create mode 100644 src/app/(frontend)/login-test/page.tsx create mode 100644 src/collections/Passwords.ts diff --git a/src/app/(frontend)/components/MyAYOLink.tsx b/src/app/(frontend)/components/MyAYOLink.tsx new file mode 100644 index 0000000..f7133ca --- /dev/null +++ b/src/app/(frontend)/components/MyAYOLink.tsx @@ -0,0 +1,24 @@ +'use client' +import React from 'react' +import { useState } from 'react' +const MyAYOLink = () => { + const [text, setText] = useState('Copy ICS link') + + const handleCopy = () => { + navigator.clipboard.writeText('insert link here') + setText('Copied!') + setTimeout(() => { + setText('Copy ICS link') + }, 1000) + } + return ( + + ) +} + +export default MyAYOLink diff --git a/src/app/(frontend)/login-test/page.tsx b/src/app/(frontend)/login-test/page.tsx new file mode 100644 index 0000000..592e3b2 --- /dev/null +++ b/src/app/(frontend)/login-test/page.tsx @@ -0,0 +1,20 @@ +'use client' +import MyAYOLink from '../components/MyAYOLink' +import { useState } from 'react' +export default function LoginPage() { + const [email, setEmail] = useState('') + const [password, setPassword] = useState('') + return ( +
+
+ setPassword(e.target.value)} + placeholder="Password" + /> + +
+
+ ) +} diff --git a/src/app/(frontend)/my-ayo/page.tsx b/src/app/(frontend)/my-ayo/page.tsx index 070115e..5989785 100644 --- a/src/app/(frontend)/my-ayo/page.tsx +++ b/src/app/(frontend)/my-ayo/page.tsx @@ -1,3 +1,5 @@ +import MyAYOLink from '../components/MyAYOLink' + export default function MyAyoPage() { return (
@@ -8,15 +10,13 @@ export default function MyAyoPage() { height="600" >
- - - + +
) diff --git a/src/collections/Passwords.ts b/src/collections/Passwords.ts new file mode 100644 index 0000000..e2eceb6 --- /dev/null +++ b/src/collections/Passwords.ts @@ -0,0 +1,11 @@ +import type { CollectionConfig } from 'payload' + +export const Passwords: CollectionConfig = { + slug: 'passwords', + fields: [ + { + name: 'password', + type: 'text', + }, + ], +} diff --git a/src/payload-types.ts b/src/payload-types.ts index e90e259..3ddab6d 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -70,6 +70,7 @@ export interface Config { users: User; media: Media; partners: Partner; + passwords: Password; 'payload-kv': PayloadKv; 'payload-locked-documents': PayloadLockedDocument; 'payload-preferences': PayloadPreference; @@ -80,6 +81,7 @@ export interface Config { users: UsersSelect | UsersSelect; media: MediaSelect | MediaSelect; partners: PartnersSelect | PartnersSelect; + passwords: PasswordsSelect | PasswordsSelect; 'payload-kv': PayloadKvSelect | PayloadKvSelect; 'payload-locked-documents': PayloadLockedDocumentsSelect | PayloadLockedDocumentsSelect; 'payload-preferences': PayloadPreferencesSelect | PayloadPreferencesSelect; @@ -177,6 +179,16 @@ export interface Partner { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "passwords". + */ +export interface Password { + id: string; + password?: string | null; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-kv". @@ -212,6 +224,10 @@ export interface PayloadLockedDocument { | ({ relationTo: 'partners'; value: string | Partner; + } | null) + | ({ + relationTo: 'passwords'; + value: string | Password; } | null); globalSlug?: string | null; user: { @@ -308,6 +324,15 @@ export interface PartnersSelect { updatedAt?: T; createdAt?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "passwords_select". + */ +export interface PasswordsSelect { + password?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-kv_select". diff --git a/src/payload.config.ts b/src/payload.config.ts index d49c200..345ba9f 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -8,7 +8,7 @@ import sharp from 'sharp' import { Users } from './collections/Users' import { Media } from './collections/Media' import { Partners } from './collections/Partners' - +import { Passwords } from './collections/Passwords' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -19,7 +19,7 @@ export default buildConfig({ baseDir: path.resolve(dirname), }, }, - collections: [Users, Media, Partners], + collections: [Users, Media, Partners, Passwords], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '', typescript: { From 474c4aedb005bb2756c96910e1bf1f1c13e655ff Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 2 Jul 2026 15:59:09 +1200 Subject: [PATCH 3/4] feat: add password and password collection for my-ayo page --- src/app/(frontend)/login-test/page.tsx | 20 -------------- src/app/(frontend)/my-ayo/page.tsx | 37 +++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 21 deletions(-) delete mode 100644 src/app/(frontend)/login-test/page.tsx diff --git a/src/app/(frontend)/login-test/page.tsx b/src/app/(frontend)/login-test/page.tsx deleted file mode 100644 index 592e3b2..0000000 --- a/src/app/(frontend)/login-test/page.tsx +++ /dev/null @@ -1,20 +0,0 @@ -'use client' -import MyAYOLink from '../components/MyAYOLink' -import { useState } from 'react' -export default function LoginPage() { - const [email, setEmail] = useState('') - const [password, setPassword] = useState('') - return ( -
-
- setPassword(e.target.value)} - placeholder="Password" - /> - -
-
- ) -} diff --git a/src/app/(frontend)/my-ayo/page.tsx b/src/app/(frontend)/my-ayo/page.tsx index 5989785..4dc932b 100644 --- a/src/app/(frontend)/my-ayo/page.tsx +++ b/src/app/(frontend)/my-ayo/page.tsx @@ -1,6 +1,41 @@ import MyAYOLink from '../components/MyAYOLink' +import { cookies } from 'next/headers' +import { getPayload } from 'payload' +import config from '@payload-config' + +async function checkPassword(formData: FormData) { + 'use server' + const payload = await getPayload({ config }) + const password = formData.get('password') + const { docs } = await payload.find({ + collection: 'passwords', + }) + const correctPasswords = docs.map((doc) => doc.password) + if (password && correctPasswords.includes(password as string)) { + const cookieStore = await cookies() + cookieStore.set('my-ayo-access', 'granted', { + httpOnly: true, + path: '/my-ayo', + maxAge: 60 * 60 * 24 * 7, + }) + } +} + +export default async function MyAyoPage() { + const cookieStore = await cookies() + const hasAccess = cookieStore.get('my-ayo-access')?.value === 'granted' + + if (!hasAccess) { + return ( +
+
+ + +
+
+ ) + } -export default function MyAyoPage() { return (
+
) diff --git a/src/collections/CalendarLink.ts b/src/collections/CalendarLink.ts new file mode 100644 index 0000000..f2084ef --- /dev/null +++ b/src/collections/CalendarLink.ts @@ -0,0 +1,19 @@ +import type { CollectionConfig } from 'payload' + +export const CalendarLink: CollectionConfig = { + slug: 'links', + fields: [ + { + name: 'embedLink', + type: 'text', + }, + { + name: 'publicLink', + type: 'text', + }, + { + name: 'icalLink', + type: 'text', + }, + ], +} diff --git a/src/payload-types.ts b/src/payload-types.ts index 3ddab6d..e533b64 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -71,6 +71,7 @@ export interface Config { media: Media; partners: Partner; passwords: Password; + links: Link; 'payload-kv': PayloadKv; 'payload-locked-documents': PayloadLockedDocument; 'payload-preferences': PayloadPreference; @@ -82,6 +83,7 @@ export interface Config { media: MediaSelect | MediaSelect; partners: PartnersSelect | PartnersSelect; passwords: PasswordsSelect | PasswordsSelect; + links: LinksSelect | LinksSelect; 'payload-kv': PayloadKvSelect | PayloadKvSelect; 'payload-locked-documents': PayloadLockedDocumentsSelect | PayloadLockedDocumentsSelect; 'payload-preferences': PayloadPreferencesSelect | PayloadPreferencesSelect; @@ -189,6 +191,18 @@ export interface Password { updatedAt: string; createdAt: string; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "links". + */ +export interface Link { + id: string; + embedLink?: string | null; + publicLink?: string | null; + icalLink?: string | null; + updatedAt: string; + createdAt: string; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-kv". @@ -228,6 +242,10 @@ export interface PayloadLockedDocument { | ({ relationTo: 'passwords'; value: string | Password; + } | null) + | ({ + relationTo: 'links'; + value: string | Link; } | null); globalSlug?: string | null; user: { @@ -333,6 +351,17 @@ export interface PasswordsSelect { updatedAt?: T; createdAt?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "links_select". + */ +export interface LinksSelect { + embedLink?: T; + publicLink?: T; + icalLink?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-kv_select". diff --git a/src/payload.config.ts b/src/payload.config.ts index 345ba9f..490a2c1 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -9,6 +9,7 @@ import { Users } from './collections/Users' import { Media } from './collections/Media' import { Partners } from './collections/Partners' import { Passwords } from './collections/Passwords' +import { CalendarLink } from './collections/CalendarLink' const filename = fileURLToPath(import.meta.url) const dirname = path.dirname(filename) @@ -19,7 +20,7 @@ export default buildConfig({ baseDir: path.resolve(dirname), }, }, - collections: [Users, Media, Partners, Passwords], + collections: [Users, Media, Partners, Passwords, CalendarLink], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '', typescript: {