From 0b848989a2e340a44294a35680ca2216c59bfdc4 Mon Sep 17 00:00:00 2001 From: Harvey Zuccon Date: Sat, 30 May 2026 20:50:26 +0200 Subject: [PATCH] Remove transaction screen from the menu in invitationScreen --- .../screens/invitations/InvitationScreen.tsx | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/tui/screens/invitations/InvitationScreen.tsx b/src/tui/screens/invitations/InvitationScreen.tsx index c7c8bc4..5ce111f 100644 --- a/src/tui/screens/invitations/InvitationScreen.tsx +++ b/src/tui/screens/invitations/InvitationScreen.tsx @@ -63,7 +63,7 @@ const actionItems: ListItemData[] = [ { key: 'accept', label: 'Accept & Join', value: 'accept' }, { key: 'fill', label: 'Fill Requirements', value: 'fill' }, { key: 'sign', label: 'Sign Transaction', value: 'sign' }, - { key: 'transaction', label: 'View Transaction', value: 'transaction' }, + { key: 'broadcast', label: 'Broadcast Transaction', value: 'broadcast' }, { key: 'copy', label: 'Copy Invitation ID', value: 'copy' }, ]; @@ -332,6 +332,30 @@ export function InvitationScreen(): React.ReactElement { } }, [selectedInvitation, showInfo, showError, setStatus]); + /** + * Broadcast transaction. + */ + const broadcastTransaction = useCallback(async () => { + if (!selectedInvitation) return; + + setIsLoading(true); + setStatus('Broadcasting transaction...'); + + try { + await selectedInvitation.broadcast(); + showInfo( + `Transaction Broadcast Successful!\n\n` + + `The transaction has been submitted to the network.` + ); + setStatus('Ready'); + } catch (error) { + showError(`Failed to broadcast: ${error instanceof Error ? error.message : String(error)}`); + } finally { + setIsLoading(false); + setStatus('Ready'); + } + }, [selectedInvitation, showInfo, showError, setStatus]); + const copyId = useCallback(async () => { if (!selectedInvitation) { showError('No invitation selected'); @@ -489,13 +513,11 @@ export function InvitationScreen(): React.ReactElement { case 'sign': signInvitation(); break; - case 'transaction': - if (selectedInvitation) { - navigate('transaction', { invitationId: selectedInvitation.data.invitationIdentifier }); - } + case 'broadcast': + broadcastTransaction(); break; } - }, [selectedInvitation, copyId, acceptInvitation, fillRequirements, signInvitation, navigate]); + }, [selectedInvitation, copyId, acceptInvitation, fillRequirements, signInvitation, broadcastTransaction, navigate]); const handleListItemActivate = useCallback((item: InvitationListItem, _index: number) => { if (item.key === 'import') {