Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Update Weekdays component to correct day of week calculation and change color scheme

Bill Yang0e2ee89fd774
diff --git a/client/src/app/[site]/main/components/sections/Weekdays.tsx b/client/src/app/[site]/main/components/sections/Weekdays.tsx
index 1b6638fae..aef37160d 100644
--- a/client/src/app/[site]/main/components/sections/Weekdays.tsx
+++ b/client/src/app/[site]/main/components/sections/Weekdays.tsx
@@ -57,7 +57,7 @@ export function Weekdays() {
const date = DateTime.fromSQL(item.time);
if (!date.isValid) return;
- const dayOfWeek = date.weekday % 7; // 0 = Monday, 6 = Sunday in Luxon
+ const dayOfWeek = (date.weekday - 1) % 7; // Luxon uses 1 for Monday, 7 for Sunday
const hourOfDay = date.hour;
// Safely check if the metric exists and is a number
@@ -127,16 +127,16 @@ export function Weekdays() {
const ratio = value / maxValue;
// Use predefined opacity classes that are guaranteed to exist in Tailwind
- if (ratio < 0.1) return "bg-green-500 bg-opacity-10";
- if (ratio < 0.2) return "bg-green-500 bg-opacity-20";
- if (ratio < 0.3) return "bg-green-500 bg-opacity-30";
- if (ratio < 0.4) return "bg-green-500 bg-opacity-40";
- if (ratio < 0.5) return "bg-green-500 bg-opacity-50";
- if (ratio < 0.6) return "bg-green-500 bg-opacity-60";
- if (ratio < 0.7) return "bg-green-500 bg-opacity-70";
- if (ratio < 0.8) return "bg-green-500 bg-opacity-80";
- if (ratio < 0.9) return "bg-green-500 bg-opacity-90";
- return "bg-green-500";
+ if (ratio < 0.1) return "bg-indigo-500 bg-opacity-10";
+ if (ratio < 0.2) return "bg-indigo-500 bg-opacity-20";
+ if (ratio < 0.3) return "bg-indigo-500 bg-opacity-30";
+ if (ratio < 0.4) return "bg-indigo-500 bg-opacity-40";
+ if (ratio < 0.5) return "bg-indigo-500 bg-opacity-50";
+ if (ratio < 0.6) return "bg-indigo-500 bg-opacity-60";
+ if (ratio < 0.7) return "bg-indigo-500 bg-opacity-70";
+ if (ratio < 0.8) return "bg-indigo-500 bg-opacity-80";
+ if (ratio < 0.9) return "bg-indigo-500 bg-opacity-90";
+ return "bg-indigo-500";
};
// Format the metric value based on its type
@@ -263,7 +263,7 @@ export function Weekdays() {
<Tooltip key={day}>
<TooltipTrigger asChild>
<div
- className={`flex-1 mx-0.5 ${colorClass} hover:ring-1 hover:ring-green-300 transition-all rounded-sm my-0.5`}
+ className={`flex-1 mx-0.5 ${colorClass} hover:ring-1 hover:ring-indigo-300 transition-all rounded-sm my-0.5`}
/>
</TooltipTrigger>
<TooltipContent className="flex flex-col gap-1 p-2">