Updated tables. Added MenuButton.

This commit is contained in:
Mike Cao 2025-05-07 04:10:27 -07:00
parent 92b283486e
commit a15c7cd596
27 changed files with 334 additions and 207 deletions

View file

@ -1,4 +1,4 @@
import { useMemo } from 'react';
import { useCallback, useMemo } from 'react';
import { useTheme } from '@umami/react-zen';
import { BarChart, BarChartProps } from '@/components/charts/BarChart';
import { useLocale, useMessages } from '@/components/hooks';
@ -28,8 +28,8 @@ export function PageviewsChart({
}: PageviewsChartProps) {
const { formatMessage, labels } = useMessages();
const { theme } = useTheme();
const { colors } = getThemeColors(theme);
const { locale } = useLocale();
const { colors } = useMemo(() => getThemeColors(theme), [theme]);
const chartData = useMemo(() => {
if (!data) {
@ -37,6 +37,7 @@ export function PageviewsChart({
}
return {
__id: new Date().getTime(),
datasets: [
{
label: formatMessage(labels.visitors),
@ -78,6 +79,8 @@ export function PageviewsChart({
};
}, [data, locale]);
const renderXLabel = useCallback(renderDateLabels(unit, locale), [unit, locale]);
return (
<BarChart
{...props}
@ -85,7 +88,7 @@ export function PageviewsChart({
unit={unit}
isLoading={isLoading}
isAllTime={isAllTime}
renderXLabel={renderDateLabels(unit, locale)}
renderXLabel={renderXLabel}
/>
);
}