🐸 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.tsindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tsxindex 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.tssimilarity index 79%rename from client/src/app/hooks/useGetBrowsers.tsrename to client/src/hooks/useGetBrowsers.tsindex 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.tssimilarity index 79%rename from client/src/app/hooks/useGetCountries.tsrename to client/src/hooks/useGetCountries.tsindex 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.tssimilarity index 80%rename from client/src/app/hooks/useGetDevices.tsrename to client/src/hooks/useGetDevices.tsindex 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.tssimilarity index 78%rename from client/src/app/hooks/useGetOperatingSystems.tsrename to client/src/hooks/useGetOperatingSystems.tsindex 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.tssimilarity index 80%rename from client/src/app/hooks/useGetPages.tsrename to client/src/hooks/useGetPages.tsindex 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.tssimilarity index 80%rename from client/src/app/hooks/useGetPageviews.tsrename to client/src/hooks/useGetPageviews.tsindex 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.tssimilarity index 79%rename from client/src/app/hooks/useGetReferrers.tsrename to client/src/hooks/useGetReferrers.tsindex 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.tssimilarity index 100%rename from client/src/app/hooks/utils.tsrename to client/src/hooks/utils.ts