diff --git a/src/build-output.test.ts b/src/build-output.test.ts index f93562e1..eb2fe6b6 100644 --- a/src/build-output.test.ts +++ b/src/build-output.test.ts @@ -183,6 +183,7 @@ describe("Forgejo 15 native integration", () => { "repo/home_sidebar_top.tmpl", "repo/view_content.tmpl", "repo/view_list.tmpl", + "user/heatmap.tmpl", ]; const unsupportedSelectorFamilies = [ @@ -461,6 +462,13 @@ describe("Forgejo 15 native integration", () => { expect(fs.existsSync(path.join(ROOT_DIR, "templates", template)), `missing template: ${template}`).toBe(true); } }); + + it("keeps the native dated fallback for zero-contribution heatmap tooltips", () => { + const heatmapTemplate = fs.readFileSync(path.join(ROOT_DIR, "templates", "user", "heatmap.tmpl"), "utf-8"); + + expect(heatmapTemplate).toContain("data-heatmap-data"); + expect(heatmapTemplate).not.toContain("data-locale-contributions-zero"); + }); }); describe("auto 主题 CSS 内容验证", () => { diff --git a/styles/components/heatmap.ts b/styles/components/heatmap.ts index 0f99512e..4526f955 100644 --- a/styles/components/heatmap.ts +++ b/styles/components/heatmap.ts @@ -53,7 +53,8 @@ const heatmap = css` outline: 0.5px solid ${themeVars.github.contribution.default.borderColor.num0}; outline-offset: -0.5px; &:hover { - outline: 0.5px solid ${themeVars.color.text.self} !important; + outline: 1px solid ${themeVars.color.tooltip.text} !important; + outline-offset: -1px; } &[style="fill: var(--color-secondary-alpha-60);"] { fill: ${themeVars.github.contribution.default.bgColor.num0} !important; @@ -80,6 +81,20 @@ const heatmap = css` } } } + /* Forgejo's heatmap tooltip is unthemed; scope the GitHub treatment to the heatmap page. */ + body:has(#user-heatmap) .tippy-box:not([data-theme]) { + background-color: ${themeVars.color.tooltip.bg}; + color: ${themeVars.color.tooltip.text}; + border: 0; + font-size: 12px; + line-height: 19.5px; + .tippy-content { + font-size: 12px; + font-weight: 400; + line-height: 19.5px; + padding: 4px 8px; + } + } `; // 动态 diff --git a/templates/user/heatmap.tmpl b/templates/user/heatmap.tmpl new file mode 100644 index 00000000..0a34ee87 --- /dev/null +++ b/templates/user/heatmap.tmpl @@ -0,0 +1,12 @@ +{{if .HeatmapData}} +
+
+{{end}}