diff --git a/astro.config.mjs b/astro.config.mjs index 76ea6b6..052abbe 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -8,5 +8,9 @@ import svelte from "@astrojs/svelte"; // https://astro.build/config export default defineConfig({ site: "https://skyfall.dev", - integrations: [mdx(), sitemap(), tailwind(), svelte()] + integrations: [mdx(), sitemap(), tailwind(), svelte()], + output: "hybrid", // or 'server' + experimental: { + actions: true, + }, }); \ No newline at end of file diff --git a/bun.lockb b/bun.lockb index dfd9739..f20fe4c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 7197abd..47cf3bc 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "@astrojs/sitemap": "^3.1.6", "@astrojs/tailwind": "^5.1.0", "@catppuccin/tailwindcss": "^0.1.6", + "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/typography": "^0.5.13", "astro": "^4.11.5", "prettier": "^3.3.2", diff --git a/src/actions/index.ts b/src/actions/index.ts new file mode 100644 index 0000000..df9fcb1 --- /dev/null +++ b/src/actions/index.ts @@ -0,0 +1,45 @@ +import { defineAction } from "astro:actions"; +import { Octokit } from "octokit"; + +export const server = { + getGitHubActivity: defineAction({ + handler: async () => { + const octokit = new Octokit({ + auth: import.meta.env.GITHUB_TOKEN, + }); + let events: any[] = []; + while (true) { + const newEvents = await octokit.rest.activity.listPublicEventsForUser({ + username: "SkyfallWasTaken", + }); + if (newEvents.data.length === 0) { + break; + } + events = [...events, ...newEvents.data]; + } + + const eventsMap: Map = new Map(); + events.forEach((event) => { + if (!event.created_at) return; + + let count = eventsMap.get(event.created_at); + if (!count) { + eventsMap.set(event.created_at, 1); + } else { + count += 1; + eventsMap.set(event.created_at, count); + } + }); + + const array: { date: string; activities: any[] }[] = []; + eventsMap.forEach((value, key) => { + array.push({ + date: key.slice(0, 10), + activities: Array(value).fill({}), + }); + }); + console.log(array); + return array; + }, + }), +}; diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index daebae6..74a428f 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -2,6 +2,7 @@ // 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 { ViewTransitions } from "astro:transitions"; interface Props { title: string; @@ -49,3 +50,6 @@ const { title, description, image = "/blog-placeholder-1.jpg" } = Astro.props; + + + \ No newline at end of file diff --git a/src/components/homepage/GitHubHeatmap.svelte b/src/components/homepage/GitHubHeatmap.svelte index be2374e..81481f6 100644 --- a/src/components/homepage/GitHubHeatmap.svelte +++ b/src/components/homepage/GitHubHeatmap.svelte @@ -1,40 +1,10 @@
- {#await loadGitHubActivity()} + {#await actions.getGitHubActivity()}

Give us a mo...

{:then data} diff --git a/src/env.d.ts b/src/env.d.ts index acef35f..83f08d1 100644 --- a/src/env.d.ts +++ b/src/env.d.ts @@ -1,2 +1,3 @@ +/// /// /// diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index a6768e2..b040af3 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -40,11 +40,8 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props; { heroImage && ( ) @@ -61,5 +58,10 @@ const { title, description, pubDate, updatedDate, heroImage } = Astro.props;