diff --git a/src/pages/pictures/index.astro b/src/pages/pictures/index.astro index 0c15019..561ee18 100644 --- a/src/pages/pictures/index.astro +++ b/src/pages/pictures/index.astro @@ -2,98 +2,94 @@ import BaseHead from '../../components/BaseHead.astro'; import Header from '../../components/Header.astro'; import Footer from '../../components/Footer.astro'; +import { getCollection } from 'astro:content'; +import { actions } from 'astro:actions'; +import { Image } from 'astro:assets'; -import { drizzle } from "drizzle-orm/d1"; -import { GuestLog } from "../../schema"; -import { env } from "cloudflare:workers"; -export const prerender = false +const albums = await getCollection('album'); -const db = drizzle(env.DB); -if (Astro.request.method === 'POST') { - // Parse form data - const formData = await Astro.request.formData(); - console.log(formData); - const name = formData.get('name'); - const message = formData.get('message'); - const website_link = formData.get('website_link'); - - if ( - typeof name === 'string' && - typeof website_link === 'string' && - typeof message === 'string' && - name !== "" && - message !== "" - ) { - if (message.length >= 255) { - return; - } - await db.insert(GuestLog).values([{ - name : name, - message : message, - website_link : website_link, - date_viewed : new Date(), - }]); - } -} - -let guest_logs : {id: number; name: string; message: string | null; date: Date;}[] = []; -try { -guest_logs = await db - .select() - .from(GuestLog) - .orderBy(GuestLog.date); -} catch (err) { - console.log(err); -} - -guest_logs.forEach(log => { - console.log(log) -}); +// console.log(albums) --- + + - +
-

sign the guest book

-
- - - - - - - - - - -
- -

guest book

-
    - { - guest_logs.map((log) => ( -
  • -

    [{log.date.toDateString()}] {log.name} - {log.website_link? ({log.website_link}) : ""} - : {log.message}

    -
  • - )) - } -
+

Albums

+ {( albums.map(album => + +
+ ))}