mirror of
https://github.com/umami-software/umami.git
synced 2026-02-09 07:07:17 +01:00
Reformatted files with biome.
This commit is contained in:
parent
d51f0641a6
commit
fa8d8055df
558 changed files with 2108 additions and 2379 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { StatusLight, Text } from '@umami/react-zen';
|
||||
import { useMemo } from 'react';
|
||||
import { Text, StatusLight } from '@umami/react-zen';
|
||||
import { useMessages, useActyiveUsersQuery } from '@/components/hooks';
|
||||
import { useActyiveUsersQuery, useMessages } from '@/components/hooks';
|
||||
|
||||
export function ActiveUsers({
|
||||
websiteId,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Icon, Text, Row, RowProps } from '@umami/react-zen';
|
||||
import { ReactNode } from 'react';
|
||||
import { Icon, Row, type RowProps, Text } from '@umami/react-zen';
|
||||
import type { ReactNode } from 'react';
|
||||
import { ArrowRight } from '@/components/icons';
|
||||
|
||||
const STYLES = {
|
||||
|
|
@ -33,7 +33,7 @@ export function ChangeLabel({
|
|||
} & RowProps) {
|
||||
const positive = value >= 0;
|
||||
const negative = value < 0;
|
||||
const neutral = value === 0 || isNaN(value);
|
||||
const neutral = value === 0 || Number.isNaN(value);
|
||||
const good = reverseColors ? negative : positive;
|
||||
|
||||
const style =
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Button, Calendar, Column, Row, ToggleGroup, ToggleGroupItem } from '@umami/react-zen';
|
||||
import { endOfDay, isAfter, isBefore, isSameDay, startOfDay } from 'date-fns';
|
||||
import { useState } from 'react';
|
||||
import { Button, Row, Column, Calendar, ToggleGroup, ToggleGroupItem } from '@umami/react-zen';
|
||||
import { isAfter, isBefore, isSameDay, startOfDay, endOfDay } from 'date-fns';
|
||||
import { useMessages } from '@/components/hooks';
|
||||
|
||||
const FILTER_DAY = 'filter-day';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Grid, Column, Text, Label } from '@umami/react-zen';
|
||||
import { useEventDataQuery } from '@/components/hooks';
|
||||
import { Column, Grid, Label, Text } from '@umami/react-zen';
|
||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||
import { useEventDataQuery } from '@/components/hooks';
|
||||
|
||||
export function EventData({ websiteId, eventId }: { websiteId: string; eventId: string }) {
|
||||
const { data, isLoading, error } = useEventDataQuery(websiteId, eventId);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
import { BarChart, BarChartProps } from '@/components/charts/BarChart';
|
||||
import { colord } from 'colord';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { BarChart, type BarChartProps } from '@/components/charts/BarChart';
|
||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||
import {
|
||||
useDateRange,
|
||||
|
|
@ -9,8 +11,6 @@ import {
|
|||
import { renderDateLabels } from '@/lib/charts';
|
||||
import { CHART_COLORS } from '@/lib/constants';
|
||||
import { generateTimeSeries } from '@/lib/date';
|
||||
import { colord } from 'colord';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
|
||||
export interface EventsChartProps extends BarChartProps {
|
||||
websiteId: string;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Row, StatusLight, Text } from '@umami/react-zen';
|
||||
import type { LegendItem } from 'chart.js/auto';
|
||||
import { colord } from 'colord';
|
||||
import { LegendItem } from 'chart.js/auto';
|
||||
|
||||
export function Legend({
|
||||
items = [],
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { ReactNode } from 'react';
|
||||
import { config, useSpring } from '@react-spring/web';
|
||||
import { Column, Grid, Row, Text } from '@umami/react-zen';
|
||||
import type { ReactNode } from 'react';
|
||||
import { FixedSizeList } from 'react-window';
|
||||
import { useSpring, config } from '@react-spring/web';
|
||||
import { Grid, Row, Column, Text } from '@umami/react-zen';
|
||||
import { AnimatedDiv } from '@/components/common/AnimatedDiv';
|
||||
import { Empty } from '@/components/common/Empty';
|
||||
import { useMessages, useMobile } from '@/components/hooks';
|
||||
|
|
@ -105,7 +105,7 @@ const AnimatedRow = ({
|
|||
}) => {
|
||||
const props = useSpring({
|
||||
width: percent,
|
||||
y: !isNaN(value) ? value : 0,
|
||||
y: !Number.isNaN(value) ? value : 0,
|
||||
from: { width: 0, y: 0 },
|
||||
config: animate ? config.default : { duration: 0 },
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { Text, Column } from '@umami/react-zen';
|
||||
import { useSpring } from '@react-spring/web';
|
||||
import { formatNumber } from '@/lib/format';
|
||||
import { Column, Text } from '@umami/react-zen';
|
||||
import { AnimatedDiv } from '@/components/common/AnimatedDiv';
|
||||
import { ChangeLabel } from '@/components/metrics/ChangeLabel';
|
||||
import { formatNumber } from '@/lib/format';
|
||||
|
||||
export interface MetricCardProps {
|
||||
value: number;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import { Row } from '@umami/react-zen';
|
||||
import { Favicon } from '@/components/common/Favicon';
|
||||
import { FilterLink } from '@/components/common/FilterLink';
|
||||
import { TypeIcon } from '@/components/common/TypeIcon';
|
||||
import {
|
||||
useCountryNames,
|
||||
useFormat,
|
||||
useLocale,
|
||||
useMessages,
|
||||
useRegionNames,
|
||||
useFormat,
|
||||
} from '@/components/hooks';
|
||||
import { FilterLink } from '@/components/common/FilterLink';
|
||||
import { TypeIcon } from '@/components/common/TypeIcon';
|
||||
import { Favicon } from '@/components/common/Favicon';
|
||||
import { GROUPED_DOMAINS } from '@/lib/constants';
|
||||
|
||||
export interface MetricLabelProps {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { ReactNode } from 'react';
|
||||
import { Grid, GridProps } from '@umami/react-zen';
|
||||
import { Grid, type GridProps } from '@umami/react-zen';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export interface MetricsBarProps extends GridProps {
|
||||
children?: ReactNode;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { ReactNode, useState } from 'react';
|
||||
import { Button, Column, DataColumn, DataTable, Icon, Row, SearchField } from '@umami/react-zen';
|
||||
import { type ReactNode, useState } from 'react';
|
||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||
import { useMessages, useWebsiteExpandedMetricsQuery } from '@/components/hooks';
|
||||
import { X } from '@/components/icons';
|
||||
import { DownloadButton } from '@/components/input/DownloadButton';
|
||||
import { formatShortTime } from '@/lib/format';
|
||||
import { MetricLabel } from '@/components/metrics/MetricLabel';
|
||||
import { SESSION_COLUMNS } from '@/lib/constants';
|
||||
import { formatShortTime } from '@/lib/format';
|
||||
|
||||
export interface MetricsExpandedTableProps {
|
||||
websiteId: string;
|
||||
|
|
@ -85,7 +85,7 @@ export function MetricsExpandedTable({
|
|||
align="end"
|
||||
width="120px"
|
||||
>
|
||||
{row => row?.['visitors']?.toLocaleString()}
|
||||
{row => row?.visitors?.toLocaleString()}
|
||||
</DataColumn>
|
||||
<DataColumn
|
||||
id="visits"
|
||||
|
|
@ -93,7 +93,7 @@ export function MetricsExpandedTable({
|
|||
align="end"
|
||||
width="120px"
|
||||
>
|
||||
{row => row?.['visits']?.toLocaleString()}
|
||||
{row => row?.visits?.toLocaleString()}
|
||||
</DataColumn>
|
||||
<DataColumn
|
||||
id="pageviews"
|
||||
|
|
@ -101,7 +101,7 @@ export function MetricsExpandedTable({
|
|||
align="end"
|
||||
width="120px"
|
||||
>
|
||||
{row => row?.['pageviews']?.toLocaleString()}
|
||||
{row => row?.pageviews?.toLocaleString()}
|
||||
</DataColumn>
|
||||
{showBounceDuration && [
|
||||
<DataColumn
|
||||
|
|
@ -112,8 +112,8 @@ export function MetricsExpandedTable({
|
|||
width="120px"
|
||||
>
|
||||
{row => {
|
||||
const n = (Math.min(row?.['visits'], row?.['bounces']) / row?.['visits']) * 100;
|
||||
return Math.round(+n) + '%';
|
||||
const n = (Math.min(row?.visits, row?.bounces) / row?.visits) * 100;
|
||||
return `${Math.round(+n)}%`;
|
||||
}}
|
||||
</DataColumn>,
|
||||
|
||||
|
|
@ -125,7 +125,7 @@ export function MetricsExpandedTable({
|
|||
width="120px"
|
||||
>
|
||||
{row => {
|
||||
const n = row?.['totaltime'] / row?.['visits'];
|
||||
const n = row?.totaltime / row?.visits;
|
||||
return `${+n < 0 ? '-' : ''}${formatShortTime(Math.abs(~~n), ['m', 's'], ' ')}`;
|
||||
}}
|
||||
</DataColumn>,
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
import { Grid, Icon, Row, Text } from '@umami/react-zen';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { Icon, Text, Row, Grid } from '@umami/react-zen';
|
||||
import { LinkButton } from '@/components/common/LinkButton';
|
||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||
import { useMessages, useNavigation, useWebsiteMetricsQuery } from '@/components/hooks';
|
||||
import { Maximize } from '@/components/icons';
|
||||
import { MetricLabel } from '@/components/metrics/MetricLabel';
|
||||
import { percentFilter } from '@/lib/filters';
|
||||
import { ListTable, ListTableProps } from './ListTable';
|
||||
import { ListTable, type ListTableProps } from './ListTable';
|
||||
|
||||
export interface MetricsTableProps extends ListTableProps {
|
||||
websiteId: string;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useCallback, useMemo } from 'react';
|
||||
import { useTheme } from '@umami/react-zen';
|
||||
import { BarChart, BarChartProps } from '@/components/charts/BarChart';
|
||||
import { useCallback, useMemo } from 'react';
|
||||
import { BarChart, type BarChartProps } from '@/components/charts/BarChart';
|
||||
import { useLocale, useMessages } from '@/components/hooks';
|
||||
import { renderDateLabels } from '@/lib/charts';
|
||||
import { getThemeColors } from '@/lib/colors';
|
||||
|
|
@ -28,7 +28,7 @@ export function PageviewsChart({ data, unit, minDate, maxDate, ...props }: Pagev
|
|||
if (!data) return;
|
||||
|
||||
return {
|
||||
__id: new Date().getTime(),
|
||||
__id: Date.now(),
|
||||
datasets: [
|
||||
{
|
||||
type: 'bar',
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import { isBefore, startOfMinute, subMinutes } from 'date-fns';
|
||||
import { useMemo, useRef } from 'react';
|
||||
import { startOfMinute, subMinutes, isBefore } from 'date-fns';
|
||||
import { PageviewsChart } from './PageviewsChart';
|
||||
import { DEFAULT_ANIMATION_DURATION, REALTIME_RANGE } from '@/lib/constants';
|
||||
import { RealtimeData } from '@/lib/types';
|
||||
import { useTimezone } from '@/components/hooks';
|
||||
import { DEFAULT_ANIMATION_DURATION, REALTIME_RANGE } from '@/lib/constants';
|
||||
import type { RealtimeData } from '@/lib/types';
|
||||
import { PageviewsChart } from './PageviewsChart';
|
||||
|
||||
export interface RealtimeChartProps {
|
||||
data: RealtimeData;
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { Row, Grid, Text } from '@umami/react-zen';
|
||||
import { format, startOfDay, addHours } from 'date-fns';
|
||||
import { useLocale, useMessages, useWeeklyTrafficQuery } from '@/components/hooks';
|
||||
import { Focusable, Grid, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { addHours, format, startOfDay } from 'date-fns';
|
||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||
import { useLocale, useMessages, useWeeklyTrafficQuery } from '@/components/hooks';
|
||||
import { getDayOfWeekAsDate } from '@/lib/date';
|
||||
import { Focusable, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
|
||||
export function WeeklyTraffic({ websiteId }: { websiteId: string }) {
|
||||
const { data, isLoading, error } = useWeeklyTrafficQuery(websiteId);
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
import { FloatingTooltip, Column, useTheme, ColumnProps } from '@umami/react-zen';
|
||||
import { useState, useMemo } from 'react';
|
||||
import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps';
|
||||
import { Column, type ColumnProps, FloatingTooltip, useTheme } from '@umami/react-zen';
|
||||
import { colord } from 'colord';
|
||||
import { ISO_COUNTRIES, MAP_FILE } from '@/lib/constants';
|
||||
import { useMemo, useState } from 'react';
|
||||
import { ComposableMap, Geographies, Geography, ZoomableGroup } from 'react-simple-maps';
|
||||
import {
|
||||
useWebsiteMetricsQuery,
|
||||
useCountryNames,
|
||||
useLocale,
|
||||
useMessages,
|
||||
useWebsiteMetricsQuery,
|
||||
} from '@/components/hooks';
|
||||
import { formatLongNumber } from '@/lib/format';
|
||||
import { percentFilter } from '@/lib/filters';
|
||||
import { getThemeColors } from '@/lib/colors';
|
||||
import { ISO_COUNTRIES, MAP_FILE } from '@/lib/constants';
|
||||
import { percentFilter } from '@/lib/filters';
|
||||
import { formatLongNumber } from '@/lib/format';
|
||||
|
||||
export interface WorldMapProps extends ColumnProps {
|
||||
websiteId?: string;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue