diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..35a82db --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "plugins": ["prettier-plugin-astro"], + "overrides": + [{ "files": "*.astro", "*.md", "*.mdx", "options": { "parser": "astro" } }], +} diff --git a/package-lock.json b/package-lock.json index 3884fcf..6240774 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,12 @@ "@astrojs/rss": "^4.0.15", "@astrojs/sitemap": "^3.7.0", "astro": "^5.17.1", - "prettier": "^3.8.1", "sharp": "^0.34.3", "typescript": "^5.9.3" + }, + "devDependencies": { + "prettier": "3.8.1", + "prettier-plugin-astro": "0.14.1" } }, "node_modules/@astrojs/check": { @@ -5005,6 +5008,21 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-astro": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-astro/-/prettier-plugin-astro-0.14.1.tgz", + "integrity": "sha512-RiBETaaP9veVstE4vUwSIcdATj6dKmXljouXc/DDNwBSPTp8FRkLGDSGFClKsAFeeg+13SB0Z1JZvbD76bigJw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@astrojs/compiler": "^2.9.1", + "prettier": "^3.0.0", + "sass-formatter": "^0.7.6" + }, + "engines": { + "node": "^14.15.0 || >=16.0.0" + } + }, "node_modules/prismjs": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", @@ -5447,6 +5465,23 @@ "fsevents": "~2.3.2" } }, + "node_modules/s.color": { + "version": "0.0.15", + "resolved": "https://registry.npmjs.org/s.color/-/s.color-0.0.15.tgz", + "integrity": "sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/sass-formatter": { + "version": "0.7.9", + "resolved": "https://registry.npmjs.org/sass-formatter/-/sass-formatter-0.7.9.tgz", + "integrity": "sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "suf-log": "^2.5.3" + } + }, "node_modules/sax": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/sax/-/sax-1.5.0.tgz", @@ -5681,6 +5716,16 @@ "inline-style-parser": "0.2.7" } }, + "node_modules/suf-log": { + "version": "2.5.3", + "resolved": "https://registry.npmjs.org/suf-log/-/suf-log-2.5.3.tgz", + "integrity": "sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "s.color": "0.0.15" + } + }, "node_modules/svgo": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/svgo/-/svgo-4.0.1.tgz", diff --git a/package.json b/package.json index 3dd1d6e..7323d48 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,11 @@ "@astrojs/rss": "^4.0.15", "@astrojs/sitemap": "^3.7.0", "astro": "^5.17.1", - "prettier": "^3.8.1", "sharp": "^0.34.3", "typescript": "^5.9.3" + }, + "devDependencies": { + "prettier": "3.8.1", + "prettier-plugin-astro": "0.14.1" } } diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 6b4ad3b..f9ea08b 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -1,14 +1,14 @@ --- // Import the global.css file here so that it is included on // all pages through the use of the component. -import '@styles/global.css'; -import type { ImageMetadata } from 'astro'; -import { SITE_TITLE } from '@ptypes/consts.ts'; +import "@styles/global.css"; +import type { ImageMetadata } from "astro"; +import { SITE_TITLE } from "@ptypes/consts.ts"; interface Props { - title: string; - description: string; - image?: ImageMetadata; + title: string; + description: string; + image?: ImageMetadata; } const canonicalURL = new URL(Astro.url.pathname, Astro.site); @@ -23,16 +23,28 @@ const { title, description } = Astro.props; - - + + diff --git a/src/components/FormattedDate.astro b/src/components/FormattedDate.astro index 1bcce73..8f59590 100644 --- a/src/components/FormattedDate.astro +++ b/src/components/FormattedDate.astro @@ -1,17 +1,17 @@ --- interface Props { - date: Date; + date: Date; } const { date } = Astro.props; --- diff --git a/src/components/Header.astro b/src/components/Header.astro index ad378f9..0abb1e0 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -1,46 +1,49 @@ --- -import { SITE_TITLE } from '@ptypes/consts.ts'; -import HeaderLink from '@components/HeaderLink.astro'; -import '@styles/indexHoverCss.css'; -import { getCollection } from 'astro:content'; +import { SITE_TITLE } from "@ptypes/consts.ts"; +import HeaderLink from "@components/HeaderLink.astro"; +import "@styles/indexHoverCss.css"; +import { getCollection } from "astro:content"; -const personalPosts = (await getCollection('personal')).sort( - (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), +const personalPosts = (await getCollection("personal")).sort( + (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), ); -const uniPosts = (await getCollection('uni')).sort( - (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), +const uniPosts = (await getCollection("uni")).sort( + (a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(), ); --- - + + - - - - - - + + + + + + diff --git a/src/components/HeaderLink.astro b/src/components/HeaderLink.astro index be56944..e214196 100644 --- a/src/components/HeaderLink.astro +++ b/src/components/HeaderLink.astro @@ -1,21 +1,20 @@ --- -import type { HTMLAttributes } from 'astro/types'; +import type { HTMLAttributes } from "astro/types"; -type Props = HTMLAttributes<'a'>; +type Props = HTMLAttributes<"a">; const { href, class: className, ...props } = Astro.props; -const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ''); +const pathname = Astro.url.pathname.replace(import.meta.env.BASE_URL, ""); const subpath = pathname.match(/[^\/]+/g); -const isActive = href === pathname || href === '/' + (subpath?.[0] || ''); +const isActive = href === pathname || href === "/" + (subpath?.[0] || ""); --- - + - - - - - - - + + + + + + diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index f247b59..eea8eaa 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -1,52 +1,58 @@ --- -import BaseHead from '@components/BaseHead.astro'; -import Header from '@components/Header.astro'; -import GithubIcon from '@assets/github.svg' +import BaseHead from "@components/BaseHead.astro"; +import Header from "@components/Header.astro"; +import GithubIcon from "@assets/github.svg"; const { title, description, gitLink } = Astro.props; --- - - - - + - - - - -
-
-
- - - - -
- -
- + +
+
+
+ + + + +
+
+ diff --git a/src/pages/blog/personal/[id].astro b/src/pages/blog/personal/[id].astro index 7ec8b3b..2010429 100644 --- a/src/pages/blog/personal/[id].astro +++ b/src/pages/blog/personal/[id].astro @@ -1,6 +1,6 @@ --- -import { getCollection, render } from 'astro:content'; -import BlogPost from '@layouts/BlogPost.astro'; +import { getCollection, render } from "astro:content"; +import BlogPost from "@layouts/BlogPost.astro"; import type { InferGetStaticParamsType, InferGetStaticPropsType, @@ -8,11 +8,11 @@ import type { } from "astro"; export async function getStaticPaths() { - const posts = await getCollection('personal'); - return posts.map(post => ({ - params: { id: post.id }, - props: { post }, - })); + const posts = await getCollection("personal"); + return posts.map((post) => ({ + params: { id: post.id }, + props: { post }, + })); } getStaticPaths satisfies GetStaticPaths; @@ -25,5 +25,5 @@ const { Content } = await render(post); --- - + diff --git a/src/pages/blog/university/[id].astro b/src/pages/blog/university/[id].astro index c3b2bf4..57878e4 100644 --- a/src/pages/blog/university/[id].astro +++ b/src/pages/blog/university/[id].astro @@ -1,6 +1,6 @@ --- -import { getCollection, render } from 'astro:content'; -import BlogPost from '@layouts/BlogPost.astro'; +import { getCollection, render } from "astro:content"; +import BlogPost from "@layouts/BlogPost.astro"; import type { InferGetStaticParamsType, InferGetStaticPropsType, @@ -8,11 +8,11 @@ import type { } from "astro"; export async function getStaticPaths() { - const posts = await getCollection('uni'); - return posts.map(post => ({ - params: { id: post.id }, - props: { post }, - })); + const posts = await getCollection("uni"); + return posts.map((post) => ({ + params: { id: post.id }, + props: { post }, + })); } getStaticPaths satisfies GetStaticPaths; @@ -25,5 +25,5 @@ const { Content } = await render(post); --- - + diff --git a/src/pages/index.astro b/src/pages/index.astro index a690f9a..0133d37 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -1,143 +1,182 @@ --- -import BaseHead from '@components/BaseHead.astro'; -import Header from '@components/Header.astro'; -import { SITE_DESCRIPTION, SITE_TITLE } from '@ptypes/consts.ts'; +import BaseHead from "@components/BaseHead.astro"; +import Header from "@components/Header.astro"; +import { SITE_DESCRIPTION, SITE_TITLE } from "@ptypes/consts.ts"; + +let top: string[] = []; +let bottom: string[] = []; +const api: string = + "https://fshare.kami.boo/api/server/folder/cmm9jbqvt00025omwu5cnpw9i"; +const response = await fetch(api); -let shuffled: string[] = []; -let images: string[] = []; -const api: string = 'https://fshare.kami.boo/api/server/folder/cmm9jbqvt00025omwu5cnpw9i'; -const response = await fetch(api) if (response.ok) { - const data = await response.json(); - const files = data.files.map((f: Response) => `https://fshare.kami.boo/raw${f.url.substring(2)}`).sort(() => Math.random() - .5) as string[]; - const middle = Math.round(files.length / 2); - shuffled = files.slice(0,middle); - images = files.slice(middle); - } else { - const errorBody = await response.text(); - console.error("FAILED TO FETCH", response.status, response.statusText, errorBody); - process.exit(1); - } + const data = await response.json(); + const files = data.files.map( + (f: Response) => `https://fshare.kami.boo/raw${f.url.substring(2)}`, + ) as string[]; + const middle = Math.round(files.length / 2); + top = files.slice(0, middle); + bottom = files.slice(middle); +} else { + const errorBody = await response.text(); + console.error( + "FAILED TO FETCH", + response.status, + response.statusText, + errorBody, + ); + process.exit(1); +} --- - + - - - - - -
- + @keyframes infiniteScrollReverse { + 0% { + transform: translateX(0%); + } + 100% { + transform: translateX(50%); + } + } + + + +
+ -
- + +