commit menu looking sick asl
This commit is contained in:
@@ -2,8 +2,11 @@ export interface GitCommit {
|
|||||||
message: string;
|
message: string;
|
||||||
hash: string;
|
hash: string;
|
||||||
shortHash: string;
|
shortHash: string;
|
||||||
|
parentRepo: string;
|
||||||
|
parentBranch: string;
|
||||||
url: string;
|
url: string;
|
||||||
timestamp: Date;
|
timestamp: Date;
|
||||||
|
user: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getGiteaRepos(fetch: typeof globalThis.fetch) {
|
async function getGiteaRepos(fetch: typeof globalThis.fetch) {
|
||||||
@@ -41,31 +44,31 @@ async function getRepoCommits(fetch: typeof globalThis.fetch, url: string) {
|
|||||||
return finalData;
|
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);
|
const repos = await getGiteaRepos(fetch);
|
||||||
|
|
||||||
let commitList = [];
|
let commitList: GitCommit[] = [];
|
||||||
for (let repo of repos) {
|
for (let repo of repos) {
|
||||||
console.log(repo.name);
|
|
||||||
let commits = await getRepoCommits(fetch, repo.url);
|
let commits = await getRepoCommits(fetch, repo.url);
|
||||||
for (let commit of commits) {
|
for (let commit of commits) {
|
||||||
commitList.push(commit);
|
console.log(commit);
|
||||||
console.log('pushed');
|
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[] = [];
|
return commitList.slice(0, count);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const load: PageServerLoad = () => {
|
|||||||
const latestBook = getLatestBook(globalThis.fetch, KOMGA_LIBRARY_ID);
|
const latestBook = getLatestBook(globalThis.fetch, KOMGA_LIBRARY_ID);
|
||||||
|
|
||||||
const contentItems: ContentItem = getContentItems(globalThis.fetch, CHANNEL_ID, BLOG_URL);
|
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(() => {});
|
latestSong.catch(() => {});
|
||||||
latestSeries.catch(() => {});
|
latestSeries.catch(() => {});
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span class="absolute text-ctp-mauve">[VOIDARC INCORPORATED]</span>
|
<span class="absolute text-ctp-mauve">[VOIDARC INCORPORATED]</span>
|
||||||
</div>
|
</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
|
<div
|
||||||
class="main-container grid grid-cols-[2fr_1fr] py-7 pl-10"
|
class="main-container grid grid-cols-[2fr_1fr] py-7 pl-10"
|
||||||
style="--container-color:var(--ctp-mauve);"
|
style="--container-color:var(--ctp-mauve);"
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</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="main-container" style="--container-color:var(--ctp-blue);">
|
||||||
<div class="section-title fira-mono-bold mr-3 flex py-2 text-4xl">
|
<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">
|
Content <div class="flex w-full flex-row-reverse items-center gap-4 pr-4">
|
||||||
|
|||||||
@@ -69,7 +69,10 @@
|
|||||||
y2={nodePositions[index + 1].y}
|
y2={nodePositions[index + 1].y}
|
||||||
stroke="currentColor"
|
stroke="currentColor"
|
||||||
stroke-width="2"
|
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"
|
stroke-linecap="round"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -89,17 +92,35 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<!-- Article list -->
|
|
||||||
<div class="mt-3 mr-3 grid grid-flow-row auto-rows-min">
|
<div class="mt-3 mr-3 grid grid-flow-row auto-rows-min">
|
||||||
{#each items as item, index (item.hash)}
|
{#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 -->
|
<!-- Timeline space -->
|
||||||
<div></div>
|
<div></div>
|
||||||
|
|
||||||
<!-- Article card -->
|
|
||||||
<div bind:this={cardElements[index]} class="min-w-0">
|
<div bind:this={cardElements[index]} class="min-w-0">
|
||||||
<a href={item.link} class="group flex">
|
<a href={item.link} class="group block">
|
||||||
<p class="rounded-md bg-ctp-surface2 px-1">{item.shortHash}</p>
|
{#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>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user