upgrade deps and fix nullables
This commit is contained in:
@@ -14,8 +14,10 @@ function toggleDarkMode() {
|
||||
}
|
||||
}
|
||||
const darkToggle = document.getElementById("dark-toggle");
|
||||
darkToggle.checked = html.className === "dark";
|
||||
darkToggle.onclick = toggleDarkMode;
|
||||
if (darkToggle) {
|
||||
darkToggle.checked = html.className === "dark";
|
||||
darkToggle.onclick = toggleDarkMode;
|
||||
}
|
||||
// github commit fetcher
|
||||
// pulled from CommitStatBox.vue
|
||||
const FEED_URL = "https://api.github.com/users/potatoeggy/events";
|
||||
@@ -24,6 +26,10 @@ const latestEvent = results.find((e) => e.type === "PushEvent");
|
||||
const latestCommit = latestEvent.payload.commits[0];
|
||||
const commitImg = document.getElementById("github-commit-img");
|
||||
const commitAnchor = document.getElementById("github-commit-a");
|
||||
commitImg.src = `https://opengraph.githubassets.com/hash/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
commitAnchor.href = `https://github.com/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
if (commitImg) {
|
||||
commitImg.src = `https://opengraph.githubassets.com/hash/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
}
|
||||
if (commitAnchor) {
|
||||
commitAnchor.href = `https://github.com/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
}
|
||||
export {};
|
||||
|
@@ -20,9 +20,14 @@ function toggleDarkMode() {
|
||||
}
|
||||
}
|
||||
|
||||
const darkToggle = document.getElementById("dark-toggle") as HTMLInputElement;
|
||||
darkToggle.checked = html.className === "dark";
|
||||
darkToggle.onclick = toggleDarkMode;
|
||||
const darkToggle = document.getElementById(
|
||||
"dark-toggle"
|
||||
) as HTMLInputElement | null;
|
||||
|
||||
if (darkToggle) {
|
||||
darkToggle.checked = html.className === "dark";
|
||||
darkToggle.onclick = toggleDarkMode;
|
||||
}
|
||||
|
||||
// github commit fetcher
|
||||
// pulled from CommitStatBox.vue
|
||||
@@ -35,13 +40,18 @@ const latestCommit = latestEvent.payload.commits[0];
|
||||
|
||||
const commitImg = document.getElementById(
|
||||
"github-commit-img"
|
||||
) as HTMLImageElement;
|
||||
) as HTMLImageElement | null;
|
||||
const commitAnchor = document.getElementById(
|
||||
"github-commit-a"
|
||||
) as HTMLAnchorElement;
|
||||
|
||||
commitImg.src = `https://opengraph.githubassets.com/hash/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
commitAnchor.href = `https://github.com/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
if (commitImg) {
|
||||
commitImg.src = `https://opengraph.githubassets.com/hash/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
}
|
||||
|
||||
if (commitAnchor) {
|
||||
commitAnchor.href = `https://github.com/${latestEvent.repo.name}/commit/${latestCommit.sha}`;
|
||||
}
|
||||
|
||||
// to make this an esm module for top-level await
|
||||
export {};
|
||||
|
Reference in New Issue
Block a user