Skip to content

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

fix(client): Solve issues with small activity calendar on mobile screens (#215)

Andrii Zontovaaf6e3afae9a
diff --git a/client/src/app/[site]/user/[userId]/components/Calendar.tsx b/client/src/app/[site]/user/[userId]/components/Calendar.tsx
index 5ffe4a517..73b634b66 100644
--- a/client/src/app/[site]/user/[userId]/components/Calendar.tsx
+++ b/client/src/app/[site]/user/[userId]/components/Calendar.tsx
@@ -1,8 +1,8 @@
-import { DateTime } from "luxon";
-import { Calendar, ResponsiveCalendar } from "@nivo/calendar";
+import { ResponsiveCalendar } from "@nivo/calendar";
import _ from "lodash";
-import { nivoTheme } from "../../../../../lib/nivo";
+import { DateTime } from "luxon";
import { UserSessionCountResponse } from "../../../../../api/analytics/userSessions";
+import { nivoTheme } from "../../../../../lib/nivo";
export const VisitCalendar = ({
sessionCount,
@@ -33,29 +33,33 @@ export const VisitCalendar = ({
1;
return (
- <ResponsiveCalendar
- data={data}
- theme={nivoTheme}
- from={data.at(-1)?.day ?? ""}
- to={data[0]?.day}
- emptyColor={"hsl(var(--neutral-750))"}
- colors={["#10452A", "#006D32", "#3E9058", "#3CD456"]}
- margin={{ top: 20, right: 0, bottom: 1, left: 20 }}
- monthBorderColor="rgba(0, 0, 0, 0)"
- daySpacing={3}
- dayBorderColor="rgba(0, 0, 0, 0)"
- maxValue={maxValue}
- tooltip={({ value, day }) => {
- return (
- <div className="bg-neutral-900 p-2 rounded-md border border-neutral-800 text-sm">
- {value}{" "}
- <span className="text-neutral-300">
- session{Number(value) > 1 && "s"} on
- </span>{" "}
- {day}
- </div>
- );
- }}
- />
+ <div style={{ width: "100%", overflowX: "auto", height: "150px" }}>
+ <div style={{ minWidth: "600px", height: "100%" }}>
+ <ResponsiveCalendar
+ data={data}
+ theme={nivoTheme}
+ from={data.at(-1)?.day ?? ""}
+ to={data[0]?.day}
+ emptyColor={"hsl(var(--neutral-750))"}
+ colors={["#10452A", "#006D32", "#3E9058", "#3CD456"]}
+ margin={{ top: 20, right: 0, bottom: 1, left: 20 }}
+ monthBorderColor="rgba(0, 0, 0, 0)"
+ daySpacing={3}
+ dayBorderColor="rgba(0, 0, 0, 0)"
+ maxValue={maxValue}
+ tooltip={({ value, day }) => {
+ return (
+ <div className="bg-neutral-900 p-2 rounded-md border border-neutral-800 text-sm">
+ {value}{" "}
+ <span className="text-neutral-300">
+ session{Number(value) > 1 && "s"} on
+ </span>{" "}
+ {day}
+ </div>
+ );
+ }}
+ />
+ </div>
+ </div>
);
};