Skip to content

Commit 15d6ed5

Browse files
committed
style: apply formatter and add learn link to confirmation modal tooltip
- Run formatter across all changed files - Show "TBD" instead of "Swap too small" in confirmation modal with the same tooltip copy and Learn link as the swap interface - Change InfoRow tooltip prop to ReactNode to support inline links
1 parent 3c0b499 commit 15d6ed5

10 files changed

Lines changed: 37 additions & 34 deletions

File tree

src/components/dashboard/UserSwapsModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function UserSwapsModalBody({ address }: { address: string }) {
104104
</Badge>
105105
</TooltipTrigger>
106106
<TooltipContent side="bottom" className="max-w-[240px] text-xs">
107-
Total miles across all your Fast Swaps, shown before a 2%
108-
referral fee is deducted (if applicable).
107+
Total miles across all your Fast Swaps, shown before a 2% referral fee is deducted
108+
(if applicable).
109109
</TooltipContent>
110110
</Tooltip>
111111
</TooltipProvider>

src/components/dashboard/UserSwapsTable.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export function UserSwapsTable({ address, isConnected }: Props) {
6464
</Badge>
6565
</TooltipTrigger>
6666
<TooltipContent side="bottom" className="max-w-[240px] text-xs">
67-
Total miles across all your Fast Swaps, shown before a 2%
68-
referral fee is deducted (if applicable).
67+
Total miles across all your Fast Swaps, shown before a 2% referral fee is
68+
deducted (if applicable).
6969
</TooltipContent>
7070
</Tooltip>
7171
</TooltipProvider>
@@ -108,11 +108,7 @@ export function UserSwapsTable({ address, isConnected }: Props) {
108108
</Card>
109109

110110
{isConnected && address ? (
111-
<UserSwapsModal
112-
open={isModalOpen}
113-
onOpenChange={setIsModalOpen}
114-
address={address}
115-
/>
111+
<UserSwapsModal open={isModalOpen} onOpenChange={setIsModalOpen} address={address} />
116112
) : null}
117113
</>
118114
)

src/components/dashboard/user-swaps-parts.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,8 @@ export function MilesDiscrepancyInfo() {
217217
</button>
218218
</TooltipTrigger>
219219
<TooltipContent side="top" className="max-w-[300px] text-xs">
220-
This total is the sum of miles credited across all your Fast
221-
Swaps, shown after a 2% referral fee is deducted (if
222-
applicable).
220+
This total is the sum of miles credited across all your Fast Swaps, shown after a 2%
221+
referral fee is deducted (if applicable).
223222
</TooltipContent>
224223
</Tooltip>
225224
</TooltipProvider>

src/components/modals/SwapConfirmationModal.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ interface SwapConfirmationModalProps {
117117
interface InfoRowProps {
118118
label: string
119119
value: React.ReactNode
120-
tooltip?: string
120+
tooltip?: React.ReactNode
121121
valueClassName?: string
122122
}
123123

@@ -913,13 +913,27 @@ function SwapConfirmationModal({
913913
/>
914914
</span>
915915
) : (
916-
<span className="text-gray-500">Swap too small</span>
916+
<span className="text-gray-500">TBD</span>
917917
)
918918
}
919919
tooltip={
920-
estimatedMiles > 0
921-
? "Estimated Fast Miles earned from MEV redistribution on this swap"
922-
: "This swap's slippage value doesn't cover transaction costs, so no miles are earned. Try a larger amount."
920+
estimatedMiles > 0 ? (
921+
"Estimated Fast Miles earned from MEV redistribution on this swap"
922+
) : (
923+
<>
924+
We are unable to show a miles estimate at this time. You may continue to
925+
earn miles as your swap executes. See{" "}
926+
<a
927+
href="/learn/miles#about-the-miles-estimate"
928+
target="_blank"
929+
rel="noreferrer"
930+
className="underline underline-offset-2 text-[#3898FF] hover:text-[#5aa9ff]"
931+
>
932+
Learn
933+
</a>{" "}
934+
for more info.
935+
</>
936+
)
923937
}
924938
valueClassName={estimatedMiles > 0 ? "text-[#3898FF]" : "text-gray-500"}
925939
/>

src/components/swap/ExchangeRate.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,8 @@ const ExchangeRateComponent: React.FC<ExchangeRateProps> = ({
181181
</span>
182182
</TooltipTrigger>
183183
<TooltipContent side="top" className="max-w-[260px] text-xs">
184-
We are unable to show a miles estimate at this time.
185-
You may continue to earn miles as your swap executes.
186-
See{" "}
184+
We are unable to show a miles estimate at this time. You may continue to
185+
earn miles as your swap executes. See{" "}
187186
<a
188187
href="/learn/miles#about-the-miles-estimate"
189188
target="_blank"

src/hooks/use-gate-status.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ export function useGateStatus() {
7676
// initialData so React Query resolves synchronously (isLoading=false
7777
// on the very first render) and set staleTime to Infinity so no
7878
// refetch is attempted for this address in this tab session.
79-
const isCached =
80-
typeof window !== "undefined" && !!address && getCachedApproval(address)
79+
const isCached = typeof window !== "undefined" && !!address && getCachedApproval(address)
8180

8281
const { data, isLoading } = useQuery({
8382
queryKey: [GATE_STATUS_QUERY_KEY, address],

src/hooks/use-user-swaps.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,7 @@ export function useUserSwaps(
247247
pollTimerRef.current = setTimeout(() => {
248248
const controller = new AbortController()
249249
abortRef.current = controller
250-
fetchSwaps(addr, p, controller.signal, { silent: true }).then(() =>
251-
schedulePoll(addr, p)
252-
)
250+
fetchSwaps(addr, p, controller.signal, { silent: true }).then(() => schedulePoll(addr, p))
253251
}, delay)
254252
},
255253
[clearPollTimer, fetchSwaps, pollIntervalMs]
@@ -278,9 +276,7 @@ export function useUserSwaps(
278276
// Immediate silent refetch — don't wait for the next poll tick.
279277
const controller = new AbortController()
280278
abortRef.current = controller
281-
fetchSwaps(addr, p, controller.signal, { silent: true }).then(() =>
282-
schedulePoll(addr, p)
283-
)
279+
fetchSwaps(addr, p, controller.signal, { silent: true }).then(() => schedulePoll(addr, p))
284280
},
285281
[fetchSwaps, schedulePoll]
286282
)

src/lib/analytics/services/fastswap.service.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,8 @@ export async function getUserRecentSwaps(
107107
])
108108

109109
const aggRow = aggRows[0] ?? []
110-
const total =
111-
aggRow[0] != null && Number.isFinite(Number(aggRow[0])) ? Number(aggRow[0]) : 0
112-
const totalMiles =
113-
aggRow[1] != null && Number.isFinite(Number(aggRow[1])) ? Number(aggRow[1]) : 0
110+
const total = aggRow[0] != null && Number.isFinite(Number(aggRow[0])) ? Number(aggRow[0]) : 0
111+
const totalMiles = aggRow[1] != null && Number.isFinite(Number(aggRow[1])) ? Number(aggRow[1]) : 0
114112
const totalPages = total === 0 ? 0 : Math.ceil(total / safePageSize)
115113

116114
return {

src/lib/swap-events.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ function readPending(): PendingEntry[] {
4545
const parsed = JSON.parse(raw) as PendingStore
4646
if (!parsed || !Array.isArray(parsed.entries)) return []
4747
const now = Date.now()
48-
return parsed.entries.filter((e) => e && typeof e.hash === "string" && now - e.submittedAt < EXPIRY_MS)
48+
return parsed.entries.filter(
49+
(e) => e && typeof e.hash === "string" && now - e.submittedAt < EXPIRY_MS
50+
)
4951
} catch {
5052
return []
5153
}

tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)