diff --git a/web/src/components/scafold/Footer.astro b/web/src/components/scafold/Footer.astro
index ed7a7ba..4e9064a 100644
--- a/web/src/components/scafold/Footer.astro
+++ b/web/src/components/scafold/Footer.astro
@@ -1,8 +1,13 @@
+---
+const year = new Date().getFullYear();
+---
+
diff --git a/web/src/components/things/AddNewService.svelte b/web/src/components/things/AddNewService.svelte
index a77cdd0..3e8aa7d 100644
--- a/web/src/components/things/AddNewService.svelte
+++ b/web/src/components/things/AddNewService.svelte
@@ -20,24 +20,31 @@
const serviceCrypto = writable(false);
const additionalInfo = writable('');
- let codeBlock: any;
+ let codeBlock: HTMLElement | undefined;
let interactiveActivated = false;
$: (yamlText, updateHighlighting());
+ /* eslint-disable svelte/no-dom-manipulating -- hljs requires direct DOM access for syntax highlighting */
function updateHighlighting() {
if (codeBlock) {
codeBlock.textContent = yamlText;
codeBlock.dataset.highlighted && delete codeBlock.dataset.highlighted;
- if (window && (window as any).hljs) {
- (window as any).hljs.highlightElement(codeBlock);
+ const hljs = (
+ window as Window & {
+ hljs?: { highlightElement: (el: HTMLElement) => void };
+ }
+ ).hljs;
+ if (hljs) {
+ hljs.highlightElement(codeBlock);
interactiveActivated = true;
}
}
}
+ /* eslint-enable svelte/no-dom-manipulating */
- const filterEmptyValues = (obj: Record
{@html yamlText}
{/if}
diff --git a/web/src/components/things/AndroidDetailedInfo.astro b/web/src/components/things/AndroidDetailedInfo.astro
index e9b2400..f4ad460 100644
--- a/web/src/components/things/AndroidDetailedInfo.astro
+++ b/web/src/components/things/AndroidDetailedInfo.astro
@@ -1,6 +1,6 @@
---
import type { AndroidInfo } from '@utils/fetch-android-info';
-import { formatDate, timeAgo } from '@utils/dates-n-stuff';
+import { formatDate } from '@utils/dates-n-stuff';
import FontAwesome from '@components/form/FontAwesome.svelte';
interface Props {
diff --git a/web/src/components/things/DiscordDetailedInfo.astro b/web/src/components/things/DiscordDetailedInfo.astro
index 0696a43..7b0eb84 100644
--- a/web/src/components/things/DiscordDetailedInfo.astro
+++ b/web/src/components/things/DiscordDetailedInfo.astro
@@ -1,7 +1,5 @@
---
import type { DiscordInfo } from '@utils/fetch-discord-info';
-import { formatDate, timeAgo } from '@utils/dates-n-stuff';
-import FontAwesome from '@components/form/FontAwesome.svelte';
interface Props {
discordData: DiscordInfo;
diff --git a/web/src/components/things/IosAppDetailedInfo.astro b/web/src/components/things/IosAppDetailedInfo.astro
index 3884098..1979c08 100644
--- a/web/src/components/things/IosAppDetailedInfo.astro
+++ b/web/src/components/things/IosAppDetailedInfo.astro
@@ -1,7 +1,7 @@
---
import type { IoSApiResponse } from '@utils/fetch-ios-info';
-import { formatDate, timeAgo } from '@utils/dates-n-stuff';
+import { formatDate } from '@utils/dates-n-stuff';
import FontAwesome from "@components/form/FontAwesome.svelte"
@@ -18,7 +18,7 @@ const makeRatingPercentage = (rating: number) => (rating / 5) * 100;
const roundRatings = (rating: number) => Math.round(rating * 100) / 100;
-const putCommaInNumber = (num: number | any) => {
+const putCommaInNumber = (num: number | string | undefined) => {
if (!num) return 'Unknown';
return typeof num === 'number' ? num.toLocaleString() : num;
}
diff --git a/web/src/components/things/ItemGitHubMetrics.astro b/web/src/components/things/ItemGitHubMetrics.astro
index ff95855..ebb7ad4 100644
--- a/web/src/components/things/ItemGitHubMetrics.astro
+++ b/web/src/components/things/ItemGitHubMetrics.astro
@@ -2,13 +2,19 @@
import FontAwesome from "@components/form/FontAwesome.svelte";
const { github } = Astro.props;
-// const [user, repo] = github.split("/");
+interface GitHubRepoData {
+ stargazers_count?: number;
+ forks_count?: number;
+ open_issues_count?: number;
+ language?: string;
+ license?: { spdx_id?: string; name?: string };
+}
/**
* For a given `user/repo` fetch repository stats from the GitHub API data
* If API key is available through env var, use it to increase rate limit
* Returns the response data and status code (200 == success)
- * @param repo
+ * @param repo
*/
const fetchGitHubData = async (repo: string) => {
const apiKey = import.meta.env.GITHUB_API_KEY;
@@ -17,8 +23,8 @@ const fetchGitHubData = async (repo: string) => {
headers.append("Authorization", `token ${apiKey}`);
}
- let data = {};
- let statusCode = 0;
+ let data: GitHubRepoData = {};
+ let statusCode;
const response = await fetch(`https://api.github.com/repos/${repo}`, {
headers: headers,
@@ -50,7 +56,7 @@ const fetchGitHubData = async (repo: string) => {
* Given a license object, return SPDX ID, or a formatted name
* @param license
*/
-const formatLicense = (license: { spdx_id?: string, name?: string }) => {
+const formatLicense = (license?: { spdx_id?: string, name?: string }) => {
if (!license) {
return "Unknown";
}
@@ -65,7 +71,8 @@ const formatLicense = (license: { spdx_id?: string, name?: string }) => {
* E.g. If greater than thousand, then return in k format
* @param num
*/
-const formatBigNumber = (num: number) => {
+const formatBigNumber = (num: number | undefined) => {
+ if (num == null) return 0;
if (num > 1000) {
return `${(num / 1000).toFixed(1)}k`;
}
@@ -73,7 +80,7 @@ const formatBigNumber = (num: number) => {
}
// Initiate GitHub fetch, and make available to the component
-const stats = (await fetchGitHubData(github)) as any;
+const stats = await fetchGitHubData(github);
const {
stargazers_count, forks_count, open_issues_count, language, license,
diff --git a/web/src/components/things/RedditDetailedInfo.astro b/web/src/components/things/RedditDetailedInfo.astro
index d76b473..e7776bb 100644
--- a/web/src/components/things/RedditDetailedInfo.astro
+++ b/web/src/components/things/RedditDetailedInfo.astro
@@ -1,7 +1,6 @@
---
import type { RedditData } from '@utils/fetch-reddit-info';
-import { timestampToDate, timeAgo } from '@utils/dates-n-stuff';
-import FontAwesome from '@components/form/FontAwesome.svelte';
+import { timestampToDate } from '@utils/dates-n-stuff';
interface Props {
redditData: RedditData;
diff --git a/web/src/components/things/SavedServices.svelte b/web/src/components/things/SavedServices.svelte
index 713f035..393e908 100644
--- a/web/src/components/things/SavedServices.svelte
+++ b/web/src/components/things/SavedServices.svelte
@@ -48,7 +48,7 @@
{@html service.description}
Huge thanks to the following sponsors, for their ongoing support 💖
-{sponsor.name || sponsor.login}
- )); - }) - } -
@@ -122,23 +147,29 @@ const licenseContent = async () => {
maintain it.
Special thanks to the below, top-100 contributors 🌟
{sponsor.login}
+{contributor.login}
- )); - }) - } -