Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/components/community/CommunityCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@ export default function CommunityCard({ post }: Props) {
<Link href={`/community/${post.slug}`}>
<a className="block">
{post.image ? (
<img src={post.image} alt={post.title} className="w-full h-44 object-cover" />
<img
src={post.image}
alt={post.title}
className="w-full h-44 object-cover"
/>
) : (
<div className="w-full h-44 bg-gray-800 flex items-center justify-center text-gray-400">No Image</div>
<div className="w-full h-44 bg-gray-800 flex items-center justify-center text-gray-400">
No Image
</div>
)}
<div className="p-4">
<h3 className="text-lg font-semibold">{post.title}</h3>
<p className="text-sm text-gray-400 mt-2">{post.description}</p>
<div className="mt-3 flex flex-wrap gap-2">
{post.tags?.map((t) => (
<span key={t} className="text-xs bg-gray-700 text-gray-200 px-2 py-1 rounded">
<span
key={t}
className="text-xs bg-gray-700 text-gray-200 px-2 py-1 rounded"
>
{t}
</span>
))}
Expand Down
21 changes: 5 additions & 16 deletions src/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ const mcProjects = [
},
],
downloads: "2.0M+",
imgs: [
"/assets/mcProjs/tc.webp",
"/assets/mcProjs/tc/maxresdefault.webp",
],
imgs: ["/assets/mcProjs/tc.webp", "/assets/mcProjs/tc/maxresdefault.webp"],
},
{
title: "Scary Myth Mobs",
Expand Down Expand Up @@ -360,9 +357,7 @@ const mcProjects = [
link: "https://www.minecraft.net/en-us/marketplace/pdp?id=47c862c8-98c1-497c-94a5-3959eea3fec5",
},
],
imgs: [
"/assets/mcProjs/dl/Demonic_Legends_Thumbnail.webp",
],
imgs: ["/assets/mcProjs/dl/Demonic_Legends_Thumbnail.webp"],
},
{
title: "Fright Night",
Expand All @@ -375,9 +370,7 @@ const mcProjects = [
link: "https://www.minecraft.net/en-us/marketplace/pdp?id=7ddad910-7c39-46c0-8e6d-8ed38f870d04",
},
],
imgs: [
"/assets/mcProjs/fn/FrightNight_Thumbnail.webp",
],
imgs: ["/assets/mcProjs/fn/FrightNight_Thumbnail.webp"],
},
];

Expand Down Expand Up @@ -452,9 +445,7 @@ const Projects = [
link: "https://wiki.bedrock.dev/",
},
],
imgs: [
"/assets/Projs/wiki/wiki.webp",
],
imgs: ["/assets/Projs/wiki/wiki.webp"],
tags: ["Documentation", "Minecraft", "Community", "Education"],
status: "Live",
featured: false,
Expand All @@ -475,9 +466,7 @@ const Projects = [
link: "https://today-notes.keyyard.xyz",
},
],
imgs: [
"assets/Projs/today/4.webp",
],
imgs: ["assets/Projs/today/4.webp"],
tags: ["React", "PWA", "TypeScript", "Productivity"],
status: "Inactive",
featured: false,
Expand Down
25 changes: 21 additions & 4 deletions src/pages/community/[slug].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,41 @@ export default function CommunityPost({ post }: any) {
<h1 className="text-3xl font-bold">{meta.title}</h1>
<p className="text-sm text-gray-400">{meta.date}</p>
<div className="mt-4">
{meta.image ? <img src={meta.image} alt={meta.title} className="w-full max-h-72 object-cover" /> : null}
{meta.image ? (
<img
src={meta.image}
alt={meta.title}
className="w-full max-h-72 object-cover"
/>
) : null}
</div>
<div className="mt-4 flex gap-2">
{meta.tags?.map((t: string) => (
<span key={t} className="text-xs bg-gray-700 text-gray-200 px-2 py-1 rounded">
<span
key={t}
className="text-xs bg-gray-700 text-gray-200 px-2 py-1 rounded"
>
{t}
</span>
))}
</div>
<div className="mt-6">
{meta.download ? (
<a href={meta.download} className="px-4 py-2 bg-green-600 rounded text-white inline-block" target="_blank" rel="noreferrer">
<a
href={meta.download}
className="px-4 py-2 bg-green-600 rounded text-white inline-block"
target="_blank"
rel="noreferrer"
>
Download
</a>
) : null}
</div>

<div className="prose max-w-none mt-8" dangerouslySetInnerHTML={{ __html: html }} />
<div
className="prose max-w-none mt-8"
dangerouslySetInnerHTML={{ __html: html }}
/>
</article>
</main>
</>
Expand Down
20 changes: 15 additions & 5 deletions src/pages/community/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,28 @@ export default function CommunityIndex({ posts }: { posts: any[] }) {

const filtered = posts.filter((p: any) => {
if (filter && !(p.tags || []).includes(filter)) return false;
if (q && !(p.title + p.description).toLowerCase().includes(q.toLowerCase())) return false;
if (q && !(p.title + p.description).toLowerCase().includes(q.toLowerCase()))
return false;
return true;
});

return (
<>
<Head>
<title>Community — Keyyard</title>
<link rel="alternate" type="application/rss+xml" title="Community RSS" href="/community/rss.xml" />
<link
rel="alternate"
type="application/rss+xml"
title="Community RSS"
href="/community/rss.xml"
/>
</Head>
<main className="container mx-auto p-6">
<header className="mb-6">
<h1 className="text-3xl font-bold">Community</h1>
<p className="text-gray-400">Free community projects, tools, and downloads.</p>
<p className="text-gray-400">
Free community projects, tools, and downloads.
</p>
</header>

<div className="flex gap-4 mb-6 items-center">
Expand All @@ -55,14 +63,16 @@ export default function CommunityIndex({ posts }: { posts: any[] }) {
<div className="flex gap-2">
<button
onClick={() => setFilter(null)}
className={`px-3 py-1 rounded ${filter ? "bg-gray-700" : "bg-green-600"}`}>
className={`px-3 py-1 rounded ${filter ? "bg-gray-700" : "bg-green-600"}`}
>
All
</button>
{tags.map((t) => (
<button
key={t}
onClick={() => setFilter((f) => (f === t ? null : t))}
className={`px-3 py-1 rounded ${filter === t ? "bg-green-600" : "bg-gray-700"}`}>
className={`px-3 py-1 rounded ${filter === t ? "bg-green-600" : "bg-gray-700"}`}
>
{t}
</button>
))}
Expand Down
5 changes: 1 addition & 4 deletions src/utils/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ export async function getAllCommunityPosts(): Promise<PostMeta[]> {
}

export async function getCommunityPost(slug: string) {
const filenameCandidates = [
`${slug}.md`,
path.join(slug, "index.md"),
];
const filenameCandidates = [`${slug}.md`, path.join(slug, "index.md")];

for (const candidate of filenameCandidates) {
const full = path.join(CONTENT_PATH, candidate);
Expand Down