From ad3726ee491492ab6d312cba09f738986192fd0e Mon Sep 17 00:00:00 2001 From: Rick Staa Date: Tue, 22 Nov 2022 09:18:22 +0100 Subject: [PATCH] fix: fix repoContrib confusion (#2269) (#2274) This commit prevents confusion about the Contributed to stat. Currently, only the last year's results are shown, but it looks like it is the all-time contribution count (see #2269). This commit adds a ' (last year)' suffix to prevent this confusion from happening. --- src/cards/stats-card.js | 4 ++-- tests/renderStatsCard.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cards/stats-card.js b/src/cards/stats-card.js index b078728..a44f17f 100644 --- a/src/cards/stats-card.js +++ b/src/cards/stats-card.js @@ -154,7 +154,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => { }, contribs: { icon: icons.contribs, - label: i18n.t("statcard.contribs"), + label: i18n.t("statcard.contribs") + " (last year)", value: contributedTo, id: "contribs", }, @@ -186,7 +186,7 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => { index, showIcons: show_icons, shiftValuePos: - (!include_all_commits ? 50 : 35) + (isLongLocale ? 50 : 0), + (!include_all_commits ? 79.01 : 35) + (isLongLocale ? 50 : 0), bold: text_bold, }), ); diff --git a/tests/renderStatsCard.test.js b/tests/renderStatsCard.test.js index 2880486..e39e45b 100644 --- a/tests/renderStatsCard.test.js +++ b/tests/renderStatsCard.test.js @@ -344,7 +344,7 @@ describe("Test renderStatsCard", () => { document.querySelector( 'g[transform="translate(0, 100)"]>.stagger>.stat.bold', ).textContent, - ).toMatchInlineSnapshot(`"参与项目数:"`); + ).toMatchInlineSnapshot(`"参与项目数 (last year):"`); }); it("should render without rounding", () => {