Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

887 B
Raw Blame
import { LoadingPanel } from '@/components/common/LoadingPanel';
import { useDateRange } from '@/components/hooks';
import { useRevenueStatsQuery } from '@/components/hooks/queries/useRevenueStatsQuery';
import { RevenueMetricsBar } from './RevenueMetricsBar';
import { useBoardRevenueCurrency } from './useBoardRevenueCurrency';

export function BoardRevenueMetricsBar({
  websiteId,
  currency: selectedCurrency,
}: {
  websiteId: string;
  currency?: string;
}) {
  const currency = useBoardRevenueCurrency(selectedCurrency);
  const { compare } = useDateRange();
  const { data, isLoading, isFetching, error } = useRevenueStatsQuery({
    websiteId,
    currency,
    compare,
  });

  return (
    <LoadingPanel data={data} isLoading={isLoading} isFetching={isFetching} error={error}>
      {data && <RevenueMetricsBar data={data} currency={currency} />}
    </LoadingPanel>
  );
}