Skip to content

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

move hooks

Bill Yangd333be463fb4
diff --git a/client/src/actions/getOperatingSystems.ts b/client/src/actions/getOperatingSystems.ts
index 0a2be9521..ac324f8e7 100644
--- a/client/src/actions/getOperatingSystems.ts
+++ b/client/src/actions/getOperatingSystems.ts
@@ -30,7 +30,6 @@ export async function getOperatingSystems({
`;
try {
- const start = performance.now();
const result = await clickhouse.query({
query,
format: "JSONEachRow",
@@ -39,8 +38,6 @@ export async function getOperatingSystems({
const data = await processResults<GetOperatingSystemsResponse[number]>(
result
);
- const end = performance.now();
- console.log(`Operating systems query took ${end - start}ms`);
return { data };
} catch (error) {
console.error("Error fetching operating systems:", error);
diff --git a/client/src/app/components/MainSection/MainSection.tsx b/client/src/app/components/MainSection/MainSection.tsx
index 7156704ea..6aa1d0662 100644
--- a/client/src/app/components/MainSection/MainSection.tsx
+++ b/client/src/app/components/MainSection/MainSection.tsx
@@ -1,7 +1,7 @@
"use client";
import { Card, CardContent, CardLoader } from "@/components/ui/card";
import { useTimeSelection } from "../../../lib/timeSelectionStore";
-import { useGetPageviews } from "../../hooks/useGetPageviews";
+import { useGetPageviews } from "../../../hooks/useGetPageviews";
import { BucketSelection } from "./BucketSelection";
import { Chart } from "./Chart";
diff --git a/client/src/app/components/sections/Browsers/Browsers.tsx b/client/src/app/components/sections/Browsers/Browsers.tsx
index 43d5dafe4..960208491 100644
--- a/client/src/app/components/sections/Browsers/Browsers.tsx
+++ b/client/src/app/components/sections/Browsers/Browsers.tsx
@@ -2,7 +2,7 @@
import { Compass } from "lucide-react";
import Image from "next/image";
-import { useGetBrowsers } from "../../../hooks/useGetBrowsers";
+import { useGetBrowsers } from "../../../../hooks/useGetBrowsers";
import { StandardCard } from "../../shared/StandardCard";
const BROWSER_TO_LOGO: Record<string, string> = {
diff --git a/client/src/app/components/sections/Countries/Countries.tsx b/client/src/app/components/sections/Countries/Countries.tsx
index 0c06e3ad1..8284a4524 100644
--- a/client/src/app/components/sections/Countries/Countries.tsx
+++ b/client/src/app/components/sections/Countries/Countries.tsx
@@ -1,7 +1,7 @@
"use client";
import React from "react";
-import { useGetCountries } from "../../../hooks/useGetCountries";
+import { useGetCountries } from "../../../../hooks/useGetCountries";
import { StandardCard } from "../../shared/StandardCard";
import { countries } from "countries-list";
import * as CountryFlags from "country-flag-icons/react/3x2";
diff --git a/client/src/app/components/sections/Devices/Devices.tsx b/client/src/app/components/sections/Devices/Devices.tsx
index d38f3aeaf..63d6819af 100644
--- a/client/src/app/components/sections/Devices/Devices.tsx
+++ b/client/src/app/components/sections/Devices/Devices.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useGetDevices } from "../../../hooks/useGetDevices";
+import { useGetDevices } from "../../../../hooks/useGetDevices";
import { StandardCard } from "../../shared/StandardCard";
export function Devices() {
diff --git a/client/src/app/components/sections/Map/Chloropleth.tsx b/client/src/app/components/sections/Map/Chloropleth.tsx
index 3f3ee0ca2..ae4b76152 100644
--- a/client/src/app/components/sections/Map/Chloropleth.tsx
+++ b/client/src/app/components/sections/Map/Chloropleth.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useGetCountries } from "../../../hooks/useGetCountries";
+import { useGetCountries } from "../../../../hooks/useGetCountries";
import { LatLngExpression } from "leaflet";
import "leaflet/dist/leaflet.css";
import { useEffect, useMemo, useState } from "react";
diff --git a/client/src/app/components/sections/Map/Map.tsx b/client/src/app/components/sections/Map/Map.tsx
index c49159dac..6521158a1 100644
--- a/client/src/app/components/sections/Map/Map.tsx
+++ b/client/src/app/components/sections/Map/Map.tsx
@@ -20,7 +20,7 @@ import {
import { countries } from "countries-list";
import * as CountryFlags from "country-flag-icons/react/3x2";
-import { useGetCountries } from "../../../hooks/useGetCountries";
+import { useGetCountries } from "../../../../hooks/useGetCountries";
import React from "react";
const geoUrl = "/countries.geojson";
diff --git a/client/src/app/components/sections/OperatingSystems/OperatingSystems.tsx b/client/src/app/components/sections/OperatingSystems/OperatingSystems.tsx
index c57df360d..a26c2a8ea 100644
--- a/client/src/app/components/sections/OperatingSystems/OperatingSystems.tsx
+++ b/client/src/app/components/sections/OperatingSystems/OperatingSystems.tsx
@@ -1,7 +1,7 @@
"use client";
import { Compass } from "lucide-react";
-import { useGetOperatingSystems } from "../../../hooks/useGetOperatingSystems";
+import { useGetOperatingSystems } from "../../../../hooks/useGetOperatingSystems";
import { StandardCard } from "../../shared/StandardCard";
import Image from "next/image";
diff --git a/client/src/app/components/sections/Pages/Pages.tsx b/client/src/app/components/sections/Pages/Pages.tsx
index bbb0b7c48..4241abbc2 100644
--- a/client/src/app/components/sections/Pages/Pages.tsx
+++ b/client/src/app/components/sections/Pages/Pages.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useGetPages } from "../../../hooks/useGetPages";
+import { useGetPages } from "../../../../hooks/useGetPages";
import { StandardCard } from "../../shared/StandardCard";
export function Pages() {
diff --git a/client/src/app/components/sections/Referrers/Referrers.tsx b/client/src/app/components/sections/Referrers/Referrers.tsx
index 54336400e..99dd6f3bf 100644
--- a/client/src/app/components/sections/Referrers/Referrers.tsx
+++ b/client/src/app/components/sections/Referrers/Referrers.tsx
@@ -1,6 +1,6 @@
"use client";
-import { useGetReferrers } from "../../../hooks/useGetReferrers";
+import { useGetReferrers } from "../../../../hooks/useGetReferrers";
import { StandardCard } from "../../shared/StandardCard";
export function Referrers() {
diff --git a/client/src/app/hooks/useGetBrowsers.ts b/client/src/hooks/useGetBrowsers.ts
similarity index 79%
rename from client/src/app/hooks/useGetBrowsers.ts
rename to client/src/hooks/useGetBrowsers.ts
index 1ac53281e..352e62ae6 100644
--- a/client/src/app/hooks/useGetBrowsers.ts
+++ b/client/src/hooks/useGetBrowsers.ts
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
-import { getBrowsers } from "../../actions/getBrowsers";
+import { useTimeSelection } from "../lib/timeSelectionStore";
+import { getBrowsers } from "../actions/getBrowsers";
import { getStartAndEndDate } from "./utils";
export function useGetBrowsers() {
diff --git a/client/src/app/hooks/useGetCountries.ts b/client/src/hooks/useGetCountries.ts
similarity index 79%
rename from client/src/app/hooks/useGetCountries.ts
rename to client/src/hooks/useGetCountries.ts
index 57688f08e..58b7f10e9 100644
--- a/client/src/app/hooks/useGetCountries.ts
+++ b/client/src/hooks/useGetCountries.ts
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
-import { getCountries } from "../../actions/getCountries";
+import { useTimeSelection } from "../lib/timeSelectionStore";
+import { getCountries } from "../actions/getCountries";
import { getStartAndEndDate } from "./utils";
export function useGetCountries() {
diff --git a/client/src/app/hooks/useGetDevices.ts b/client/src/hooks/useGetDevices.ts
similarity index 80%
rename from client/src/app/hooks/useGetDevices.ts
rename to client/src/hooks/useGetDevices.ts
index e302db109..9a349733b 100644
--- a/client/src/app/hooks/useGetDevices.ts
+++ b/client/src/hooks/useGetDevices.ts
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
-import { getDevices } from "../../actions/getDevices";
+import { useTimeSelection } from "../lib/timeSelectionStore";
+import { getDevices } from "../actions/getDevices";
import { getStartAndEndDate } from "./utils";
export function useGetDevices() {
diff --git a/client/src/app/hooks/useGetOperatingSystems.ts b/client/src/hooks/useGetOperatingSystems.ts
similarity index 78%
rename from client/src/app/hooks/useGetOperatingSystems.ts
rename to client/src/hooks/useGetOperatingSystems.ts
index 934a5beb5..ac37569d5 100644
--- a/client/src/app/hooks/useGetOperatingSystems.ts
+++ b/client/src/hooks/useGetOperatingSystems.ts
@@ -1,7 +1,7 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
+import { useTimeSelection } from "../lib/timeSelectionStore";
import { getStartAndEndDate } from "./utils";
-import { getOperatingSystems } from "../../actions/getOperatingSystems";
+import { getOperatingSystems } from "../actions/getOperatingSystems";
export function useGetOperatingSystems() {
const { time } = useTimeSelection();
diff --git a/client/src/app/hooks/useGetPages.ts b/client/src/hooks/useGetPages.ts
similarity index 80%
rename from client/src/app/hooks/useGetPages.ts
rename to client/src/hooks/useGetPages.ts
index 0e719f8dc..2c7aa0aa4 100644
--- a/client/src/app/hooks/useGetPages.ts
+++ b/client/src/hooks/useGetPages.ts
@@ -1,7 +1,7 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
+import { useTimeSelection } from "../lib/timeSelectionStore";
import { getStartAndEndDate } from "./utils";
-import { getPages } from "../../actions/getPages";
+import { getPages } from "../actions/getPages";
export function useGetPages() {
const { time } = useTimeSelection();
diff --git a/client/src/app/hooks/useGetPageviews.ts b/client/src/hooks/useGetPageviews.ts
similarity index 80%
rename from client/src/app/hooks/useGetPageviews.ts
rename to client/src/hooks/useGetPageviews.ts
index e686e9431..48f244f5d 100644
--- a/client/src/app/hooks/useGetPageviews.ts
+++ b/client/src/hooks/useGetPageviews.ts
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
-import { getPageViews } from "../../actions/getPageviews";
+import { useTimeSelection } from "../lib/timeSelectionStore";
+import { getPageViews } from "../actions/getPageviews";
import { getStartAndEndDate } from "./utils";
export function useGetPageviews() {
diff --git a/client/src/app/hooks/useGetReferrers.ts b/client/src/hooks/useGetReferrers.ts
similarity index 79%
rename from client/src/app/hooks/useGetReferrers.ts
rename to client/src/hooks/useGetReferrers.ts
index 425f8bb37..afc4d0dcd 100644
--- a/client/src/app/hooks/useGetReferrers.ts
+++ b/client/src/hooks/useGetReferrers.ts
@@ -1,6 +1,6 @@
import { useQuery } from "@tanstack/react-query";
-import { useTimeSelection } from "../../lib/timeSelectionStore";
-import { getReferrers } from "../../actions/getReferrers";
+import { useTimeSelection } from "../lib/timeSelectionStore";
+import { getReferrers } from "../actions/getReferrers";
import { getStartAndEndDate } from "./utils";
export function useGetReferrers() {
diff --git a/client/src/app/hooks/utils.ts b/client/src/hooks/utils.ts
similarity index 100%
rename from client/src/app/hooks/utils.ts
rename to client/src/hooks/utils.ts