Skip to content

Commit 38dbc03

Browse files
committed
lint
1 parent 49204b5 commit 38dbc03

File tree

6 files changed

+22
-24
lines changed

6 files changed

+22
-24
lines changed

apps/dashboard/src/@/lib/time.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function getFiltersFromSearchParams(params: {
4141
const defaultInterval =
4242
params.interval ??
4343
(differenceInCalendarDays(range.to, range.from) > 30
44-
? "week"
44+
? ("week" as const)
4545
: ("day" as const));
4646

4747
return {
@@ -51,6 +51,6 @@ export function getFiltersFromSearchParams(params: {
5151
? ("day" as const)
5252
: params.interval === "week"
5353
? ("week" as const)
54-
: defaultInterval,
54+
: (defaultInterval as "day" | "week"),
5555
};
5656
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/engine/cloud/analytics/filter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function TransactionAnalyticsFilter() {
3636
/>
3737

3838
<IntervalSelector
39-
intervalType={interval}
39+
intervalType={interval as "day" | "week"}
4040
setIntervalType={(newInterval) => {
4141
setResponsiveSearchParams((v) => {
4242
return {

apps/dashboard/src/app/(app)/team/components/Analytics/EmptyStateCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function EmptyStateContent({
3131
link?: string;
3232
}) {
3333
return (
34-
<div className="flex flex-col items-center justify-center w-full gap-2 text-foreground">
34+
<div className="flex w-full flex-col items-center justify-center gap-2 text-foreground">
3535
<div className="flex size-8 items-center justify-center rounded-md border bg-card">
3636
<PlugIcon className="size-4" />
3737
</div>

apps/dashboard/src/components/pay/PayAnalytics/components/PayNewCustomers.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,18 @@ export function PayNewCustomers(props: {
4747
value: newUsers,
4848
});
4949
}
50-
const lastPeriod = newUsersData[newUsersData.length - 2];
51-
const currentPeriod = newUsersData[newUsersData.length - 1];
50+
const lastPeriod = newUsersData[newUsersData.length - 3];
51+
const currentPeriod = newUsersData[newUsersData.length - 2];
5252
// Calculate the percent change from last period to current period
5353
const trend =
54-
lastPeriod && currentPeriod && lastPeriod.value > 0
54+
lastPeriod &&
55+
currentPeriod &&
56+
lastPeriod.value > 0 &&
57+
currentPeriod.value > 0
5558
? (currentPeriod.value - lastPeriod.value) / lastPeriod.value
56-
: lastPeriod?.value === 0
59+
: lastPeriod?.value === 0 && (currentPeriod?.value || 0) > 0
5760
? 100
58-
: 0;
61+
: undefined;
5962
return { graphData: newUsersData, trend };
6063
}, [props.data, props.dateFormat]);
6164
const isEmpty = useMemo(
@@ -87,7 +90,7 @@ export function PayNewCustomers(props: {
8790
}}
8891
/>
8992

90-
{!isEmpty && (
93+
{!isEmpty && typeof trend !== "undefined" && (
9194
<SkeletonContainer
9295
loadedData={trend}
9396
className="rounded-2xl"

apps/dashboard/src/components/pay/PayAnalytics/components/Payouts.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,17 @@ export function Payouts(props: {
4949
value: total / 100,
5050
});
5151
}
52-
const lastPeriod = cleanedData[cleanedData.length - 2];
53-
const currentPeriod = cleanedData[cleanedData.length - 1];
52+
const lastPeriod = cleanedData[cleanedData.length - 3];
53+
const currentPeriod = cleanedData[cleanedData.length - 2];
5454
const trend =
55-
lastPeriod && currentPeriod && lastPeriod.value > 0
55+
lastPeriod &&
56+
currentPeriod &&
57+
lastPeriod.value > 0 &&
58+
currentPeriod.value > 0
5659
? (currentPeriod.value - lastPeriod.value) / lastPeriod.value
57-
: lastPeriod?.value === 0
60+
: lastPeriod?.value === 0 && (currentPeriod?.value || 0) > 0
5861
? 100
59-
: 0;
62+
: undefined;
6063
return {
6164
graphData: cleanedData,
6265
totalPayoutsUSD: totalPayouts / 100,
@@ -91,7 +94,7 @@ export function Payouts(props: {
9194
}}
9295
/>
9396

94-
{!isEmpty && (
97+
{!isEmpty && typeof trend !== "undefined" && (
9598
<SkeletonContainer
9699
className="rounded-2xl"
97100
loadedData={trend}

apps/dashboard/src/types/analytics.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ export interface WalletUserStats {
1414
totalUsers: number;
1515
}
1616

17-
export interface AggregatedStats {
18-
date: string;
19-
totalUsers: number;
20-
newUsers: number;
21-
returningUsers: number;
22-
totalVolumeUsdCents: number;
23-
}
24-
2517
export interface InAppWalletStats {
2618
date: string;
2719
authenticationMethod: string;

0 commit comments

Comments
 (0)