diff --git a/web/src/components/index/card.astro b/web/src/components/index/card.astro index 92a5465..d9c80db 100644 --- a/web/src/components/index/card.astro +++ b/web/src/components/index/card.astro @@ -1,13 +1,27 @@ --- +import TagRow from "@component/tagRow" -const { title, description, tags } = Astro.props +const { id, title, description, tags, image } = Astro.props --- -
- {title}
+
+ - {description}
+
+

{title}

+ - {tags.join(", ")}
+
+ +
+
+ + + + +
\ No newline at end of file diff --git a/web/src/components/tagRow.astro b/web/src/components/tagRow.astro new file mode 100644 index 0000000..fd66f82 --- /dev/null +++ b/web/src/components/tagRow.astro @@ -0,0 +1,16 @@ +--- +const { tags } = Astro.props +--- + +
+ { + (tags ?? []).map(tag => ( + + {tag} + + )) + } +
\ No newline at end of file diff --git a/web/src/data/pb.ts b/web/src/data/pb.ts index 6b8fb43..31b2f76 100644 --- a/web/src/data/pb.ts +++ b/web/src/data/pb.ts @@ -1,7 +1,5 @@ import PocketBase from "pocketbase"; -console.log("STUFF", import.meta.env.PUBLIC_PB_URL) - const pb = new PocketBase(import.meta.env.PUBLIC_PB_URL); pb.autoCancellation(false) diff --git a/web/src/pages/index.astro b/web/src/pages/index.astro index b638b5d..c7c551f 100644 --- a/web/src/pages/index.astro +++ b/web/src/pages/index.astro @@ -3,20 +3,27 @@ import { Recipe } from "@tmlmt/cooklang-parser" import { authPB } from "@data/pb"; import RecipeCard from "@component/index/card" import Base from "@layout/Base"; +import { record } from "astro:schema"; const pb = await authPB() const records = await pb.collection('recipes').getFullList() const recipes = records.map(r => new Recipe(r.cooklang)) +const ids = records.map(r => r.id) +const images = await Promise.all( + records.map(r => pb.files.getURL(r, r.images[0])) // get first image from each recipe as a cover image +) --- { - recipes.map(r => ( + recipes.map((r, i) => ( )) }