From 3b359dd3cc3ef1068a2087893ed6606b9042fe1e Mon Sep 17 00:00:00 2001 From: toqvist Date: Fri, 5 Apr 2024 10:59:09 +0200 Subject: [PATCH] Reorganize pages/components --- .../src/components/{ => astro}/Content.astro | 0 astro/src/components/{ => astro}/[id].astro | 0 astro/src/components/astro/posts.astro | 25 ++++++++++ astro/src/pages/index.astro | 48 +++---------------- astro/src/types.ts | 13 ----- payload/src/payload.config.ts | 2 +- 6 files changed, 33 insertions(+), 55 deletions(-) rename astro/src/components/{ => astro}/Content.astro (100%) rename astro/src/components/{ => astro}/[id].astro (100%) create mode 100644 astro/src/components/astro/posts.astro diff --git a/astro/src/components/Content.astro b/astro/src/components/astro/Content.astro similarity index 100% rename from astro/src/components/Content.astro rename to astro/src/components/astro/Content.astro diff --git a/astro/src/components/[id].astro b/astro/src/components/astro/[id].astro similarity index 100% rename from astro/src/components/[id].astro rename to astro/src/components/astro/[id].astro diff --git a/astro/src/components/astro/posts.astro b/astro/src/components/astro/posts.astro new file mode 100644 index 0000000..6b9a14a --- /dev/null +++ b/astro/src/components/astro/posts.astro @@ -0,0 +1,25 @@ +--- +// const { posts } = Astro.props; +import { getPosts } from "@/utils/payload"; +const posts = await getPosts(); + +--- + + { + posts.length > 0 ? ( + posts.map((post) => ( + +
+

{post.title}

+ {post.publishedDate && ( +

+ {new Date(post.publishedDate).toLocaleDateString("de-DE")} +

+ )} +
+
+ )) + ) : ( +

Add Posts in Payloadcms

+ ) + } diff --git a/astro/src/pages/index.astro b/astro/src/pages/index.astro index f92a141..6e3c2db 100644 --- a/astro/src/pages/index.astro +++ b/astro/src/pages/index.astro @@ -1,46 +1,12 @@ --- -import BaseLayout from "@/layouts/BaseLayout.astro"; -//import { getPosts } from "@/utils/payload"; -//const posts = await getPosts(); - import '../styles/global.css' +import BaseLayout from "@/layouts/BaseLayout.astro"; +import { App } from "@/components/App" --- - - +
-

Astroad

-

- Astroad is a pre-configured setup for Astro and Payloadcms that makes it - easy to get started with building your website. With Astroad, you'll have - a complete development environment that you can run locally using Docker. - This makes it easy to test and develop your website before deploying it to - a production environment. -
- When you're ready to deploy the website on your own server, Astrotus - comes with a production environment that requires the use of Traefik as a - reverse proxy. This setup provides a secure and scalable production - environment for your website. -

-

Posts

-
- -
-
+ +
diff --git a/astro/src/types.ts b/astro/src/types.ts index e118d36..1111657 100755 --- a/astro/src/types.ts +++ b/astro/src/types.ts @@ -8,7 +8,6 @@ export interface Config { collections: { - posts: Post; users: User; media: Media; couriers: Courier; @@ -19,18 +18,6 @@ export interface Config { }; globals: {}; } -export interface Post { - id: string; - title?: string; - hallo?: string; - publishedDate?: string; - content?: { - [k: string]: unknown; - }[]; - status?: 'draft' | 'published'; - updatedAt: string; - createdAt: string; -} export interface User { id: string; name: string; diff --git a/payload/src/payload.config.ts b/payload/src/payload.config.ts index f6c15dc..f113089 100644 --- a/payload/src/payload.config.ts +++ b/payload/src/payload.config.ts @@ -25,7 +25,7 @@ export default buildConfig({ }), }, collections: [ - Posts, + // Posts, Users, Media, Couriers,