Skip to content

Commit 72bb63f

Browse files
committed
remove listable currency implementation. use formatCount
1 parent 9d72f88 commit 72bb63f

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

src/app/(main)/SideNav.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export function SideNav(props: any) {
134134
</Column>
135135
)}
136136
</Column>
137-
<Row marginBottom="4" style={{ flexShrink: 0 }}>
137+
<Row marginBottom="4" paddingTop="2">
138138
<UserButton showText={!isCollapsed} />
139139
</Row>
140140
</Column>

src/app/(main)/websites/[websiteId]/(reports)/attribution/Attribution.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export interface AttributionProps {
1616
model: string;
1717
type: string;
1818
step: string;
19-
currency?: string;
2019
}
2120

2221
export function Attribution({
@@ -26,7 +25,6 @@ export function Attribution({
2625
model,
2726
type,
2827
step,
29-
currency,
3028
}: AttributionProps) {
3129
const { data, error, isLoading } = useResultQuery<any>('attribution', {
3230
websiteId,
@@ -72,8 +70,7 @@ export function Attribution({
7270
return (
7371
<ListTable
7472
title={title}
75-
metric={t(currency ? labels.revenue : labels.visitors)}
76-
currency={currency}
73+
metric={t(labels.visitors)}
7774
data={attributionData.map(({ x, y, z }: { x: string; y: number; z: number }) => ({
7875
label: x,
7976
count: y,

src/app/(main)/websites/[websiteId]/(reports)/revenue/Revenue.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
133133
percent: (value / data?.total.sum) * 100,
134134
}),
135135
)}
136-
currency={currency}
136+
formatCount={(n: number) => formatLongCurrency(n, currency)}
137137
renderLabel={renderLabel('referrer')}
138138
/>
139139
</TabPanel>
@@ -148,7 +148,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
148148
percent: (value / data?.total.sum) * 100,
149149
}),
150150
)}
151-
currency={currency}
151+
formatCount={(n: number) => formatLongCurrency(n, currency)}
152152
renderLabel={renderLabel('channel')}
153153
/>
154154
</TabPanel>
@@ -172,7 +172,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
172172
percent: (value / data?.total.sum) * 100,
173173
}),
174174
)}
175-
currency={currency}
175+
formatCount={(n: number) => formatLongCurrency(n, currency)}
176176
renderLabel={renderLabel('country')}
177177
/>
178178
</TabPanel>
@@ -196,7 +196,7 @@ export function Revenue({ websiteId, startDate, endDate, unit }: RevenueProps) {
196196
percent: (value / data?.total.sum) * 100,
197197
}),
198198
)}
199-
currency={currency}
199+
formatCount={(n: number) => formatLongCurrency(n, currency)}
200200
renderLabel={renderLabel('region')}
201201
/>
202202
</TabPanel>

src/components/metrics/ListTable.tsx

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { FixedSizeList } from 'react-window';
55
import { AnimatedDiv } from '@/components/common/AnimatedDiv';
66
import { Empty } from '@/components/common/Empty';
77
import { useMessages, useMobile } from '@/components/hooks';
8-
import { formatLongCurrency, formatLongNumber } from '@/lib/format';
8+
import { formatLongNumber } from '@/lib/format';
99

1010
const ITEM_SIZE = 30;
1111

@@ -26,7 +26,6 @@ export interface ListTableProps {
2626
virtualize?: boolean;
2727
showPercentage?: boolean;
2828
itemCount?: number;
29-
currency?: string;
3029
formatCount?: (n: number) => string;
3130
}
3231

@@ -40,7 +39,6 @@ export function ListTable({
4039
virtualize = false,
4140
showPercentage = true,
4241
itemCount = 10,
43-
currency,
4442
formatCount,
4543
}: ListTableProps) {
4644
const { t, labels } = useMessages();
@@ -58,7 +56,6 @@ export function ListTable({
5856
animate={animate && !virtualize}
5957
showPercentage={showPercentage}
6058
change={renderChange ? renderChange(row, index) : null}
61-
currency={currency}
6259
formatCount={formatCount}
6360
isPhone={isPhone}
6461
/>
@@ -108,7 +105,6 @@ const AnimatedRow = ({
108105
change,
109106
animate,
110107
showPercentage = true,
111-
currency,
112108
formatCount,
113109
isPhone,
114110
}) => {
@@ -137,11 +133,7 @@ const AnimatedRow = ({
137133
{change}
138134
<Text weight="bold">
139135
<AnimatedDiv title={props?.y as any}>
140-
{currency
141-
? props.y?.to(n => formatLongCurrency(n, currency))
142-
: formatCount
143-
? props.y?.to(formatCount)
144-
: props.y?.to(formatLongNumber)}
136+
{formatCount ? props.y?.to(formatCount) : props.y?.to(formatLongNumber)}
145137
</AnimatedDiv>
146138
</Text>
147139
</Row>

0 commit comments

Comments
 (0)