From 94b910ebe2686c0a5796a656ff5fa7f26f207dcf Mon Sep 17 00:00:00 2001 From: RedBeardEth <90423049+RedBeardEth@users.noreply.github.com> Date: Tue, 8 Oct 2024 17:04:57 +1100 Subject: [PATCH] add blog preview Image, blog to sidebar and realms first in game list --- apps/nextjs/keystatic.config.ts | 4 ++ apps/nextjs/src/app/(app)/blogs/BlogCard.tsx | 54 +++++++++++--------- apps/nextjs/src/app/(app)/games/page.tsx | 9 +++- apps/nextjs/src/app/_components/SideMenu.tsx | 7 ++- 4 files changed, 49 insertions(+), 25 deletions(-) diff --git a/apps/nextjs/keystatic.config.ts b/apps/nextjs/keystatic.config.ts index fbce1437..8d31ad3f 100644 --- a/apps/nextjs/keystatic.config.ts +++ b/apps/nextjs/keystatic.config.ts @@ -171,6 +171,10 @@ export default config({ label: "Banner Image", directory: "public/content/blogs", }), + previewImage: fields.image({ + label: "Preview Image", + directory: "public/content/blogs", + }), subtitle: fields.text({ label: "Subtitle" }), content: fields.markdoc({ label: "Content", diff --git a/apps/nextjs/src/app/(app)/blogs/BlogCard.tsx b/apps/nextjs/src/app/(app)/blogs/BlogCard.tsx index dac9789e..83d523d2 100644 --- a/apps/nextjs/src/app/(app)/blogs/BlogCard.tsx +++ b/apps/nextjs/src/app/(app)/blogs/BlogCard.tsx @@ -4,29 +4,37 @@ import { Badge } from "@realms-world/ui/components/ui/badge"; import { Card } from "@realms-world/ui/components/ui/card"; import type { CollectionEntry } from "@/utils/keystatic"; +export const BlogCard = ({ + blog, + slug, +}: { + blog: CollectionEntry<"blogs">; + slug: string; +}) => { + return ( + + + {blog.title} +
+ + {" "} + + -export const BlogCard = ({ blog, slug }: { blog: CollectionEntry<'blogs'>, slug: string }) => { - return ( - - - {blog.title} -
- - -

{blog.title}

-

{blog.subtitle}

-
- -
- ); +

{blog.title}

+

{blog.subtitle}

+
+ +
+ ); }; -export default BlogCard; \ No newline at end of file +export default BlogCard; diff --git a/apps/nextjs/src/app/(app)/games/page.tsx b/apps/nextjs/src/app/(app)/games/page.tsx index 1cf27c68..b848889d 100644 --- a/apps/nextjs/src/app/(app)/games/page.tsx +++ b/apps/nextjs/src/app/(app)/games/page.tsx @@ -11,7 +11,14 @@ export const metadata: Metadata = { }; export default async function Page() { - const games = await reader.collections.games.all(); + const allGames = await reader.collections.games.all(); + + const games = allGames.sort((a, b) => { + if (a.slug === "realms-eternum") return -1; + if (b.slug === "realms-eternum") return 1; + return 0; + }); + return (
diff --git a/apps/nextjs/src/app/_components/SideMenu.tsx b/apps/nextjs/src/app/_components/SideMenu.tsx index 8acbd1b3..7f09fef6 100644 --- a/apps/nextjs/src/app/_components/SideMenu.tsx +++ b/apps/nextjs/src/app/_components/SideMenu.tsx @@ -13,7 +13,7 @@ import Gamepad from "@/icons/gamepad.svg"; import LordsIcon from "@/icons/lords.svg"; import RWLogo from "@/icons/rw-logo.svg"; import SideHeaderImg from "@/icons/side-header.svg"; -import { Github, Twitter, User } from "lucide-react"; +import { Github, Newspaper, Twitter, User } from "lucide-react"; import { Button } from "@realms-world/ui/components/ui/button"; import { ScrollArea } from "@realms-world/ui/components/ui/scroll-area"; @@ -42,6 +42,11 @@ const Sidebar = () => { href: "/events", icon: , }, + { + name: "Blog", + href: "/blogs", + icon: , + }, { name: "Account", href: "/account",