From c1c7ca70783cbb38cf35fe0c9fb05dd626f46c08 Mon Sep 17 00:00:00 2001 From: Nikhil M Warrier Date: Tue, 3 Mar 2026 09:00:53 +0530 Subject: Rename Author to Member, add Codeberg icons --- src/components/AuthorCard.astro | 62 ------------------------------------ src/components/MemberCard.astro | 63 +++++++++++++++++++++++++++++++++++++ src/components/PostNavigation.astro | 6 ++-- src/consts.ts | 13 ++++---- src/content.config.ts | 7 +++-- src/content/authors/enscribe.md | 10 ------ src/content/members/enscribe.md | 10 ++++++ src/lib/data-utils.ts | 11 +++---- src/pages/authors/[...id].astro | 58 ---------------------------------- src/pages/authors/index.astro | 27 ---------------- src/pages/members/[...id].astro | 58 ++++++++++++++++++++++++++++++++++ src/pages/members/index.astro | 27 ++++++++++++++++ 12 files changed, 178 insertions(+), 174 deletions(-) delete mode 100644 src/components/AuthorCard.astro create mode 100644 src/components/MemberCard.astro delete mode 100644 src/content/authors/enscribe.md create mode 100644 src/content/members/enscribe.md delete mode 100644 src/pages/authors/[...id].astro delete mode 100644 src/pages/authors/index.astro create mode 100644 src/pages/members/[...id].astro create mode 100644 src/pages/members/index.astro diff --git a/src/components/AuthorCard.astro b/src/components/AuthorCard.astro deleted file mode 100644 index 9f178fa..0000000 --- a/src/components/AuthorCard.astro +++ /dev/null @@ -1,62 +0,0 @@ ---- -import Link from '@/components/Link.astro' -import AvatarComponent from '@/components/ui/avatar' -import { cn } from '@/lib/utils' -import type { SocialLink } from '@/types' -import type { CollectionEntry } from 'astro:content' -import SocialIcons from './SocialIcons.astro' - -interface Props { - author: CollectionEntry<'authors'> -} - -const { author } = Astro.props -const { name, avatar, bio, pronouns } = author.data -const currentPath = Astro.url.pathname -const isAuthorPage = currentPath === `/authors/${author.id}` - -const socialLinks: SocialLink[] = [ - author.data.website && { href: author.data.website, label: 'Website' }, - author.data.github && { href: author.data.github, label: 'GitHub' }, - author.data.twitter && { href: author.data.twitter, label: 'Twitter' }, - author.data.linkedin && { href: author.data.linkedin, label: 'LinkedIn' }, - author.data.mail && { href: `mailto:${author.data.mail}`, label: 'Email' }, -].filter(Boolean) as SocialLink[] ---- - -
-
- - [data-slot="avatar-fallback"]]:rounded-md', - !isAuthorPage && - 'hover:ring-primary transition-shadow duration-300 hover:cursor-pointer hover:ring-2', - )} - /> - -
-
-
-

{name}

- { - pronouns && ( - ({pronouns}) - ) - } -
-

{bio}

-
- -
-
-
diff --git a/src/components/MemberCard.astro b/src/components/MemberCard.astro new file mode 100644 index 0000000..b98e3ee --- /dev/null +++ b/src/components/MemberCard.astro @@ -0,0 +1,63 @@ +--- +import Link from '@/components/Link.astro' +import AvatarComponent from '@/components/ui/avatar' +import { cn } from '@/lib/utils' +import type { SocialLink } from '@/types' +import type { CollectionEntry } from 'astro:content' +import SocialIcons from './SocialIcons.astro' + +interface Props { + member: CollectionEntry<'members'> +} + +const { member } = Astro.props +const { name, avatar, bio, pronouns } = member.data +const currentPath = Astro.url.pathname +const isAuthorPage = currentPath === `/members/${member.id}` + +const socialLinks: SocialLink[] = [ + member.data.website && { href: member.data.website, label: 'Website' }, + member.data.github && { href: member.data.github, label: 'GitHub' }, + member.data.codeberg && { href: member.data.codeberg, label: 'Codeberg' }, + member.data.twitter && { href: member.data.twitter, label: 'Twitter' }, + member.data.linkedin && { href: member.data.linkedin, label: 'LinkedIn' }, + member.data.mail && { href: `mailto:${member.data.mail}`, label: 'Email' }, +].filter(Boolean) as SocialLink[] +--- + +
+
+ + + +
+
+
+

{name}

+ { + pronouns && ( + ({pronouns}) + ) + } +
+

{bio}

+
+ +
+
+
diff --git a/src/components/PostNavigation.astro b/src/components/PostNavigation.astro index bca228a..2e8b93e 100644 --- a/src/components/PostNavigation.astro +++ b/src/components/PostNavigation.astro @@ -19,7 +19,8 @@ const isSubpost = !!parentPost class={cn( buttonVariants({ variant: 'outline' }), 'rounded-lg group flex items-center justify-start size-full', - !olderPost && 'pointer-events-none opacity-0 cursor-not-allowed', + !olderPost && + 'pointer-events-none opacity-0 invisible cursor-not-allowed', )} aria-disabled={!olderPost} > @@ -71,7 +72,8 @@ const isSubpost = !!parentPost class={cn( buttonVariants({ variant: 'outline' }), 'rounded-lg group flex items-center justify-end size-full', - !newerPost && 'pointer-events-none opacity-0 cursor-not-allowed', + !newerPost && + 'pointer-events-none opacity-0 invisible cursor-not-allowed', )} aria-disabled={!newerPost} > diff --git a/src/consts.ts b/src/consts.ts index c66ef3e..58bb71e 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -3,7 +3,7 @@ import type { IconMap, SocialLink, Site } from '@/types' export const SITE: Site = { title: 'FOSS CET', description: - 'Don\'t just join a club; build one. We need architects, not just members', + "Don't just join a club; build one. We need architects, not just members", href: 'https://astro-erudite.vercel.app', author: 'fosscet', locale: 'en-US', @@ -19,8 +19,8 @@ export const NAV_LINKS: SocialLink[] = [ label: 'blog', }, { - href: '/authors', - label: 'authors', + href: '/members', + label: 'members', }, { href: '/about', @@ -34,8 +34,8 @@ export const NAV_LINKS: SocialLink[] = [ export const SOCIAL_LINKS: SocialLink[] = [ { - href: 'https://codeberg.org/foss-cet', - label: 'CodeBerg', + href: 'https://codeberg.org/fosscet', + label: 'Codeberg', }, { href: '/rss.xml', @@ -45,7 +45,8 @@ export const SOCIAL_LINKS: SocialLink[] = [ export const ICON_MAP: IconMap = { Website: 'lucide:globe', - CodeBerg: 'lucide:mountain-snow', + Codeberg: 'lucide:mountain-snow', + GitHub: 'lucide:github', LinkedIn: 'lucide:linkedin', Twitter: 'lucide:twitter', Email: 'lucide:mail', diff --git a/src/content.config.ts b/src/content.config.ts index 1c01708..d18d704 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -30,8 +30,8 @@ const blog = defineCollection({ }), }) -const authors = defineCollection({ - loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/authors' }), +const members = defineCollection({ + loader: glob({ pattern: '**/*.{md,mdx}', base: './src/content/members' }), schema: z.object({ name: z.string(), pronouns: z.string().optional(), @@ -41,6 +41,7 @@ const authors = defineCollection({ website: z.string().url().optional(), twitter: z.string().url().optional(), github: z.string().url().optional(), + codeberg: z.string().url().optional(), linkedin: z.string().url().optional(), discord: z.string().url().optional(), }), @@ -60,4 +61,4 @@ const projects = defineCollection({ }), }) -export const collections = { events, blog, authors, projects } +export const collections = { events, blog, members, projects } diff --git a/src/content/authors/enscribe.md b/src/content/authors/enscribe.md deleted file mode 100644 index 57cac26..0000000 --- a/src/content/authors/enscribe.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: 'enscribe' -pronouns: 'he/him' -avatar: 'https://gravatar.com/avatar/9bfdc4ec972793cf05cb91efce5f4aaaec2a0da1bf4ec34dad0913f1d845faf6.webp?size=256' -bio: 'd(-_-)b' -website: 'https://enscribe.dev' -twitter: 'https://twitter.com/enscry' -github: 'https://github.com/jktrn' -mail: 'jason@enscribe.dev' ---- diff --git a/src/content/members/enscribe.md b/src/content/members/enscribe.md new file mode 100644 index 0000000..57cac26 --- /dev/null +++ b/src/content/members/enscribe.md @@ -0,0 +1,10 @@ +--- +name: 'enscribe' +pronouns: 'he/him' +avatar: 'https://gravatar.com/avatar/9bfdc4ec972793cf05cb91efce5f4aaaec2a0da1bf4ec34dad0913f1d845faf6.webp?size=256' +bio: 'd(-_-)b' +website: 'https://enscribe.dev' +twitter: 'https://twitter.com/enscry' +github: 'https://github.com/jktrn' +mail: 'jason@enscribe.dev' +--- diff --git a/src/lib/data-utils.ts b/src/lib/data-utils.ts index ab0176f..6e4439f 100644 --- a/src/lib/data-utils.ts +++ b/src/lib/data-utils.ts @@ -1,8 +1,8 @@ import { getCollection, render, type CollectionEntry } from 'astro:content' import { readingTime, calculateWordCountFromHtml } from '@/lib/utils' -export async function getAllAuthors(): Promise[]> { - return await getCollection('authors') +export async function getAllMembers(): Promise[]> { + return await getCollection('members') } export async function getAllPosts(): Promise[]> { @@ -23,8 +23,7 @@ export async function getAllPostsAndSubposts(): Promise< export async function getAllEvents(): Promise[]> { const events = await getCollection('events') - return events - .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()) + return events.sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()) } export function groupEventsByYear( @@ -62,7 +61,7 @@ export async function getAllTags(): Promise> { export async function getAllTypes(): Promise> { const events = await getAllEvents() return events.reduce((acc, event) => { - acc.set(event.data.type, (acc.get(event.data.type) || 0) + 1) + acc.set(event.data.type, (acc.get(event.data.type) || 0) + 1) return acc }, new Map()) } @@ -248,7 +247,7 @@ export async function getParentPost( export async function parseAuthors(authorIds: string[] = []) { if (!authorIds.length) return [] - const allAuthors = await getAllAuthors() + const allAuthors = await getAllMembers() const authorMap = new Map(allAuthors.map((author) => [author.id, author])) return authorIds.map((id) => { diff --git a/src/pages/authors/[...id].astro b/src/pages/authors/[...id].astro deleted file mode 100644 index d71fcf8..0000000 --- a/src/pages/authors/[...id].astro +++ /dev/null @@ -1,58 +0,0 @@ ---- -import AuthorCard from '@/components/AuthorCard.astro' -import BlogCard from '@/components/BlogCard.astro' -import Breadcrumbs from '@/components/Breadcrumbs.astro' -import PageHead from '@/components/PageHead.astro' -import Layout from '@/layouts/Layout.astro' -import { getAllAuthors, getPostsByAuthor } from '@/lib/data-utils' - -export async function getStaticPaths() { - const authors = await getAllAuthors() - return authors.map((author) => ({ - params: { id: author.id }, - props: { author }, - })) -} - -const { author } = Astro.props -const authorPosts = await getPostsByAuthor(author.id) ---- - - - - - -
- -
-
-

Posts by {author.data.name}

- { - authorPosts.length > 0 ? ( -
    - {authorPosts - .filter((post) => !post.data.draft) - .map((post) => ( -
  • - -
  • - ))} -
- ) : ( -

- No posts available from this author. -

- ) - } -
-
diff --git a/src/pages/authors/index.astro b/src/pages/authors/index.astro deleted file mode 100644 index ba311a0..0000000 --- a/src/pages/authors/index.astro +++ /dev/null @@ -1,27 +0,0 @@ ---- -import AuthorCard from '@/components/AuthorCard.astro' -import Breadcrumbs from '@/components/Breadcrumbs.astro' -import PageHead from '@/components/PageHead.astro' -import Layout from '@/layouts/Layout.astro' -import { getAllAuthors } from '@/lib/data-utils' - -const authors = await getAllAuthors() ---- - - - - - { - authors.length > 0 ? ( -
    - {authors.map((author) => ( -
  • - -
  • - ))} -
- ) : ( -

No authors found.

- ) - } -
diff --git a/src/pages/members/[...id].astro b/src/pages/members/[...id].astro new file mode 100644 index 0000000..8010365 --- /dev/null +++ b/src/pages/members/[...id].astro @@ -0,0 +1,58 @@ +--- +import BlogCard from '@/components/BlogCard.astro' +import Breadcrumbs from '@/components/Breadcrumbs.astro' +import MemberCard from '@/components/MemberCard.astro' +import PageHead from '@/components/PageHead.astro' +import Layout from '@/layouts/Layout.astro' +import { getAllMembers, getPostsByAuthor } from '@/lib/data-utils' + +export async function getStaticPaths() { + const members = await getAllMembers() + return members.map((member) => ({ + params: { id: member.id }, + props: { member }, + })) +} + +const { member } = Astro.props +const memberPosts = await getPostsByAuthor(member.id) +--- + + + + + +
+ +
+
+

Posts by {member.data.name}

+ { + memberPosts.length > 0 ? ( +
    + {memberPosts + .filter((post) => !post.data.draft) + .map((post) => ( +
  • + +
  • + ))} +
+ ) : ( +

+ No posts available from this member. +

+ ) + } +
+
diff --git a/src/pages/members/index.astro b/src/pages/members/index.astro new file mode 100644 index 0000000..04e6d45 --- /dev/null +++ b/src/pages/members/index.astro @@ -0,0 +1,27 @@ +--- +import Breadcrumbs from '@/components/Breadcrumbs.astro' +import MemberCard from '@/components/MemberCard.astro' +import PageHead from '@/components/PageHead.astro' +import Layout from '@/layouts/Layout.astro' +import { getAllMembers } from '@/lib/data-utils' + +const members = await getAllMembers() +--- + + + + + { + members.length > 0 ? ( +
    + {members.map((member) => ( +
  • + +
  • + ))} +
+ ) : ( +

No members found.

+ ) + } +
-- cgit v1.2.3