#10 Added sliding card element for image stored in /assets/images/main.png
All checks were successful
Build and Push Development Docker Image / build-and-push (push) Successful in 1m4s

This commit is contained in:
2025-03-12 15:05:00 +00:00
parent e1160b3462
commit ce38e88885
3 changed files with 58 additions and 15 deletions

View File

@@ -1,6 +1,7 @@
import type { GitRepo } from "../types";
const API_BASE_URL = "https://git.luke-else.co.uk/api/v1";
export const IMAGE_URL_SUFFIX = "/raw/branch/main/assets/images/main.png";
export async function fetchRepos(): Promise<GitRepo[]> {
@@ -46,4 +47,21 @@ export function timeSince(inputDate: Date | string): string {
if (diffInDays < 30) return `${Math.floor(diffInDays / 7)} week${diffInDays >= 14 ? 's' : ''} ago`;
if (diffInMonths < 12) return `${diffInMonths} month${diffInMonths > 1 ? 's' : ''} ago`;
return `${diffInYears} year${diffInYears > 1 ? 's' : ''} ago`;
}
export async function checkImage(repo: GitRepo): Promise<boolean> {
try {
const URL = repo.html_url + IMAGE_URL_SUFFIX;
console.log("Checking image:", URL);
const response = await fetch(URL);
if (response.ok) {
console.log("Image found!");
return true;
} else {
console.log("Image not found!");
return false;
}
} catch (error) {
return false;
}
}