Track preferred time preferences

This commit is contained in:
Luke Vella 2022-04-26 20:23:46 +01:00
parent 8aec24308e
commit 671f5b16fd

View file

@ -1,5 +1,6 @@
import clsx from "clsx";
import { useTranslation } from "next-i18next";
import { usePlausible } from "next-plausible";
import React from "react";
import Calendar from "@/components/icons/calendar.svg";
@ -12,6 +13,7 @@ const Preferences: React.VoidFunctionComponent = () => {
const { weekStartsOn, setWeekStartsOn, timeFormat, setTimeFormat } =
usePreferences();
const plausible = usePlausible();
return (
<div className="-mb-2">
<div className="mb-4 flex items-center space-x-2 text-base font-semibold">
@ -29,6 +31,11 @@ const Preferences: React.VoidFunctionComponent = () => {
})}
onClick={() => {
setWeekStartsOn("monday");
plausible("Change week start", {
props: {
timeFormat: "monday",
},
});
}}
type="button"
>
@ -40,6 +47,11 @@ const Preferences: React.VoidFunctionComponent = () => {
})}
onClick={() => {
setWeekStartsOn("sunday");
plausible("Change week start", {
props: {
timeFormat: "sunday",
},
});
}}
type="button"
>
@ -57,6 +69,11 @@ const Preferences: React.VoidFunctionComponent = () => {
})}
onClick={() => {
setTimeFormat("12h");
plausible("Change time format", {
props: {
timeFormat: "12h",
},
});
}}
type="button"
>
@ -68,6 +85,11 @@ const Preferences: React.VoidFunctionComponent = () => {
})}
onClick={() => {
setTimeFormat("24h");
plausible("Change time format", {
props: {
timeFormat: "24h",
},
});
}}
type="button"
>