Improvements to revenue screen
This commit is contained in:
1 parent
fda83acdea
commit
acfd4462e3
10 files changed
+308
-9
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { useSpring } from '@react-spring/web';
|
||||
import { Column, Text } from '@umami/react-zen';
|
||||
import { Button, Column, Icon, Row, Text, Tooltip, TooltipTrigger } from '@umami/react-zen';
|
||||
import type { ReactNode } from 'react';
|
||||
import { AnimatedDiv } from '@/components/common/AnimatedDiv';
|
||||
import { Info } from '@/components/icons';
|
||||
import { ChangeLabel } from '@/components/metrics/ChangeLabel';
|
||||
import { formatNumber } from '@/lib/format';
|
||||
|
||||
@@ -9,6 +11,7 @@ export interface MetricCardProps {
|
||||
previousValue?: number;
|
||||
change?: number;
|
||||
label?: string;
|
||||
tooltip?: ReactNode;
|
||||
reverseColors?: boolean;
|
||||
formatValue?: (n: any) => string;
|
||||
showLabel?: boolean;
|
||||
@@ -19,6 +22,7 @@ export const MetricCard = ({
|
||||
value = 0,
|
||||
change = 0,
|
||||
label,
|
||||
tooltip,
|
||||
reverseColors = false,
|
||||
formatValue = formatNumber,
|
||||
showLabel = true,
|
||||
@@ -40,9 +44,21 @@ export const MetricCard = ({
|
||||
gap="4"
|
||||
>
|
||||
{showLabel && (
|
||||
<Text weight="bold" wrap="nowrap">
|
||||
{label}
|
||||
</Text>
|
||||
<Row justifyContent="space-between" alignItems="flex-start">
|
||||
<Text weight="bold" wrap="nowrap">
|
||||
{label}
|
||||
</Text>
|
||||
{tooltip && (
|
||||
<TooltipTrigger delay={0}>
|
||||
<Button size="sm" variant="quiet">
|
||||
<Icon size="sm">
|
||||
<Info />
|
||||
</Icon>
|
||||
</Button>
|
||||
<Tooltip placement="top">{tooltip}</Tooltip>
|
||||
</TooltipTrigger>
|
||||
)}
|
||||
</Row>
|
||||
)}
|
||||
<Text size="4xl" weight="bold" wrap="nowrap">
|
||||
<AnimatedDiv title={value?.toString()}>{props?.x?.to(x => formatValue(x))}</AnimatedDiv>
|
||||
|
||||
Reference in new issue
Block a user