From 0b958ae3ebadc595b71654c4856f82a9e533df59 Mon Sep 17 00:00:00 2001 From: voidarc Date: Wed, 11 Nov 2026 16:18:03 +0000 Subject: [PATCH] added diff info and hover for commits --- src/lib/server/gitea.ts | 16 +++++++++-- src/routes/Commits.svelte | 60 +++++++++++++++++++++++++-------------- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/src/lib/server/gitea.ts b/src/lib/server/gitea.ts index 5e7720b..b7fcd17 100644 --- a/src/lib/server/gitea.ts +++ b/src/lib/server/gitea.ts @@ -7,6 +7,13 @@ export interface GitCommit { url: string; timestamp: Date; user: string; + diff: Diff; +} + +export interface Diff { + additions: number; + deletions: number; + total: number; } const CACHE_TTL = 3 * 60 * 60 * 1000; @@ -68,12 +75,17 @@ async function fetchLatestCommits( let newCommit: GitCommit = { message: commit.commit.message, hash: commit.sha, - shortHash: commit.sha.substring(0, 8), + shortHash: commit.sha.substring(0, 6), timestamp: new Date(commit.created), url: commit.html_url, parentRepo: repo.full_name, parentBranch: 'main', // I know this is a shit solution - user: commit.commit.author.name + user: commit.commit.author.name, + diff: { + additions: commit.stats.additions, + deletions: commit.stats.deletions, + total: commit.stats.total + } }; commitList.push(newCommit); } diff --git a/src/routes/Commits.svelte b/src/routes/Commits.svelte index 3f339ab..4ca7f81 100644 --- a/src/routes/Commits.svelte +++ b/src/routes/Commits.svelte @@ -162,35 +162,53 @@
- {#each visibleItems as item, index (item.hash)} + {#each visibleItems as commit, index (commit.hash)}
{/each}