added diff to commits

This commit is contained in:
2026-11-15 17:56:08 +00:00
parent 0b958ae3eb
commit d838bd4960
2 changed files with 17 additions and 4 deletions

View File

@@ -52,9 +52,10 @@ async function getRepoCommits(fetch: typeof globalThis.fetch, url: string) {
let finalData = []; let finalData = [];
for (let commit of data) { for (let commit of data) {
// Filter out other users // Filter out other users and do a null check for non-gitea commits that might exist
if (commit.author.login == 'voidarc') { if (commit.author != null && commit.author.login == 'voidarc') {
finalData.push(commit); finalData.push(commit);
} else {
} }
} }
@@ -71,7 +72,7 @@ async function fetchLatestCommits(
for (let repo of repos) { for (let repo of repos) {
let commits = await getRepoCommits(fetch, repo.url); let commits = await getRepoCommits(fetch, repo.url);
for (let commit of commits) { for (let commit of commits) {
console.log(commit); // console.log(commit);
let newCommit: GitCommit = { let newCommit: GitCommit = {
message: commit.commit.message, message: commit.commit.message,
hash: commit.sha, hash: commit.sha,

View File

@@ -206,7 +206,19 @@
{commit.shortHash} {commit.shortHash}
</p> </p>
<p class="ml-2 line-clamp-1 group-hover:font-semibold">{commit.message}</p> <p class="ml-2 line-clamp-1 group-hover:font-semibold">{commit.message}</p>
<div class="justify-content-end flex text-align-right flex-1"><div>some</div></div> <div class="flex flex-1 flex-row">
<!-- spacer -->
<div class="flex-1"></div>
<div class="mx-1 mr-2 flex flex-row font-bold text-ctp-mantle">
{#if commit.diff.deletions > 0}
<div class="rounded-l-lg bg-ctp-green px-1">+{commit.diff.additions}</div>
<div class="rounded-r-lg bg-ctp-red px-1">-{commit.diff.deletions}</div>
{:else}
<div class="rounded-lg bg-ctp-green px-1">+{commit.diff.additions}</div>
{/if}
</div>
</div>
</a> </a>
</div> </div>
</div> </div>