"use client"; import { Button } from "@heroui/button"; import { Drawer, DrawerBody, DrawerContent, DrawerHeader, Image, useDisclosure, } from "@heroui/react"; import { ChevronDownIcon, LandingAnalyticIcon, UserIcon } from "../icons"; import { MasterUsersIcon } from "../icons/sidebar-icon"; import { useEffect, useState } from "react"; import { getActivity } from "@/services/activity-log"; interface Activity { totalVisitorAllTime: number; totalVisitorToday: number; totalViewAllTime: number; } export default function AnalyticDrawer() { const { isOpen, onOpen, onOpenChange } = useDisclosure(); const [activity, setActivity] = useState({ totalVisitorAllTime: 0, totalVisitorToday: 0, totalViewAllTime: 0, }); useEffect(() => { initFetch(); }, []); const initFetch = async () => { const res = await getActivity(); if (res?.error) { return false; } setActivity(res?.data?.data); return false; }; return ( <>
{(onClose) => ( <>

Statistik Kunjungan

Perhitungan jumlah kunjugan website

Total visitor

logo

{activity.totalVisitorAllTime}

{activity.totalVisitorToday} Online

Total View

logo

{activity.totalViewAllTime}

)}
); }