mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
Update FunnelChart.tsx
This commit is contained in:
parent
15cfa5f583
commit
b466d2d23b
1 changed files with 12 additions and 5 deletions
|
|
@ -2,7 +2,8 @@ import { useContext } from 'react';
|
|||
import classNames from 'classnames';
|
||||
import { useMessages } from 'components/hooks';
|
||||
import { ReportContext } from '../[reportId]/Report';
|
||||
import { formatLongNumber } from 'lib/format';
|
||||
import { formatLongNumberOptions } from 'lib/format';
|
||||
import { useIntl } from 'react-intl';
|
||||
import styles from './FunnelChart.module.css';
|
||||
|
||||
export interface FunnelChartProps {
|
||||
|
|
@ -13,6 +14,7 @@ export interface FunnelChartProps {
|
|||
export function FunnelChart({ className }: FunnelChartProps) {
|
||||
const { report } = useContext(ReportContext);
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const intl = useIntl();
|
||||
|
||||
const { data } = report || {};
|
||||
|
||||
|
|
@ -31,18 +33,23 @@ export function FunnelChart({ className }: FunnelChartProps) {
|
|||
</div>
|
||||
<div className={styles.metric}>
|
||||
<div>
|
||||
<span className={styles.visitors}>{formatLongNumber(visitors)}</span>
|
||||
<span className={styles.visitors}>
|
||||
{intl.formatNumber(+visitors, formatLongNumberOptions(+visitors))}
|
||||
</span>
|
||||
{formatMessage(labels.visitors)}
|
||||
</div>
|
||||
<div className={styles.percent}>{(remaining * 100).toFixed(2)}%</div>
|
||||
<div className={styles.percent}>
|
||||
{intl.formatNumber(+remaining, { style: 'percent', maximumFractionDigits: 2 })}
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.track}>
|
||||
<div className={styles.bar} style={{ width: `${remaining * 100}%` }}></div>
|
||||
</div>
|
||||
{dropoff > 0 && (
|
||||
<div className={styles.info}>
|
||||
<b>{formatLongNumber(dropped)}</b> {formatMessage(labels.visitorsDroppedOff)} (
|
||||
{(dropoff * 100).toFixed(2)}%)
|
||||
<b>{intl.formatNumber(+dropped, formatLongNumberOptions(+dropped))}</b>{' '}
|
||||
{formatMessage(labels.visitorsDroppedOff)} (
|
||||
{intl.formatNumber(+dropoff, { style: 'percent', maximumFractionDigits: 2 })})
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue