perfected the forgejo heatmap, made it prettier and fully visible on all devices
This commit is contained in:
parent
db2c966031
commit
74e5011b71
3 changed files with 27 additions and 30 deletions
|
|
@ -1,19 +1,5 @@
|
|||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const res = await fetch("https://git.dvorakmortonxd.dev/api/v1/users/dvorakmortonxd/heatmap", {
|
||||
next: { revalidate: 3600 }, // Cache for 1 hour
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
return NextResponse.json({ error: "Failed to fetch heatmap" }, { status: res.status });
|
||||
}
|
||||
|
||||
const res = await fetch("https://git.dvorakmortonxd.dev/api/v1/users/dvorakmortonxd/heatmap");
|
||||
const data = await res.json();
|
||||
return NextResponse.json(data);
|
||||
} catch (err) {
|
||||
return NextResponse.json({ error: "Internal server error" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
|
||||
return Response.json(data);
|
||||
}
|
||||
|
|
@ -109,11 +109,11 @@ export default function ContributionHeatmap() {
|
|||
</div>
|
||||
<div style={{ display: "flex", justifyContent: "flex-end", alignItems: "center", gap: "4px", fontSize: "0.75rem", color: "var(--gray)" }}>
|
||||
<span>Less</span>
|
||||
<div className="heatmap-cell" data-level="0"></div>
|
||||
<div className="heatmap-cell" data-level="1"></div>
|
||||
<div className="heatmap-cell" data-level="2"></div>
|
||||
<div className="heatmap-cell" data-level="3"></div>
|
||||
<div className="heatmap-cell" data-level="4"></div>
|
||||
<div className="heatmap-legend-cell" data-level="0"></div>
|
||||
<div className="heatmap-legend-cell" data-level="1"></div>
|
||||
<div className="heatmap-legend-cell" data-level="2"></div>
|
||||
<div className="heatmap-legend-cell" data-level="3"></div>
|
||||
<div className="heatmap-legend-cell" data-level="4"></div>
|
||||
<span>More</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1009,24 +1009,24 @@ body {
|
|||
============================================ */
|
||||
.heatmap-container {
|
||||
display: flex;
|
||||
overflow-x: auto;
|
||||
gap: 4px;
|
||||
justify-content: space-between;
|
||||
width: 100%;
|
||||
scrollbar-width: thin;
|
||||
overflow-x: auto;
|
||||
gap: 2px;
|
||||
scrollbar-width: none;
|
||||
scrollbar-color: var(--gray) transparent;
|
||||
}
|
||||
|
||||
.heatmap-week {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
flex: 1;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.heatmap-cell {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 0; /* squares not rounded */
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
border-radius: 2px;
|
||||
background-color: var(--bg-hard);
|
||||
transition: transform 0.1s ease;
|
||||
}
|
||||
|
|
@ -1042,5 +1042,16 @@ body {
|
|||
.heatmap-cell[data-level="3"] { background-color: rgba(184, 187, 38, 0.8); }
|
||||
.heatmap-cell[data-level="4"] { background-color: rgba(184, 187, 38, 1); }
|
||||
|
||||
.heatmap-legend-cell {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 2px;
|
||||
background-color: var(--bg-hard);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.heatmap-legend-cell[data-level="1"] { background-color: rgba(184, 187, 38, 0.4); }
|
||||
.heatmap-legend-cell[data-level="2"] { background-color: rgba(184, 187, 38, 0.6); }
|
||||
.heatmap-legend-cell[data-level="3"] { background-color: rgba(184, 187, 38, 0.8); }
|
||||
.heatmap-legend-cell[data-level="4"] { background-color: rgba(184, 187, 38, 1); }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue