@@ -40,10 +40,19 @@ import Icon from "../components/ui/Icon";
4040 * Manages high-level state for wallet connection, active tabs, and invoice data.
4141 */
4242export default function Page ( ) {
43+ < < << << < HEAD
44+ // --- Component State ---
45+ /** The public Stellar address of the connected user */
46+ const [ address , setAddress ] = useState ( "" ) ;
47+ /** List of invoices fetched from the backend pipeline */
48+ const [ invoices , setInvoices ] = useState ( [ ] ) ;
49+ /** Loading state for initial data fetch */
50+ = === ===
4351 const router = useRouter ( ) ;
4452 const searchParams = useSearchParams ( ) ;
4553 const { isConnected, walletAddress, isConnecting } = useWalletConnection ( ) ;
4654 const [ invoices , setInvoices ] = useState < InvoiceSummary [ ] > ( [ ] ) ;
55+ > >>> >>> upstream / main
4756 const [ loading , setLoading ] = useState ( false ) ;
4857 /** Controls visibility of the Invoice Minting modal */
4958 const [ showMintForm , setShowMintForm ] = useState ( false ) ;
@@ -56,6 +65,16 @@ export default function Page() {
5665 const { toggleWatchlist, isInWatchlist } = useWatchlist ( ) ;
5766 const riskSocketRef = useRef < RiskSocketClient | null > ( null ) ;
5867
68+ < < << << < HEAD
69+ // --- Handlers ---
70+
71+ /**
72+ * Triggers the Stellar wallet connection flow.
73+ * Supports multiple providers via the stellar-wallets-kit.
74+ *
75+ * @param {WalletType } walletType - The ID of the wallet provider (e.g., Freighter).
76+ */
77+ = === ===
5978 // Initialize filters from URL params
6079 const [ filters , setFilters ] = useState < InvoiceFilters > ( ( ) => ( {
6180 minApy : parseFloat ( searchParams . get ( 'minApy' ) || '0' ) ,
@@ -77,18 +96,46 @@ export default function Page() {
7796
7897
7998 // 1. Connect Stellar Wallet (supports Freighter, Albedo, xBull)
99+ >>> > >>> upstream / main
80100 const handleConnectWallet = async ( walletType : WalletType ) => {
81101 try {
82102 const userInfo = await connectWallet ( walletType ) ;
83103 if ( userInfo && userInfo . publicKey ) {
84104 setAddress ( userInfo . publicKey ) ;
105+ < < << << < HEAD
106+ console . log ( "[Dashboard] Wallet connected:" , userInfo . publicKey , "Provider:" , userInfo . walletType ) ;
107+ }
108+ } catch ( e : any ) {
109+ console . error ( "[Dashboard] Connection failed:" , e . message ) ;
110+ // In production, this would be a user-friendly toast notification
111+ alert ( e . message || "Failed to connect to wallet." ) ;
112+ }
113+ } ;
114+
115+ /**
116+ * Fetches the latest verified assets from the RWA pipeline.
117+ * Currently points to a local mock API for development.
118+ */
119+ const fetchInvoices = async ( ) = > {
120+ setLoading ( true ) ;
121+ try {
122+ // TODO: Replace with environment-aware API base URL
123+ const res = await fetch ( "http://localhost:3000/invoices" ) ;
124+ const data = await res . json ( ) ;
125+ setInvoices ( data ) ;
126+ } catch ( e ) {
127+ console . warn ( "[Dashboard] Asset pipeline API not reachable. Check if local server is running." ) ;
128+ } finally {
129+ setLoading ( false ) ;
130+ === = ===
85131 console . log ( "Wallet connected:" , userInfo . publicKey , "Type:" , userInfo . walletType ) ;
86132 showSuccess ( "Wallet connected" ) ;
87133 }
88134 } catch ( e : unknown) {
89135 const error = e as Error ;
90136 console . error ( "Connection failed:" , error . message ) ;
91137 showError ( error . message || "Failed to connect to wallet." ) ;
138+ >>> > >>> upstream / main
92139 }
93140 } ;
94141
@@ -118,6 +165,24 @@ export default function Page() {
118165 } ;
119166 } , [ ] ) ;
120167
168+ << < < << < HEAD
169+ /**
170+ * Debugging utility for testing transaction status notifications.
171+ */
172+ const handleTestToast = ( ) => {
173+ const toast = useTransactionToast ( ) ;
174+ toast . loading ( ) ;
175+ setTimeout ( ( ) => toast . success ( ) , 2000 ) ;
176+ } ;
177+
178+ /**
179+ * Callback triggered when a new invoice is successfully submitted for minting.
180+ *
181+ * @param {any } data - The validated invoice metadata.
182+ */
183+ const handleInvoiceMint = ( data : any ) => {
184+ console . log ( "[Dashboard] Mint request received:" , data ) ;
185+ === === =
121186 useEffect ( ( ) => {
122187 if ( ! walletAddress ) {
123188 riskSocketRef . current ?. disconnect ( ) ;
@@ -163,6 +228,7 @@ export default function Page() {
163228
164229 const handleInvoiceMint = ( data : Record < string, unknown > ) => {
165230 console . log ( "Invoice data received:" , data ) ;
231+ >>> >>> > upstream / main
166232 setShowMintForm ( false ) ;
167233 // TODO: Initiate Soroban contract call for minting the NFT
168234 } ;
@@ -172,7 +238,11 @@ export default function Page() {
172238 /** Tab definitions for the main navigation */
173239 const tabs = [
174240 { id : "dashboard" , label : "Dashboard" } ,
241+ < < << << < HEAD
242+ { id : "watchlist" , label : "Watchlist" , icon : < Star size = { 16 } aria - hidden = "true" / > } ,
243+ = === ===
175244 { id : "watchlist" , label : "Watchlist" , icon : < Icon icon = { Star } dense / > } ,
245+ > > >>> >> upstream / main
176246 ] ;
177247
178248
0 commit comments