Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions frontend/src/app/history/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,20 @@ export default function HistoryPage() {
PAGE_SIZE,
serverSort,
);
if (!data || !data.payments) {
throw new Error("Invalid response: missing payments data");
}
setRecords(data.payments);
setPagination({
page: data.pagination.page,
pages: data.pagination.pages,
total: data.pagination.total,
page: data.pagination?.page ?? 1,
pages: data.pagination?.pages ?? 1,
total: data.pagination?.total ?? 0,
});
} catch (e: any) {
setError(e.message ?? "Failed to load payment history");
const errorMsg = e.message ?? "Failed to load payment history";
setError(errorMsg);
setRecords([]);
setPagination({ page: 1, pages: 1, total: 0 });
} finally {
setLoading(false);
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/CollaboratorTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Props {
loading?: boolean;
onAdd: (address: string, basisPoints: number) => Promise<void>;
onRemove: (address: string) => Promise<void>;
onRefresh?: () => Promise<void>;
}

import styles from './CollaboratorTable.module.css';
Expand Down
22 changes: 7 additions & 15 deletions frontend/src/store/paymentStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"use client";

import { create } from "zustand";
import { persist } from "zustand/middleware";

interface PaymentFormState {
meterId: string;
Expand All @@ -11,17 +10,10 @@ interface PaymentFormState {
reset: () => void;
}

export const usePaymentStore = create<PaymentFormState>()(
persist(
(set) => ({
meterId: "",
plan: "Daily",
setMeterId: (id: string) => set({ meterId: id }),
setPlan: (plan: "Daily" | "Weekly" | "Usage") => set({ plan }),
reset: () => set({ meterId: "", plan: "Daily" }),
}),
{
name: "payment-form",
}
)
);
export const usePaymentStore = create<PaymentFormState>((set) => ({
meterId: "",
plan: "Daily",
setMeterId: (id: string) => set({ meterId: id }),
setPlan: (plan: "Daily" | "Weekly" | "Usage") => set({ plan }),
reset: () => set({ meterId: "", plan: "Daily" }),
}));
3 changes: 3 additions & 0 deletions frontend/src/store/walletStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export const useWalletStore = create<WalletState>((set, get) => ({
connect: async () => {
set({ connectError: null });
try {
if (typeof window === "undefined" || !(window as any).freighter) {
throw new Error("Freighter extension is not installed. Please install it to continue.");
}
const kit = buildKit();
await kit.openModal({
onWalletSelected: async (option) => {
Expand Down