remove listable currency implementation. use formatCount

This commit is contained in:
Francis Cao committed 2026-03-05 12:52:04 -08:00
1 parent 9d72f8803a
commit 72bb63fe5e
4 files changed
+8 -19

No files matched your search

+1 -1
View File
@@ -134,7 +134,7 @@ export function SideNav(props: any) {
</Column> </Column>
)} )}
</Column> </Column>
<Row marginBottom="4" style={{ flexShrink: 0 }}> <Row marginBottom="4" paddingTop="2">
<UserButton showText={!isCollapsed} /> <UserButton showText={!isCollapsed} />
</Row> </Row>
</Column> </Column>
@@ -16,7 +16,6 @@ export interface AttributionProps {
model: string; model: string;
type: string; type: string;
step: string; step: string;
currency?: string;
} }
export function Attribution({ export function Attribution({
@@ -26,7 +25,6 @@ export function Attribution({
model, model,
type, type,
step, step,
currency,
}: AttributionProps) { }: AttributionProps) {
const { data, error, isLoading } = useResultQuery<any>('attribution', { const { data, error, isLoading } = useResultQuery<any>('attribution', {
websiteId, websiteId,
@@ -72,8 +70,7 @@ export function Attribution({
return ( return (
<ListTable <ListTable
title={title} title={title}
metric={t(currency ? labels.revenue : labels.visitors)} metric={t(labels.visitors)}
currency={currency}
data={attributionData.map(({ x, y, z }: { x: string; y: number; z: number }) => ({ data={attributionData.map(({ x, y, z }: { x: string; y: number; z: number }) => ({
label: x, label: x,
count: y, count: y,
@@ -133,7 +133,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
percent: (value / data?.total.sum) * 100, percent: (value / data?.total.sum) * 100,
}), }),
)} )}
currency={currency} formatCount={(n: number) => formatLongCurrency(n, currency)}
renderLabel={renderLabel('referrer')} renderLabel={renderLabel('referrer')}
/> />
</TabPanel> </TabPanel>
@@ -148,7 +148,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
percent: (value / data?.total.sum) * 100, percent: (value / data?.total.sum) * 100,
}), }),
)} )}
currency={currency} formatCount={(n: number) => formatLongCurrency(n, currency)}
renderLabel={renderLabel('channel')} renderLabel={renderLabel('channel')}
/> />
</TabPanel> </TabPanel>
@@ -172,7 +172,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
percent: (value / data?.total.sum) * 100, percent: (value / data?.total.sum) * 100,
}), }),
)} )}
currency={currency} formatCount={(n: number) => formatLongCurrency(n, currency)}
renderLabel={renderLabel('country')} renderLabel={renderLabel('country')}
/> />
</TabPanel> </TabPanel>
@@ -196,7 +196,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
percent: (value / data?.total.sum) * 100, percent: (value / data?.total.sum) * 100,
}), }),
)} )}
currency={currency} formatCount={(n: number) => formatLongCurrency(n, currency)}
renderLabel={renderLabel('region')} renderLabel={renderLabel('region')}
/> />
</TabPanel> </TabPanel>
+2 -10
View File
@@ -5,7 +5,7 @@ import { FixedSizeList } from 'react-window';
import { AnimatedDiv } from '@/components/common/AnimatedDiv'; import { AnimatedDiv } from '@/components/common/AnimatedDiv';
import { Empty } from '@/components/common/Empty'; import { Empty } from '@/components/common/Empty';
import { useMessages, useMobile } from '@/components/hooks'; import { useMessages, useMobile } from '@/components/hooks';
import { formatLongCurrency, formatLongNumber } from '@/lib/format'; import { formatLongNumber } from '@/lib/format';
const ITEM_SIZE = 30; const ITEM_SIZE = 30;
@@ -26,7 +26,6 @@ export interface ListTableProps {
virtualize?: boolean; virtualize?: boolean;
showPercentage?: boolean; showPercentage?: boolean;
itemCount?: number; itemCount?: number;
currency?: string;
formatCount?: (n: number) => string; formatCount?: (n: number) => string;
} }
@@ -40,7 +39,6 @@ export function ListTable({
virtualize = false, virtualize = false,
showPercentage = true, showPercentage = true,
itemCount = 10, itemCount = 10,
currency,
formatCount, formatCount,
}: ListTableProps) { }: ListTableProps) {
const { t, labels } = useMessages(); const { t, labels } = useMessages();
@@ -58,7 +56,6 @@ export function ListTable({
animate={animate && !virtualize} animate={animate && !virtualize}
showPercentage={showPercentage} showPercentage={showPercentage}
change={renderChange ? renderChange(row, index) : null} change={renderChange ? renderChange(row, index) : null}
currency={currency}
formatCount={formatCount} formatCount={formatCount}
isPhone={isPhone} isPhone={isPhone}
/> />
@@ -108,7 +105,6 @@ const AnimatedRow = ({
change, change,
animate, animate,
showPercentage = true, showPercentage = true,
currency,
formatCount, formatCount,
isPhone, isPhone,
}) => { }) => {
@@ -137,11 +133,7 @@ const AnimatedRow = ({
{change} {change}
<Text weight="bold"> <Text weight="bold">
<AnimatedDiv title={props?.y as any}> <AnimatedDiv title={props?.y as any}>
{currency {formatCount ? props.y?.to(formatCount) : props.y?.to(formatLongNumber)}
? props.y?.to(n => formatLongCurrency(n, currency))
: formatCount
? props.y?.to(formatCount)
: props.y?.to(formatLongNumber)}
</AnimatedDiv> </AnimatedDiv>
</Text> </Text>
</Row> </Row>