diff --git a/frontend/components/dashboard/dashboard-view.tsx b/frontend/components/dashboard/dashboard-view.tsx index 7d27cdd..f1440bd 100644 --- a/frontend/components/dashboard/dashboard-view.tsx +++ b/frontend/components/dashboard/dashboard-view.tsx @@ -239,17 +239,17 @@ function renderStreams( onShowDetails(stream); }} > - {stream.date} - - {stream.recipient} - - - {stream.deposited} {stream.token} - - - {stream.withdrawn} {stream.token} - - + {stream.date} + + {stream.recipient} + + + {stream.deposited} {stream.token} + + + {stream.withdrawn} {stream.token} + +
{/^\d+$/.test(stream.id) ? ( ) : null} - + > + Add Funds +
- - - ))} + + + ))} @@ -432,6 +432,15 @@ export function DashboardView({ session, onDisconnect }: DashboardViewProps) { setStreamFormMessage(null); }; + const handleTopUp = (streamId: string) => { + const amount = prompt(`Enter amount to add to stream ${streamId}:`); + if (amount && !Number.isNaN(parseFloat(amount)) && parseFloat(amount) > 0) { + console.log(`Adding ${amount} funds to stream ${streamId}`); + // TODO: Integrate with Soroban contract's top_up_stream function + alert(`Successfully added ${amount} to stream ${streamId}`); + } + }; + const handleApplyTemplate = (templateId: string) => { const template = templates.find((item) => item.id === templateId); if (!template) return; @@ -503,8 +512,8 @@ export function DashboardView({ session, onDisconnect }: DashboardViewProps) { setTemplates((prev) => prev.filter((item) => item.id !== templateId)); if (selectedTemplateId === templateId) setSelectedTemplateId(null); if (editingTemplateId === templateId) { - setEditingTemplateId(null); - setTemplateNameInput(""); + setEditingTemplateId(null); + setTemplateNameInput(""); } }; @@ -688,7 +697,7 @@ export function DashboardView({ session, onDisconnect }: DashboardViewProps) { (endDate.getTime() - startDate.getTime()) / 1000, ); if (durationSeconds <= 0) { - setStreamFormMessage({ + setStreamFormMessage({ text: "End time must be after start time.", tone: "error", }); @@ -708,8 +717,8 @@ export function DashboardView({ session, onDisconnect }: DashboardViewProps) { handleResetStreamForm(); setStreamFormMessage({ text: "Stream submitted to wallet and confirmed on-chain.", - tone: "success", - }); + tone: "success", + }); } catch (err) { setStreamFormMessage({ text: toSorobanErrorMessage(err), @@ -996,18 +1005,18 @@ export function DashboardView({ session, onDisconnect }: DashboardViewProps) {
- +