Skip to content

armgit / umami

Public Imported from GitHub
0

Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.

remove listable currency implementation. use formatCount

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