parent
d13017ed71
commit
d9a5b594f0
1 changed files with 57 additions and 36 deletions
|
|
@ -3,8 +3,8 @@
|
||||||
import ProjectCard from "./ProjectCard.svelte";
|
import ProjectCard from "./ProjectCard.svelte";
|
||||||
|
|
||||||
interface Project {
|
interface Project {
|
||||||
owner: string;
|
|
||||||
name: string;
|
name: string;
|
||||||
|
owner: string;
|
||||||
description: string;
|
description: string;
|
||||||
stargazers_count: number;
|
stargazers_count: number;
|
||||||
language: string;
|
language: string;
|
||||||
|
|
@ -28,69 +28,90 @@
|
||||||
Svelte: "bg-[#ff3e00]",
|
Svelte: "bg-[#ff3e00]",
|
||||||
};
|
};
|
||||||
|
|
||||||
const additionalData: Record<string, Partial<Project>> = {
|
let leftColumn: Project[] = $state([
|
||||||
"tomodachi-share": {
|
{
|
||||||
|
name: "tomodachi-share",
|
||||||
owner: "trafficlunar",
|
owner: "trafficlunar",
|
||||||
description: "Discover and share Mii residents for your Tomodachi Life island!",
|
description: "Discover and share Mii residents for your Tomodachi Life island!",
|
||||||
|
stargazers_count: 0,
|
||||||
|
language: "",
|
||||||
url: "https://github.com/trafficlunar/tomodachi-share",
|
url: "https://github.com/trafficlunar/tomodachi-share",
|
||||||
websiteUrl: "https://tomodachishare.com",
|
websiteUrl: "https://tomodachishare.com",
|
||||||
year: 2025,
|
year: 2025,
|
||||||
image: "/projects/tomodachi-share.png",
|
image: "/projects/tomodachi-share.png",
|
||||||
},
|
},
|
||||||
blockmatic: {
|
{
|
||||||
owner: "trafficlunar",
|
name: "tomodachi-share",
|
||||||
description: "Online pixel art editor for Minecraft (with support for images!)",
|
|
||||||
url: "https://github.com/trafficlunar/blockmatic",
|
|
||||||
websiteUrl: "https://blockmatic.trafficlunar.net",
|
|
||||||
year: 2024,
|
|
||||||
image: "/projects/blockmatic.png",
|
|
||||||
},
|
|
||||||
"options-profiles": {
|
|
||||||
owner: "trafficlunar",
|
owner: "trafficlunar",
|
||||||
description: "A Minecraft mod that lets you load and save your options from in-game",
|
description: "A Minecraft mod that lets you load and save your options from in-game",
|
||||||
|
stargazers_count: 0,
|
||||||
|
language: "",
|
||||||
url: "https://github.com/trafficlunar/options-profiles",
|
url: "https://github.com/trafficlunar/options-profiles",
|
||||||
websiteUrl: "https://modrinth.com/mod/options-profiles",
|
websiteUrl: "https://modrinth.com/mod/options-profiles",
|
||||||
year: 2023,
|
year: 2023,
|
||||||
image: "/projects/options-profiles.png",
|
image: "/projects/options-profiles.png",
|
||||||
},
|
},
|
||||||
website: {
|
{
|
||||||
owner: "trafficlunar",
|
name: "api",
|
||||||
description: "You're on it right now! My personal website (also hosted on nekoweb!)",
|
|
||||||
url: "https://github.com/trafficlunar/website",
|
|
||||||
},
|
|
||||||
api: {
|
|
||||||
owner: "trafficlunar",
|
owner: "trafficlunar",
|
||||||
description: "Backend for my website and small projects",
|
description: "Backend for my website and small projects",
|
||||||
|
stargazers_count: 0,
|
||||||
|
language: "",
|
||||||
url: "https://github.com/trafficlunar/api",
|
url: "https://github.com/trafficlunar/api",
|
||||||
},
|
},
|
||||||
"computer-statistics": {
|
]);
|
||||||
|
let rightColumn: Project[] = $state([
|
||||||
|
{
|
||||||
|
name: "blockmatic",
|
||||||
|
owner: "trafficlunar",
|
||||||
|
description: "Online pixel art editor for Minecraft (with support for images!)",
|
||||||
|
stargazers_count: 0,
|
||||||
|
language: "",
|
||||||
|
url: "https://github.com/trafficlunar/blockmatic",
|
||||||
|
websiteUrl: "https://blockmatic.trafficlunar.net",
|
||||||
|
year: 2024,
|
||||||
|
image: "/projects/blockmatic.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "website",
|
||||||
|
owner: "trafficlunar",
|
||||||
|
description: "You're on it right now! My personal website (also hosted on nekoweb!)",
|
||||||
|
stargazers_count: 0,
|
||||||
|
language: "",
|
||||||
|
url: "https://github.com/trafficlunar/website",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "computer-statistics",
|
||||||
owner: "trafficlunar",
|
owner: "trafficlunar",
|
||||||
description: "A very simple application to send computer statistics (CPU, RAM, keyboard presses, etc.) to my API",
|
description: "A very simple application to send computer statistics (CPU, RAM, keyboard presses, etc.) to my API",
|
||||||
|
stargazers_count: 0,
|
||||||
|
language: "",
|
||||||
url: "https://github.com/trafficlunar/computer-statistics",
|
url: "https://github.com/trafficlunar/computer-statistics",
|
||||||
},
|
},
|
||||||
};
|
]);
|
||||||
|
|
||||||
let leftColumn: Project[] = $state([]);
|
|
||||||
let rightColumn: Project[] = $state([]);
|
|
||||||
|
|
||||||
|
// Send request to API and fill in missing data
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
const response = await fetch("https://api.trafficlunar.net/projects");
|
const response = await fetch("https://api.trafficlunar.net/projects");
|
||||||
const data: Project[] = await response.json();
|
const data: Project[] = await response.json();
|
||||||
|
|
||||||
data.forEach((p, index) => {
|
const mapProject = (column: Project[]) => {
|
||||||
const extra = additionalData[p.name] || {};
|
column.forEach((p, index) => {
|
||||||
const project = {
|
const apiData = data.find((proj) => proj.name === p.name);
|
||||||
...p,
|
if (!apiData) return;
|
||||||
color: languageColors[p.language ?? ""] ?? "bg-overlay0",
|
|
||||||
...extra,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (index % 2 === 0) {
|
// Add missing data
|
||||||
leftColumn.push(project);
|
column[index] = {
|
||||||
} else {
|
...p,
|
||||||
rightColumn.push(project);
|
stargazers_count: apiData.stargazers_count,
|
||||||
}
|
language: apiData.language,
|
||||||
});
|
color: languageColors[apiData.language ?? ""] ?? "bg-overlay0", // Get color of language
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
mapProject(leftColumn);
|
||||||
|
mapProject(rightColumn);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue