From 50e311458b65573ff0959e589e0c5a8a1e009608 Mon Sep 17 00:00:00 2001 From: ScriptedBro Date: Wed, 9 Sep 2026 11:04:17 +0100 Subject: [PATCH 1/2] fix(frontend): resolve typecheck and lint errors --- apps/frontend/app/delegations/page.tsx | 2 +- .../components/ErrorBoundary.test.tsx | 7 +-- .../components/analytics/SpendChartInner.tsx | 2 +- .../components/delegations/DelegationCard.tsx | 29 +++++---- .../delegations/ExpiryCountdown.tsx | 2 +- .../delegations/SpendSimulatorPanel.tsx | 2 +- .../components/demo/DemoBanner.test.tsx | 6 +- .../components/escrows/DisputeStatusPanel.tsx | 2 +- .../components/escrows/EscrowCard.tsx | 21 +++++-- .../components/orders/ApprovalCard.tsx | 10 +-- .../components/orders/ApprovalDrawer.tsx | 4 +- .../frontend/components/orders/OrderTable.tsx | 4 +- .../components/orders/OrderTrackingCard.tsx | 13 ++-- .../components/orders/ReceiptPanel.tsx | 5 +- apps/frontend/components/orders/RefundCTA.tsx | 61 +++++++++---------- .../components/settings/PreferencesForm.tsx | 15 ++--- .../components/settings/ProfileForm.tsx | 4 +- apps/frontend/hooks/useBuiltinCommands.ts | 10 +-- apps/frontend/hooks/useSLANudge.ts | 2 +- apps/frontend/lib/analytics.ts | 5 +- apps/frontend/lib/approvals.test.ts | 6 +- apps/frontend/lib/replayEngine.ts | 17 +++--- .../frontend/mocks/handlers/approvals.test.ts | 2 +- apps/frontend/next.config.ts | 10 +++ 24 files changed, 129 insertions(+), 112 deletions(-) diff --git a/apps/frontend/app/delegations/page.tsx b/apps/frontend/app/delegations/page.tsx index 702f6f95..edc11783 100644 --- a/apps/frontend/app/delegations/page.tsx +++ b/apps/frontend/app/delegations/page.tsx @@ -56,7 +56,7 @@ export default function DelegationsPage() { const matchesSearch = term === "" || d.agentId.toLowerCase().includes(term) || - d.walletId.toLowerCase().includes(term); + (d.walletId ?? "").toLowerCase().includes(term); const matchesStatus = selectedStatuses.length === 0 || diff --git a/apps/frontend/components/ErrorBoundary.test.tsx b/apps/frontend/components/ErrorBoundary.test.tsx index 6c000e36..30c7b484 100644 --- a/apps/frontend/components/ErrorBoundary.test.tsx +++ b/apps/frontend/components/ErrorBoundary.test.tsx @@ -28,11 +28,6 @@ function AlwaysThrows(): never { throw new Error("Intentional test error"); } -/** A component that can be toggled to throw. */ -function TogglableThrow({ shouldThrow }: { shouldThrow: boolean }) { - if (shouldThrow) throw new Error("Toggled error"); - return
Widget content
; -} /** A sibling that counts its own renders to prove it wasn't remounted. */ function StableSibling() { @@ -100,7 +95,7 @@ describe("ErrorBoundary", () => { }); it("retry remounts only the failed subtree, leaving siblings untouched", () => { - const { rerender } = render( + render(
diff --git a/apps/frontend/components/analytics/SpendChartInner.tsx b/apps/frontend/components/analytics/SpendChartInner.tsx index 9e79c8a3..d1dcaf63 100644 --- a/apps/frontend/components/analytics/SpendChartInner.tsx +++ b/apps/frontend/components/analytics/SpendChartInner.tsx @@ -73,7 +73,7 @@ export default function SpendChartInner({ width={48} /> } + content={(props: any) => } cursor={{ fill: "var(--color-bg-subtle)" }} /> {editing ? (
+
+ { setUnrestrictedMerchants(unrestricted); if (unrestricted) setShowEmptyWhitelistError(false); }} - showEmptyError={showEmptyWhitelistError} - disabled={saving} + showEmptyWhitelistError={showEmptyWhitelistError} />
@@ -281,7 +280,7 @@ export function DelegationCard({
@@ -289,7 +288,7 @@ export function DelegationCard({
@@ -362,7 +361,11 @@ export function DelegationCard({ {showQr && (
- +
)} @@ -370,7 +373,7 @@ export function DelegationCard({ {showPauseModal && ( setShowPauseModal(false)} diff --git a/apps/frontend/components/delegations/ExpiryCountdown.tsx b/apps/frontend/components/delegations/ExpiryCountdown.tsx index d5711d83..00a75476 100644 --- a/apps/frontend/components/delegations/ExpiryCountdown.tsx +++ b/apps/frontend/components/delegations/ExpiryCountdown.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from "react"; export interface ExpiryCountdownProps { - expiresAt: string | Date | number | null; + expiresAt?: string | Date | number | null; } export function ExpiryCountdown({ expiresAt }: ExpiryCountdownProps) { diff --git a/apps/frontend/components/delegations/SpendSimulatorPanel.tsx b/apps/frontend/components/delegations/SpendSimulatorPanel.tsx index 038ef22d..b5ffe4ba 100644 --- a/apps/frontend/components/delegations/SpendSimulatorPanel.tsx +++ b/apps/frontend/components/delegations/SpendSimulatorPanel.tsx @@ -2,7 +2,7 @@ import Link from "next/link"; import { useState } from "react"; -import { Button, Card, StroopsInput } from "@delego/ui"; +import { Button, Card, StroopsInput } from "@delegolabs/ui"; import { useSpendSimulator } from "../../hooks/useSpendSimulator"; import type { SpendDenialReason } from "../../lib/spendSimulator"; import { diff --git a/apps/frontend/components/demo/DemoBanner.test.tsx b/apps/frontend/components/demo/DemoBanner.test.tsx index 61e1f24e..87896ab2 100644 --- a/apps/frontend/components/demo/DemoBanner.test.tsx +++ b/apps/frontend/components/demo/DemoBanner.test.tsx @@ -33,10 +33,8 @@ describe("DemoBanner", () => { it("exits demo mode when the exit button is clicked", async () => { enableDemoMode(); const originalLocation = window.location; - // @ts-expect-error -- overriding window.location for the test delete (window as any).location; - // @ts-expect-error -- partial Location stub is enough for this assertion - window.location = { href: "" }; + (window as any).location = { href: "" }; const user = userEvent.setup(); render(); @@ -47,6 +45,6 @@ describe("DemoBanner", () => { expect(isDemoMode()).toBe(false); expect(window.location.href).toBe("/"); - window.location = originalLocation; + (window as any).location = originalLocation; }); }); diff --git a/apps/frontend/components/escrows/DisputeStatusPanel.tsx b/apps/frontend/components/escrows/DisputeStatusPanel.tsx index 02363b83..2b63c0b5 100644 --- a/apps/frontend/components/escrows/DisputeStatusPanel.tsx +++ b/apps/frontend/components/escrows/DisputeStatusPanel.tsx @@ -78,7 +78,7 @@ export function DisputeStatusPanel({ escrow, dispute, optimistic }: DisputeStatu
Evidence