diff --git a/README.md b/README.md
index a19cc545..d1789cb7 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,11 @@
# mixan
-Mixan is a simple analytics tool for logging events on web and react-native. My goal is to make a minimal mixpanel copy with the most basic features (for now).
+Mixan is a simple analytics tool for logging events on web and react-native. My goal is to make a minimal mixpanel copy with the most basic features (for now).
+
+* Easy to use
+* Own your own data
+* GDPR friendly
## Whats left?
diff --git a/apps/web/src/components/report/ReportDateRange.tsx b/apps/web/src/components/report/ReportDateRange.tsx
index fc038042..2904f803 100644
--- a/apps/web/src/components/report/ReportDateRange.tsx
+++ b/apps/web/src/components/report/ReportDateRange.tsx
@@ -3,6 +3,8 @@ import { RadioGroup, RadioGroupItem } from "../ui/radio-group";
import { changeDateRanges, changeInterval } from "./reportSlice";
import { Combobox } from "../ui/combobox";
import { type IInterval } from "@/types";
+import { timeRanges } from "@/utils/constants";
+import { entries } from "@/utils/object";
export function ReportDateRange() {
const dispatch = useDispatch();
@@ -12,62 +14,17 @@ export function ReportDateRange() {
return (
<>
- {
- dispatch(changeDateRanges("today"));
- }}
- >
- Today
-
- {
- dispatch(changeDateRanges(1));
- }}
- >
- 24 hours
-
- {
- dispatch(changeDateRanges(7));
- }}
- >
- 7 days
-
- {
- dispatch(changeDateRanges(14));
- }}
- >
- 14 days
-
- {
- dispatch(changeDateRanges(30));
- }}
- >
- 1 month
-
- {
- dispatch(changeDateRanges(90));
- }}
- >
- 3 month
-
- {
- dispatch(changeDateRanges(180));
- }}
- >
- 6 month
-
- {
- dispatch(changeDateRanges(356));
- }}
- >
- 1 year
-
+ {entries(timeRanges).map(([range, title]) => (
+ {
+ dispatch(changeDateRanges(range));
+ }}
+ >
+ {title}
+
+ ))}
{chartType === "linear" && (
diff --git a/apps/web/src/components/report/sidebar/ReportSaveButton.tsx b/apps/web/src/components/report/sidebar/ReportSaveButton.tsx
index c7cbdada..022fe42e 100644
--- a/apps/web/src/components/report/sidebar/ReportSaveButton.tsx
+++ b/apps/web/src/components/report/sidebar/ReportSaveButton.tsx
@@ -1,16 +1,25 @@
import { Button } from "@/components/ui/button";
import { useReportId } from "../hooks/useReportId";
-import { api } from "@/utils/api";
+import { api, handleError } from "@/utils/api";
import { useSelector } from "@/redux";
import { pushModal } from "@/modals";
+import { toast } from "@/components/ui/use-toast";
export function ReportSaveButton() {
const { reportId } = useReportId();
- const update = api.report.update.useMutation();
+ const update = api.report.update.useMutation({
+ onSuccess() {
+ toast({
+ title: "Success",
+ description: "Report updated.",
+ });
+ },
+ onError: handleError
+ });
const report = useSelector((state) => state.report);
if (reportId) {
- return