Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Jan 15, 2025
1 parent f264ec5 commit 06b28e4
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .astro/data-store.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[["Map",1,2],"meta::meta",["Map",3,4],"astro-version","5.0.5"]
[["Map",1,2],"meta::meta",["Map",3,4,5,6],"astro-version","5.1.4","astro-config-digest","{\"root\":{},\"srcDir\":{},\"publicDir\":{},\"outDir\":{},\"cacheDir\":{},\"site\":\"HTTP://localhost\",\"compressHTML\":false,\"base\":\"/\",\"trailingSlash\":\"ignore\",\"output\":\"static\",\"scopedStyleStrategy\":\"attribute\",\"build\":{\"format\":\"directory\",\"client\":{},\"server\":{},\"assets\":\"_astro\",\"serverEntry\":\"entry.mjs\",\"redirects\":true,\"inlineStylesheets\":\"auto\",\"concurrency\":9999},\"server\":{\"open\":false,\"host\":true,\"port\":9999,\"streaming\":true},\"redirects\":{},\"prefetch\":{\"prefetchAll\":true,\"defaultStrategy\":\"hover\"},\"image\":{\"endpoint\":{\"route\":\"/_image\"},\"service\":{\"entrypoint\":\"astro/assets/services/sharp\",\"config\":{}},\"domains\":[],\"remotePatterns\":[]},\"devToolbar\":{\"enabled\":true},\"markdown\":{\"syntaxHighlight\":\"shiki\",\"shikiConfig\":{\"langs\":[],\"langAlias\":{},\"theme\":\"github-dark\",\"themes\":{},\"wrap\":false,\"transformers\":[]},\"remarkPlugins\":[],\"rehypePlugins\":[],\"remarkRehype\":{},\"gfm\":true,\"smartypants\":true},\"security\":{\"checkOrigin\":true},\"env\":{\"schema\":{},\"validateSecrets\":false},\"experimental\":{\"clientPrerender\":true,\"contentIntellisense\":true,\"responsiveImages\":false},\"legacy\":{\"collections\":false}}"]
2 changes: 1 addition & 1 deletion .astro/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"_variables": {
"lastUpdateCheck": 1734557773377
"lastUpdateCheck": 1736912697313
}
}
1 change: 0 additions & 1 deletion .astro/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
/// <reference types="astro/client" />
/// <reference path="content.d.ts" />
107 changes: 71 additions & 36 deletions Source/Function/Commit/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,54 +6,89 @@ const Last = await (
`https://api.github.com/repos/${user}/${repo}/commits?per_page=10`,
)
).json();
console.log(Last);
---

<div>
{
Last.length > 0 ? (
<>
<h1>Latest Commits</h1>

<h2>
{user}/{repo}
</h2>
<table class="w-full text-left text-sm text-stone-500 dark:text-stone-400">
<thead class="bg-stone-50 text-xs uppercase text-stone-700 dark:bg-stone-700 dark:text-stone-400">
<tr>
<th scope="col" class="px-6 py-3">
Message
</th>
<th scope="col" class="px-6 py-3">
Author
</th>
<th scope="col" class="px-6 py-3 text-center">
Date
</th>
<th scope="col" class="px-6 py-3 text-center">
Link
</th>
</tr>
</thead>
<tbody>
{Last.map(
(Commit: {
message: string;
commit: {
author: {
name: string;
date: string;
};
};
html_url: string;
}) => (
<tr class="border-b bg-white hover:bg-stone-50 dark:border-stone-700 dark:bg-stone-800 dark:hover:bg-stone-600">
<td class="whitespace-normal px-6 py-4 font-medium text-stone-900 dark:text-white">
<p>{Commit.message}</p>
</td>

{Last.map(
(Commit: {
message: string;
author: {
name: string;
date: string;
};
html_url: string;
}) => (
<div>
<p>
<strong>Message:</strong> {Commit.message}
</p>
<td class="px-6 py-4">
<p>{Commit.commit.author.name}</p>
</td>

<p>
<strong>Author:</strong> {Commit.author.name}
</p>
<p>
<strong>Date:</strong>{" "}
{new Date(
Commit.author.date,
).toLocaleDateString()}
</p>
<td class="px-6 py-4 text-center">
<p>
<span
data-date={
Commit.commit.author.date
}
/>
</p>
</td>

<a
href={Commit.html_url}
target="_blank"
rel="noopener noreferrer">
View on GitHub
</a>
</div>
),
)}
<td class="px-6 py-4 text-center">
<a
href={Commit.html_url}
target="_blank"
rel="noopener noreferrer"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
{Commit.html_url}
</a>
</td>
</tr>
),
)}
</tbody>
</table>
</>
) : (
<p>No commits found.</p>
)
}
</div>

<script>
document
.querySelectorAll<HTMLSpanElement>("span[data-date]")
.forEach((element) => {
element.textContent = new Date(
element.dataset["date"] as string,
).toLocaleDateString();
});
</script>
8 changes: 6 additions & 2 deletions Source/Function/Commits/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import Commit from "@Function/Commit/Layout.astro";
---

<div>
<h1>Latest Commits</h1>
<h1 class="mb-2 text-2xl font-bold text-stone-900 dark:text-white">
Latest Commits
</h1>

<h2>CodeEditorLand/Land</h2>
<h2 class="mb-4 text-lg text-stone-700 dark:text-stone-400">
CodeEditorLand/Land
</h2>

<Commit user="CodeEditorLand" repo="Land" />
</div>

0 comments on commit 06b28e4

Please sign in to comment.