commit menu looking sick asl

This commit is contained in:
2026-11-10 17:11:44 +00:00
parent 38ce5f3554
commit aceee88132
4 changed files with 52 additions and 28 deletions

View File

@@ -2,8 +2,11 @@ export interface GitCommit {
message: string;
hash: string;
shortHash: string;
parentRepo: string;
parentBranch: string;
url: string;
timestamp: Date;
user: string;
}
async function getGiteaRepos(fetch: typeof globalThis.fetch) {
@@ -41,31 +44,31 @@ async function getRepoCommits(fetch: typeof globalThis.fetch, url: string) {
return finalData;
}
export async function getLatestCommits(fetch: typeof globalThis.fetch, count: number): GitCommit[] {
export async function getLatestCommits(
fetch: typeof globalThis.fetch,
count: number
): Promise<GitCommit[]> {
const repos = await getGiteaRepos(fetch);
let commitList = [];
let commitList: GitCommit[] = [];
for (let repo of repos) {
console.log(repo.name);
let commits = await getRepoCommits(fetch, repo.url);
for (let commit of commits) {
commitList.push(commit);
console.log('pushed');
console.log(commit);
let newCommit: GitCommit = {
message: commit.commit.message,
hash: commit.sha,
shortHash: commit.sha.substring(0, 8),
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
};
commitList.push(newCommit);
}
}
commitList.sort((a, b) => new Date(b.created).getTime() - new Date(a.created).getTime());
commitList.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime());
let interfaceCommitList: GitCommit[] = [];
for (let commit of commitList) {
let commitObject: GitCommit = {
message: commit.commit.message,
hash: commit.sha,
shortHash: commit.sha.substring(0, 8),
timestamp: new Date(commit.created),
url: commit.html_url
};
interfaceCommitList.push(commitObject);
}
return interfaceCommitList.slice(0, count);
return commitList.slice(0, count);
}

View File

@@ -19,7 +19,7 @@ export const load: PageServerLoad = () => {
const latestBook = getLatestBook(globalThis.fetch, KOMGA_LIBRARY_ID);
const contentItems: ContentItem = getContentItems(globalThis.fetch, CHANNEL_ID, BLOG_URL);
const latestCommits: GitCommit = getLatestCommits(globalThis.fetch, 10);
const latestCommits: GitCommit = getLatestCommits(globalThis.fetch, 20);
latestSong.catch(() => {});
latestSeries.catch(() => {});

View File

@@ -15,7 +15,7 @@
</div>
<span class="absolute text-ctp-mauve">[VOIDARC INCORPORATED]</span>
</div>
<div class="m-6 mx-auto grid max-w-6xl grid-flow-row auto-rows-min gap-5">
<div class="m-6 mx-auto grid max-w-7xl grid-flow-row auto-rows-min gap-5">
<div
class="main-container grid grid-cols-[2fr_1fr] py-7 pl-10"
style="--container-color:var(--ctp-mauve);"
@@ -161,7 +161,7 @@
</div>
</div>
</div>
<div class="grid grid-cols-[4fr_3fr] grid-rows-1 gap-4">
<div class="grid grid-cols-[9fr_7fr] grid-rows-1 gap-4">
<div class="main-container" style="--container-color:var(--ctp-blue);">
<div class="section-title fira-mono-bold mr-3 flex py-2 text-4xl">
Content <div class="flex w-full flex-row-reverse items-center gap-4 pr-4">

View File

@@ -69,7 +69,10 @@
y2={nodePositions[index + 1].y}
stroke="currentColor"
stroke-width="2"
class="text-ctp-green"
stroke-dasharray={items[index + 1]?.parentRepo != items[index].parentRepo ? '5,4' : '0'}
class={items[index + 1]?.parentRepo == items[index].parentRepo
? 'text-ctp-green'
: 'text-ctp-surface2'}
stroke-linecap="round"
/>
{/if}
@@ -89,17 +92,35 @@
{/each}
</svg>
<!-- Article list -->
<div class="mt-3 mr-3 grid grid-flow-row auto-rows-min">
{#each items as item, index (item.hash)}
<div class="relative z-10 grid grid-cols-[1.25rem_minmax(0,1fr)] gap-x-3.5 gap-y-4 pb-3">
<div class="relative z-10 grid grid-cols-[1.25rem_minmax(0,1fr)] gap-x-3.5 gap-y-2 pb-2">
<!-- Timeline space -->
<div></div>
<!-- Article card -->
<div bind:this={cardElements[index]} class="min-w-0">
<a href={item.link} class="group flex">
<p class="rounded-md bg-ctp-surface2 px-1">{item.shortHash}</p>
<a href={item.link} class="group block">
{#if items[index - 1]?.parentRepo != item.parentRepo}
<p class="flex flex-row pt-2">
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 24 24"
height="20px"
width="20px"
class="pt-1"
fill="#e3e3e3"
><path d="M16.18,13H4V11H16.18l-5.6-5.6L12,4l8,8l-8,8l-1.42-1.4l5.6-5.6Z" /></svg
>
<span class="mx-[1ch] text-ctp-red">{item.user}</span> on
<span class="ml-[1ch] text-ctp-mauve">{item.parentRepo}</span><span
class="text-ctp-yellow">@</span
><span class="text-ctp-green">{item.parentBranch}</span>
</p>
{/if}
<div class="flex">
<p class="rounded-md bg-ctp-surface2 px-1">{item.shortHash}</p>
<p class="ml-2 line-clamp-1">{item.message}</p>
</div>
</a>
</div>
</div>