diff --git a/backend/src/cards/gist.js b/backend/src/cards/gist.js index e001ca52..5759691a 100644 --- a/backend/src/cards/gist.js +++ b/backend/src/cards/gist.js @@ -87,6 +87,7 @@ const renderGistCard = (gistData, options = {}) => { ); const languageName = language || "Unspecified"; + // @ts-ignore const languageColor = languageColors[languageName] || "#858585"; const svgLanguage = createLanguageNode(languageName, languageColor); diff --git a/backend/src/cards/repo.js b/backend/src/cards/repo.js index 1cb9e3fa..349aab6f 100644 --- a/backend/src/cards/repo.js +++ b/backend/src/cards/repo.js @@ -1,4 +1,5 @@ // @ts-check + import { Card } from "../common/Card.js"; import { getCardColors } from "../common/color.js"; import { I18n } from "../common/I18n.js"; diff --git a/backend/src/cards/stats.js b/backend/src/cards/stats.js index c77821ed..cec139db 100644 --- a/backend/src/cards/stats.js +++ b/backend/src/cards/stats.js @@ -467,22 +467,25 @@ const renderStatsCard = ( // filter out hidden stats defined by user & create the text nodes const statItems = Object.keys(STATS) .filter((key) => !hide.includes(key)) - .map((key, index) => + .map((key, index) => { + // @ts-ignore + const stats = STATS[key]; + // create the text nodes, and pass index so that we can calculate the line spacing - createTextNode({ - icon: STATS[key].icon, - label: STATS[key].label, - value: STATS[key].value, - id: STATS[key].id, - unitSymbol: STATS[key].unitSymbol, + return createTextNode({ + icon: stats.icon, + label: stats.label, + value: stats.value, + id: stats.id, + unitSymbol: stats.unitSymbol, index, showIcons: show_icons, shiftValuePos: 29.01 + (longLabels ? 50 : 0) + (isLongLocale ? 50 : 0), bold: text_bold, number_format, link: STATS[key].link, - }), - ); + }); + }); if (statItems.length === 0 && hide_rank) { throw new CustomError( @@ -614,14 +617,16 @@ const renderStatsCard = ( const labels = Object.keys(STATS) .filter((key) => !hide.includes(key)) .map((key) => { + // @ts-ignore + const stats = STATS[key]; if (key === "commits") { return `${i18n.t("statcard.commits")} ${getTotalCommitsYearLabel( include_all_commits, commits_year, i18n, - )} : ${STATS[key].value}`; + )} : ${stats.value}`; } - return `${STATS[key].label}: ${STATS[key].value}`; + return `${stats.label}: ${stats.value}`; }) .join(", "); diff --git a/backend/src/cards/top-languages.js b/backend/src/cards/top-languages.js index 569ccaae..76c02fad 100644 --- a/backend/src/cards/top-languages.js +++ b/backend/src/cards/top-languages.js @@ -1,4 +1,5 @@ // @ts-check + import { Card } from "../common/Card.js"; import { getCardColors } from "../common/color.js"; import { createProgressNode } from "../common/createProgressNode.js"; @@ -180,6 +181,7 @@ const trimTopLanguages = (topLangs, langs_count, hide) => { // while filtering out if (hide) { hide.forEach((langName) => { + // @ts-ignore langsToHide[lowercaseTrim(langName)] = true; }); } @@ -188,6 +190,7 @@ const trimTopLanguages = (topLangs, langs_count, hide) => { langs = langs .sort((a, b) => b.size - a.size) .filter((lang) => { + // @ts-ignore return !langsToHide[lowercaseTrim(lang.name)]; }) .slice(0, langsCount); diff --git a/backend/src/cards/wakatime.js b/backend/src/cards/wakatime.js index bd0944b7..29bcdd26 100644 --- a/backend/src/cards/wakatime.js +++ b/backend/src/cards/wakatime.js @@ -55,6 +55,7 @@ const formatLanguageValue = ({ display_format, lang }) => { * @returns {string} The compact layout language SVG node. */ const createCompactLangNode = ({ lang, x, y, display_format }) => { + // @ts-ignore const color = languageColors[lang.name] || "#858585"; const value = formatLanguageValue({ display_format, lang }); @@ -315,6 +316,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => { // const progress = (width * lang.percent) / 100; const progress = ((width - 25) * language.percent) / 100; + // @ts-ignore const languageColor = languageColors[language.name] || "#858585"; const output = ` diff --git a/backend/src/common/color.js b/backend/src/common/color.js index 8047ad06..759a07ca 100644 --- a/backend/src/common/color.js +++ b/backend/src/common/color.js @@ -68,8 +68,8 @@ const fallbackColor = (color, fallbackColor) => { * @param {string=} args.bg_color Card background color. * @param {string=} args.border_color Card border color. * @param {string=} args.ring_color Card ring color. - * @param {keyof themes=} args.theme Card theme. - * @param {keyof themes=} args.fallbackTheme Fallback theme. + * @param {string=} args.theme Card theme. + * @param {string=} args.fallbackTheme Fallback theme. * @returns {CardColors} Card colors. */ const getCardColors = ({