Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

feat: Impove weekly jobs chart

Khuram Niaz4003e56e9906
diff --git a/src/components/dashboard/WeeklyBarChartToggle.tsx b/src/components/dashboard/WeeklyBarChartToggle.tsx
index e175f17..c3cc36b 100644
--- a/src/components/dashboard/WeeklyBarChartToggle.tsx
+++ b/src/components/dashboard/WeeklyBarChartToggle.tsx
@@ -11,6 +11,7 @@ type ChartConfig = {
keys: string[];
groupMode?: "grouped" | "stacked";
axisLeftLegend: string;
+ tooltipLabel?: (key: string) => string;
};
type WeeklyBarChartToggleProps = {
@@ -33,6 +34,19 @@ export default function WeeklyBarChartToggle({
return newItem;
});
+ const isJobsChart = current.label !== "Activities";
+ const maxValue = isJobsChart
+ ? Math.max(
+ 0,
+ ...roundedData.flatMap((item) =>
+ current.keys.map((key) => (typeof item[key] === "number" ? item[key] : 0)),
+ ),
+ )
+ : undefined;
+ const intTickValues = isJobsChart
+ ? Array.from({ length: (maxValue as number) + 1 }, (_, i) => i)
+ : undefined;
+
const totalHours =
current.label === "Activities"
? roundedData.reduce(
@@ -141,8 +155,47 @@ export default function WeeklyBarChartToggle({
legendPosition: "middle",
legendOffset: -40,
truncateTickAt: 0,
+ tickValues: intTickValues,
}}
motionConfig="gentle"
+ tooltip={({ id, value, indexValue, color }) => (
+ <div
+ style={{
+ background: "#1e293b",
+ color: "#fff",
+ padding: "6px 10px",
+ borderRadius: 4,
+ fontSize: 13,
+ whiteSpace: "nowrap",
+ }}
+ >
+ <span
+ style={{
+ display: "inline-block",
+ width: 10,
+ height: 10,
+ background: color,
+ borderRadius: 2,
+ marginRight: 6,
+ }}
+ />
+ {current.tooltipLabel
+ ? current.tooltipLabel(String(id))
+ : String(id) === "value"
+ ? current.axisLeftLegend
+ .toLowerCase()
+ .replace(/\(.*\)/, "")
+ .trim()
+ .replace(/\b\w/g, (c) => c.toUpperCase())
+ : String(id)}{" "}
+ – {indexValue}:{" "}
+ <strong>
+ {current.label === "Activities"
+ ? Number(value).toFixed(1)
+ : value}
+ </strong>
+ </div>
+ )}
/>
</div>
</CardContent>