Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix: auto-scroll ActivityHeatmap to show current date

ivan_yakimkin813191beef06
diff --git a/src/shared/components/analytics/charts.tsx b/src/shared/components/analytics/charts.tsx
index f1968951d2..70b839a0cc 100644
--- a/src/shared/components/analytics/charts.tsx
+++ b/src/shared/components/analytics/charts.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useState, useMemo, useCallback } from "react";
+import { useState, useMemo, useCallback, useRef, useEffect } from "react";
import { useLocale } from "next-intl";
import Card from "../Card";
import { getModelColor } from "@/shared/constants/colors";
@@ -174,6 +174,9 @@ export function CompactStatGrid({ sections }: { sections: CompactStatSection[] }
// ── ActivityHeatmap ────────────────────────────────────────────────────────
export function ActivityHeatmap({ activityMap }) {
+ const scrollRef = useRef<HTMLDivElement>(null);
+
+
const cells = useMemo(() => {
const today = new Date();
const days = [];
@@ -209,6 +212,14 @@ export function ActivityHeatmap({ activityMap }) {
return w;
}, [cells]);
+ // Auto-scroll to the right edge so the current date is visible
+ useEffect(() => {
+ if (scrollRef.current) {
+ scrollRef.current.scrollLeft = scrollRef.current.scrollWidth;
+ }
+ }, [weeks]);
+
+
const monthLabels = useMemo(() => {
const labels = [];
let lastMonth = -1;
@@ -275,7 +286,10 @@ export function ActivityHeatmap({ activityMap }) {
))}
</div>
- <div className="flex gap-[3px] overflow-x-auto">
+ <div
+ ref={scrollRef}
+ className="flex gap-[3px] overflow-x-auto"
+ >
<div className="flex flex-col gap-[3px] shrink-0 text-[10px] text-text-muted pr-1">
<span className="h-[10px]"></span>
<span className="h-[10px] leading-[10px]">Mon</span>