From b9561ad2d09fb4b28c91ebeff282f4b761f587e1 Mon Sep 17 00:00:00 2001 From: enscribe Date: Tue, 10 Sep 2024 11:56:46 -0700 Subject: [PATCH] chore: remove more slop --- src/components/CVCard.astro | 23 ---- src/components/Header.astro | 26 +--- src/components/MemberCard.astro | 29 +++++ src/components/ProgressBar.astro | 8 -- src/components/PublicationCard.astro | 106 ---------------- src/consts.ts | 1 - src/content/authors/enscribe.md | 8 ++ src/content/config.ts | 35 +++--- src/content/publications/papertitle1.md | 13 -- src/content/publications/papertitle2.md | 13 -- src/content/publications/papertitle3.md | 13 -- src/layouts/Layout.astro | 1 - src/pages/about.astro | 98 +++++++-------- src/pages/authors/[...slug].astro | 40 ++++++ src/pages/authors/index.astro | 23 ++++ src/pages/blog/index.astro | 42 +++---- src/pages/cv.astro | 74 ----------- src/pages/index.astro | 156 +++--------------------- src/pages/publications/index.astro | 32 ----- src/pages/tags/[...slug].astro | 46 ++++--- src/pages/tags/index.astro | 36 +++--- src/types.ts | 1 - 22 files changed, 237 insertions(+), 587 deletions(-) delete mode 100644 src/components/CVCard.astro create mode 100644 src/components/MemberCard.astro delete mode 100644 src/components/ProgressBar.astro delete mode 100644 src/components/PublicationCard.astro create mode 100644 src/content/authors/enscribe.md delete mode 100644 src/content/publications/papertitle1.md delete mode 100644 src/content/publications/papertitle2.md delete mode 100644 src/content/publications/papertitle3.md create mode 100644 src/pages/authors/[...slug].astro create mode 100644 src/pages/authors/index.astro delete mode 100644 src/pages/cv.astro delete mode 100644 src/pages/publications/index.astro diff --git a/src/components/CVCard.astro b/src/components/CVCard.astro deleted file mode 100644 index 7710e58..0000000 --- a/src/components/CVCard.astro +++ /dev/null @@ -1,23 +0,0 @@ ---- -export interface Props { - institution: string - time: string - job_title: string - location: string - description: string -} - -const { institution, time, job_title, location, description } = Astro.props ---- - -
-
-
{institution}
-
{location}
-
-
-
{job_title}
-
{time}
-
-

{description}

-
diff --git a/src/components/Header.astro b/src/components/Header.astro index 128dd52..a02139e 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -2,7 +2,6 @@ import Container from '@components/Container.astro' import Link from '@components/Link.astro' import { SITE } from '@consts' -import ProgressBar from './ProgressBar.astro' ---
@@ -18,11 +17,7 @@ import ProgressBar from './ProgressBar.astro' {`/`} - research - - {`/`} - - cv + authors {`/`} @@ -34,25 +29,6 @@ import ProgressBar from './ProgressBar.astro' {`/`} - diff --git a/src/components/MemberCard.astro b/src/components/MemberCard.astro new file mode 100644 index 0000000..2ac83b5 --- /dev/null +++ b/src/components/MemberCard.astro @@ -0,0 +1,29 @@ +--- +import type { CollectionEntry } from "astro:content"; +import { Image } from "astro:assets"; + +type Props = { + member: CollectionEntry<"authors">; +}; + +const { member } = Astro.props; +const { name, avatar, bio } = member.data; +--- + + diff --git a/src/components/ProgressBar.astro b/src/components/ProgressBar.astro deleted file mode 100644 index 4990ee7..0000000 --- a/src/components/ProgressBar.astro +++ /dev/null @@ -1,8 +0,0 @@ -
-
-
- - diff --git a/src/components/PublicationCard.astro b/src/components/PublicationCard.astro deleted file mode 100644 index 2ed2f44..0000000 --- a/src/components/PublicationCard.astro +++ /dev/null @@ -1,106 +0,0 @@ ---- -import type { CollectionEntry } from 'astro:content' -import { Image } from 'astro:assets' - -type Props = { - entry: CollectionEntry<'publications'> -} - -const { entry } = Astro.props as { - entry: CollectionEntry<'publications'> -} - -const splitStr = (authors: string | undefined, targetAuthor: string) => { - if (!authors) return [] - const parts = authors.split(new RegExp(`(${targetAuthor})`, 'g')) - return parts -} -const decomposeURL = (URL: string | undefined) => { - if (!URL) return { text: '', url: '' } - const parts = URL.split(': ') - return { text: parts[0], url: parts[1] } -} - -const dataLink = decomposeURL(entry.data.dataURL) -const paperLink = decomposeURL(entry.data.paperURL) -const codeLink = decomposeURL(entry.data.codeURL) -const webLink = decomposeURL(entry.data.webURL) ---- - -
- - -
-
-
-
- {entry.data.title} -
-
- {entry.data.authors} -
-
- { - paperLink.url != '' && ( - - {paperLink.text} - - ) - } - { - codeLink.url != '' && ( - - {codeLink.text} - - ) - } - { - webLink.url != '' && ( - - {webLink.text} - - ) - } - { - dataLink.url != '' && ( - - {dataLink.text} - - ) - } -
-
- In
{entry.data.pub}
-
-
-

- {entry.data.description} -

-
-
-
diff --git a/src/consts.ts b/src/consts.ts index fc94897..779bae1 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -5,6 +5,5 @@ export const SITE: Site = { DESCRIPTION: 'Astro Micro Academics is for academic user.', EMAIL: 'youremial@gmail.com', NUM_POSTS_ON_HOMEPAGE: 2, - NUM_PUBLICATIONS_ON_HOMEPAGE: 3, SITEURL: 'https://astro-micro-academic.vercel.app', // Update here to link the RSS icon to your website rss } diff --git a/src/content/authors/enscribe.md b/src/content/authors/enscribe.md new file mode 100644 index 0000000..6ef2cf5 --- /dev/null +++ b/src/content/authors/enscribe.md @@ -0,0 +1,8 @@ +--- +name: "enscribe" +avatar: "https://gravatar.com/avatar/9bfdc4ec972793cf05cb91efce5f4aaaec2a0da1bf4ec34dad0913f1d845faf6.webp?size=256" +bio: "d(-_-)b" +website: "https://enscribe.dev" +twitter: "enscry" +github: "jktrn" +--- \ No newline at end of file diff --git a/src/content/config.ts b/src/content/config.ts index ff18d85..cf710ee 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -1,7 +1,7 @@ -import { defineCollection, z } from 'astro:content' +import { defineCollection, reference, z } from "astro:content"; const blog = defineCollection({ - type: 'content', + type: "content", schema: z.object({ title: z.string(), description: z.string(), @@ -9,24 +9,23 @@ const blog = defineCollection({ draft: z.boolean().optional(), tags: z.array(z.string()).optional(), + author: z.union([reference("authors"), z.string()]).optional(), }), -}) +}); -const publications = defineCollection({ - type: 'content', +const authors = defineCollection({ + type: "content", schema: z.object({ - title: z.string(), - description: z.string(), - date: z.coerce.date(), - paperURL: z.string().optional(), - authors: z.string().optional(), - codeURL: z.string().optional(), - webURL: z.string().optional(), - dataURL: z.string().optional(), - img: z.string().optional(), - imgAlt: z.string().optional(), - pub: z.string().optional(), + name: z.string(), + avatar: z.string().url(), + bio: z.string().optional(), + website: z.string().url().optional(), + twitter: z.string().optional(), + github: z.string().optional(), + linkedin: z.string().optional(), + mail: z.string().email().optional(), + discord: z.string().optional(), }), -}) +}); -export const collections = { blog, publications } +export const collections = { blog, authors }; diff --git a/src/content/publications/papertitle1.md b/src/content/publications/papertitle1.md deleted file mode 100644 index 559fd7b..0000000 --- a/src/content/publications/papertitle1.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 'Paper Title1' -description: 'Your Paper Abstract' -date: '2024-03-26' -authors: 'John B*, Jon A*, Frank C, ' -paperURL: 'Paper: https://astro-sphere-demo.vercel.app' -codeURL: 'Code: https://astro-sphere-demo.vercel.app' -webURL: 'Web: https://github.com/markhorn-dev/astro-sphere' -img: '/rupert-cat.gif' -imgAlt: 'Paper Teaser' -pub: 'ECCV2024' -dataURL: 'Data: ' ---- diff --git a/src/content/publications/papertitle2.md b/src/content/publications/papertitle2.md deleted file mode 100644 index 7c7bdd2..0000000 --- a/src/content/publications/papertitle2.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 'Paper Title1' -description: 'Lorem ipsum dolor sit amet consectetur adipisicing elit. ' -date: '2024-07-26' -authors: 'John B*, Jon A*, Frank C, John B, Jon A, Frank C, ' -paperURL: 'Paper: https://astro-sphere-demo.vercel.app' -codeURL: 'Code: https://astro-sphere-demo.vercel.app' -webURL: 'Web: https://github.com/markhorn-dev/astro-sphere' -img: '/rupert-cat.gif' -imgAlt: 'Paper Teaser' -pub: 'ECCV2024' -dataURL: 'Data: https://github.com/markhorn-dev/astro-sphere' ---- diff --git a/src/content/publications/papertitle3.md b/src/content/publications/papertitle3.md deleted file mode 100644 index 559fd7b..0000000 --- a/src/content/publications/papertitle3.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -title: 'Paper Title1' -description: 'Your Paper Abstract' -date: '2024-03-26' -authors: 'John B*, Jon A*, Frank C, ' -paperURL: 'Paper: https://astro-sphere-demo.vercel.app' -codeURL: 'Code: https://astro-sphere-demo.vercel.app' -webURL: 'Web: https://github.com/markhorn-dev/astro-sphere' -img: '/rupert-cat.gif' -imgAlt: 'Paper Teaser' -pub: 'ECCV2024' -dataURL: 'Data: ' ---- diff --git a/src/layouts/Layout.astro b/src/layouts/Layout.astro index e35813a..68c600c 100644 --- a/src/layouts/Layout.astro +++ b/src/layouts/Layout.astro @@ -17,7 +17,6 @@ const { title, description } = Astro.props -
diff --git a/src/pages/about.astro b/src/pages/about.astro index d313065..6c5f143 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -7,60 +7,56 @@ import { Image } from 'astro:assets' - + diff --git a/src/pages/authors/[...slug].astro b/src/pages/authors/[...slug].astro new file mode 100644 index 0000000..98d4413 --- /dev/null +++ b/src/pages/authors/[...slug].astro @@ -0,0 +1,40 @@ +--- +import { type CollectionEntry, getCollection, getEntry } from "astro:content"; +import Layout from "@layouts/Layout.astro"; +import MemberCard from "@components/MemberCard.astro"; + +export async function getStaticPaths() { + const authors = await getCollection("authors"); + return authors.map((member) => ({ + params: { slug: member.slug }, + props: { member }, + })); +} + +type Props = { + member: CollectionEntry<"authors">; +}; + +const { member } = Astro.props; + +const allPosts = await getCollection("blog"); +const memberPosts = allPosts + .filter((post) => { + if (typeof post.data.author === 'string') { + return post.data.author === member.data.name && !post.data.draft; + } else if (post.data.author && 'slug' in post.data.author) { + return post.data.author.slug === member.slug && !post.data.draft; + } + return false; + }) + .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()); +--- + + +
+ +
+
diff --git a/src/pages/authors/index.astro b/src/pages/authors/index.astro new file mode 100644 index 0000000..5654ee3 --- /dev/null +++ b/src/pages/authors/index.astro @@ -0,0 +1,23 @@ +--- +import { getCollection } from "astro:content"; +import Layout from "@layouts/Layout.astro"; +import MemberCard from "@components/MemberCard.astro"; + +const authors = await getCollection("authors"); +--- + + +
+
    + { + authors.map((member) => ( +
  • + +
  • + )) + } +
+
+
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 1e74257..bd7c5e4 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -26,29 +26,25 @@ const years = Object.keys(posts).sort((a, b) => parseInt(b) - parseInt(a)) - + diff --git a/src/pages/cv.astro b/src/pages/cv.astro deleted file mode 100644 index a9b58b9..0000000 --- a/src/pages/cv.astro +++ /dev/null @@ -1,74 +0,0 @@ ---- -import { getCollection } from 'astro:content' -import Layout from '@layouts/Layout.astro' -import Container from '@components/Container.astro' -import CVCard from '@components/CVCard.astro' - -// TO Modify -const works = [ - { - company: 'Company A', - time: '2022-Present', - job_title: 'Research Scientist', - location: 'London, UK', - description: 'Your Notes about the job', - }, - { - company: 'Company A', - time: '2022-Present', - job_title: 'Research Scientist', - location: 'London, UK', - description: 'Your Notes about the job', - }, -] -const educations = [ - { - school: 'University 1', - time: '2022-Present', - job_title: 'BEng in Electronic Information Engineering', - location: 'London, UK', - description: 'Your Notes about the study', - }, -] ---- - - - - - - diff --git a/src/pages/index.astro b/src/pages/index.astro index 9314296..4938b67 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,158 +6,30 @@ import ArrowCard from '@components/ArrowCard.astro' import Link from '@components/Link.astro' import { getCollection } from 'astro:content' import type { CollectionEntry } from 'astro:content' -import PublicationCard from '@components/PublicationCard.astro' import SocialIcons from '@components/SocialIcons.astro' const blog = (await getCollection('blog')) .filter((post) => !post.data.draft) .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()) .slice(0, SITE.NUM_POSTS_ON_HOMEPAGE) - -const publications: CollectionEntry<'publications'>[] = ( - await getCollection('publications') -) - .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()) - .slice(0, SITE.NUM_PUBLICATIONS_ON_HOMEPAGE) --- - +
    + { + blog.map((post) => ( +
  • + +
  • + )) + } +
+
diff --git a/src/pages/publications/index.astro b/src/pages/publications/index.astro deleted file mode 100644 index d8f775c..0000000 --- a/src/pages/publications/index.astro +++ /dev/null @@ -1,32 +0,0 @@ ---- -import { getCollection } from 'astro:content' -import Layout from '@layouts/Layout.astro' -import Container from '@components/Container.astro' -import PublicationCard from '@components/PublicationCard.astro' -// import PublicationCard from "@components/PublicationCard"; - -const publications = (await getCollection('publications')).sort( - (a, b) => b.data.date.valueOf() - a.data.date.valueOf(), -) ---- - - - - - - diff --git a/src/pages/tags/[...slug].astro b/src/pages/tags/[...slug].astro index fa38b67..33080d6 100644 --- a/src/pages/tags/[...slug].astro +++ b/src/pages/tags/[...slug].astro @@ -35,30 +35,28 @@ export async function getStaticPaths() { description={`A collection of posts tagged with ${tag}.`} > - +
+ { + posts.map((post) => ( +
+
+
    +
  • + +
  • +
+
+
+ )) + } +
+
diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro index 27f1651..9fc3125 100644 --- a/src/pages/tags/index.astro +++ b/src/pages/tags/index.astro @@ -13,24 +13,22 @@ const tags = blog - +
+
Tags
+ +
diff --git a/src/types.ts b/src/types.ts index 581b6a8..9b05741 100644 --- a/src/types.ts +++ b/src/types.ts @@ -3,6 +3,5 @@ export type Site = { DESCRIPTION: string EMAIL: string NUM_POSTS_ON_HOMEPAGE: number - NUM_PUBLICATIONS_ON_HOMEPAGE: number SITEURL: string }