Skip to content

Commit 7ad1cad

Browse files
feat: add discord link to hacktoberfest blog (codse#214)
1 parent 278f3ec commit 7ad1cad

File tree

9 files changed

+30
-34
lines changed

9 files changed

+30
-34
lines changed

animata/hero/hero-section.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { useState } from "react";
2-
import Image from "next/image";
32

43
import { Button as UIButton } from "@/components/ui/button";
54
import { cn } from "@/lib/utils";
@@ -24,10 +23,10 @@ function Button({ children }: { children: React.ReactNode }) {
2423
function ImageWithWave() {
2524
return (
2625
<div className="title-logo relative inline-block self-center md:self-start">
27-
<Image
26+
<img
2827
width={100}
2928
height={100}
30-
src={animataImage}
29+
src={animataImage.src}
3130
className="-top-6 h-10 w-10 translate-y-5 animate-fadeIn fade-in-0 md:-top-10 md:h-16 md:w-16 md:translate-y-0"
3231
alt="Hero image"
3332
/>

animata/widget/video-chat.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use client";
22

33
import { useState } from "react";
4-
import Image, { StaticImageData } from "next/image";
4+
import { StaticImageData } from "next/image";
55
import { motion } from "framer-motion";
66
import {
77
Circle,
@@ -58,8 +58,8 @@ function ImageSlot({ minimize, imageSource, imageAlternate }: ImageSlotProps) {
5858
transition={{ duration: 0.5 }}
5959
className={cn(minimize ? "h-48 w-full" : "h-56 w-56")}
6060
>
61-
<Image
62-
src={imageSource}
61+
<img
62+
src={imageSource.src}
6363
alt={imageAlternate}
6464
className={cn("h-full w-full object-cover", minimize ? "rounded-xl" : "rounded-3xl")}
6565
/>
@@ -74,8 +74,8 @@ function YourImageSlot({ minimize, imageSource, imageAlternate }: ImageSlotProps
7474
transition={{ duration: 0.5 }}
7575
className={cn(minimize ? "absolute bottom-2 right-0 h-20 w-20" : "h-56 w-56")}
7676
>
77-
<Image
78-
src={imageSource}
77+
<img
78+
src={imageSource.src}
7979
alt={imageAlternate}
8080
className={cn("h-full w-full object-cover", minimize ? "rounded-xl" : "rounded-3xl")}
8181
/>

app/blog/[[...slug]]/page.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,6 @@ export async function generateStaticParams(): Promise<BlogPageProps["params"][]>
7777
}
7878

7979
export default async function BlogPage({ params }: BlogPageProps) {
80-
const slug = params.slug?.join("/") || "";
81-
82-
// // Check if the slug is empty (i.e., the user is at /blog/)
83-
// if (slug === "") {
84-
// // Redirect to the first blog post
85-
// const firstBlogPost = blogSidebarNav[0]?.items[0]?.href; // Get the first blog post href
86-
// if (firstBlogPost) {
87-
// // Use the Next.js redirect method
88-
// redirect(firstBlogPost);
89-
// }
90-
// }
91-
92-
const isIndexPage = slug === "";
93-
9480
const blog = await getBlogFromParams({ params });
9581

9682
if (!blog) {
@@ -105,11 +91,7 @@ export default async function BlogPage({ params }: BlogPageProps) {
10591
<div className="mb-4 flex items-center space-x-1 text-sm text-muted-foreground">
10692
<div className="overflow-hidden text-ellipsis whitespace-nowrap">Blog</div>
10793
<ChevronRightIcon className="h-4 w-4" />
108-
{isIndexPage ? (
109-
<div className="overflow-hidden text-ellipsis whitespace-nowrap">Welcome</div>
110-
) : (
111-
<NavMenu baseRoute="blog" sideBarNavItems={blogSidebarNav} value={blog.slugAsParams} />
112-
)}
94+
<NavMenu baseRoute="blog" sideBarNavItems={blogSidebarNav} value={blog.slugAsParams} />
11395
</div>
11496
<div className="space-y-2">
11597
<h1 className={cn("scroll-m-20 text-4xl font-bold tracking-tight")}>{blog.title}</h1>

components/mdx-components.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22
import { ComponentProps, HTMLAttributes } from "react";
3-
import Image from "next/image";
43
import Link from "next/link";
54
import { useMDXComponent } from "next-contentlayer/hooks";
65
import { NpmCommands, TouchCommands } from "types/unist";
@@ -126,7 +125,7 @@ const components = {
126125
{...props}
127126
/>
128127
),
129-
Image,
128+
Image: ({ alt, ...props }: ComponentProps<"img">) => <img alt={alt} {...props} />,
130129
Modal,
131130
Callout,
132131
ComponentPreview,

components/site-footer.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"use client";
22

3-
import Image from "next/image";
43
import Link from "next/link";
54
import { usePathname } from "next/navigation";
65

@@ -25,7 +24,7 @@ export function SiteFooter() {
2524
</div>
2625
<p className="text-muted-foreground">by</p>
2726
<div className="flex gap-1">
28-
<Image src="/codse.webp" width={24} height={24} alt="codse" />
27+
<img src="/codse.webp" width={24} height={24} alt="codse" />
2928
<span>codse</span>
3029
</div>
3130
<p className="text-muted-foreground"> from</p>

config/blog.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,30 @@ interface BlogPost extends SidebarNavItem {
77
}
88

99
const sortAlphabetically = (a: BlogPost, b: BlogPost) => {
10+
// Ensure the index page is always first
11+
if (a.href === "/blog") {
12+
return -1;
13+
}
14+
if (b.href === "/blog") {
15+
return 1;
16+
}
17+
18+
// Sort by sortId if available
1019
if (a.sortId && b.sortId) {
1120
return a.sortId.localeCompare(b.sortId);
1221
} else if (a.sortId) {
1322
return -1;
1423
} else if (b.sortId) {
1524
return 1;
1625
} else {
26+
// Sort by date if sortId is not available
1727
return new Date(a.date).getTime() - new Date(b.date).getTime();
1828
}
1929
};
2030

2131
const createLinks = (category: string): BlogPost[] => {
2232
return allBlogs
23-
.filter((doc) => doc.published && doc.slug !== "/blog")
33+
.filter((doc) => doc.published)
2434
.map((doc) => ({
2535
// Make sure the index page is the first item
2636
title: doc.title,

content/blog/hacktoberfest-2024.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ You can track the progress and pick tasks by visiting our [GitHub Project Board]
3434
- Link the issue number in your pull request description (e.g., "Fixes #issue-number").
3535
- Add relevant labels (e.g., `hacktoberfest`, `enhancement`, `bug-fix`).
3636

37+
### Join Our Community
38+
39+
Join our [Discord community](https://discord.gg/YfvqMf5MTE) to connect with other contributors and get support.
40+
3741
---
3842

3943
### Contribution Rewards

content/blog/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Animata Blog
3-
date: 2024-09-20
2+
title: Welcome
3+
date: 2024-09-17
44
description: Welcome to the Animata Blog! 🎉
55
---
66

next.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ const nextConfig = {
55
output: "export", // Enable static exports
66
reactStrictMode: true,
77
swcMinify: true,
8+
images: {
9+
unoptimized: true,
10+
},
811
};
912

1013
export default withContentlayer(nextConfig);

0 commit comments

Comments
 (0)