Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/build-output.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 内容验证", () => {
Expand Down
17 changes: 16 additions & 1 deletion styles/components/heatmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
`;

// 动态
Expand Down
12 changes: 12 additions & 0 deletions templates/user/heatmap.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{if .HeatmapData}}
<div id="user-heatmap" class="is-loading"
data-heatmap-data="{{JsonUtils.EncodeToString .HeatmapData}}"
data-locale-total-contributions="{{ctx.Locale.Tr "heatmap.number_of_contributions_in_the_last_12_months" (ctx.Locale.PrettyNumber .HeatmapTotalContributions)}}"
data-locale-contributions-format="{{ctx.Locale.Tr "heatmap.contributions_format"}}"
data-locale-contributions-one="{{ctx.Locale.Tr "heatmap.contributions_one"}}"
data-locale-contributions-few="{{ctx.Locale.Tr "heatmap.contributions_few"}}"
data-locale-more="{{ctx.Locale.Tr "heatmap.more"}}"
data-locale-less="{{ctx.Locale.Tr "heatmap.less"}}"
></div>
<div class="divider"></div>
{{end}}
Loading