Upgrade react-zen and migrate UI components to its updated APIs
This commit is contained in:
1 parent
f054830292
commit
6ac2b9377c
83 files changed
+1337
-506
No files matched your search
@@ -37,7 +37,7 @@ export function DatePickerForm({
|
||||
return (
|
||||
<Column gap>
|
||||
<Row justifyContent="center">
|
||||
<ToggleGroup disallowEmptySelection value={selected} onChange={setSelected}>
|
||||
<ToggleGroup value={selected} onChange={setSelected}>
|
||||
<ToggleGroupItem id={FILTER_DAY}>{t(labels.singleDay)}</ToggleGroupItem>
|
||||
<ToggleGroupItem id={FILTER_RANGE}>{t(labels.dateRange)}</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { Focusable, Grid, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import { addHours, format, startOfDay } from 'date-fns';
|
||||
import { Fragment } from 'react';
|
||||
import { LoadingPanel } from '@/components/common/LoadingPanel';
|
||||
import { useLocale, useMessages, useWeeklyTrafficQuery } from '@/components/hooks';
|
||||
import { getDayOfWeekAsDate } from '@/lib/date';
|
||||
@@ -75,28 +76,36 @@ export function WeeklyTraffic({ websiteId }: { websiteId: string }) {
|
||||
>
|
||||
{day?.map((count: number, j) => {
|
||||
const pct = max ? count / max : 0;
|
||||
return (
|
||||
<TooltipTrigger key={j} delay={0} isDisabled={count <= 0}>
|
||||
<Focusable>
|
||||
const cell = (
|
||||
<Focusable>
|
||||
<Row
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
backgroundColor="surface-raised"
|
||||
width="16px"
|
||||
height="16px"
|
||||
borderRadius="full"
|
||||
style={{ margin: '0 auto' }}
|
||||
role="button"
|
||||
>
|
||||
<Row
|
||||
alignItems="center"
|
||||
justifyContent="center"
|
||||
backgroundColor="surface-raised"
|
||||
backgroundColor="primary"
|
||||
width="16px"
|
||||
height="16px"
|
||||
borderRadius="full"
|
||||
style={{ margin: '0 auto' }}
|
||||
role="button"
|
||||
>
|
||||
<Row
|
||||
backgroundColor="primary"
|
||||
width="16px"
|
||||
height="16px"
|
||||
borderRadius="full"
|
||||
style={{ opacity: pct, transform: `scale(${pct})` }}
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
style={{ opacity: pct, transform: `scale(${pct})` }}
|
||||
/>
|
||||
</Row>
|
||||
</Focusable>
|
||||
);
|
||||
|
||||
if (count <= 0) {
|
||||
return <Fragment key={j}>{cell}</Fragment>;
|
||||
}
|
||||
|
||||
return (
|
||||
<TooltipTrigger key={j} delay={0}>
|
||||
{cell}
|
||||
<Tooltip
|
||||
placement="right"
|
||||
style={{ backgroundColor: 'rgba(0,0,0,0.8)', color: 'white' }}
|
||||
|
||||
Reference in new issue
Block a user