@@ -49,6 +49,18 @@ export function ChatPageContent(props: {
4949 const connectionStatus = useActiveWalletConnectionStatus ( ) ;
5050 const connectedWallets = useConnectedWallets ( ) ;
5151 const setActiveWallet = useSetActiveWallet ( ) ;
52+ const [ chatAbortController , setChatAbortController ] = useState <
53+ AbortController | undefined
54+ > ( ) ;
55+
56+ const [ isChatStreaming , setIsChatStreaming ] = useState ( false ) ;
57+ const [ enableAutoScroll , setEnableAutoScroll ] = useState ( false ) ;
58+ const [ showConnectModal , setShowConnectModal ] = useState ( false ) ;
59+
60+ // User-configurable context options
61+ const [ userWalletAddress , setUserWalletAddress ] = useState ( "" ) ;
62+ const [ userChainIds , setUserChainIds ] = useState ( "" ) ;
63+ const [ userAutoExecute , setUserAutoExecute ] = useState ( false ) ;
5264
5365 const [ userHasSubmittedMessage , setUserHasSubmittedMessage ] = useState ( false ) ;
5466 const [ messages , setMessages ] = useState < Array < ChatMessage > > ( ( ) => {
@@ -70,17 +82,30 @@ export function ChatPageContent(props: {
7082 const contextFilters = useMemo ( ( ) => {
7183 // Parse user-entered chain IDs
7284 const userChainIdArray = userChainIds
73- . split ( ',' )
74- . map ( id => id . trim ( ) )
75- . filter ( id => id !== '' && ! isNaN ( Number ( id ) ) ) ;
85+ . split ( "," )
86+ . map ( ( id ) => id . trim ( ) )
87+ . filter ( ( id ) => id !== "" && ! isNaN ( Number ( id ) ) ) ;
7688
7789 return {
78- chainIds : userChainIdArray . length > 0 ? userChainIdArray : ( _contextFilters ?. chainIds || [ ] ) ,
90+ chainIds :
91+ userChainIdArray . length > 0
92+ ? userChainIdArray
93+ : _contextFilters ?. chainIds || [ ] ,
7994 sessionId : _contextFilters ?. sessionId || null ,
80- walletAddress : userWalletAddress . trim ( ) || address || _contextFilters ?. walletAddress || null ,
95+ walletAddress :
96+ userWalletAddress . trim ( ) ||
97+ address ||
98+ _contextFilters ?. walletAddress ||
99+ null ,
81100 autoExecuteTransactions : userAutoExecute ,
82101 } satisfies NebulaContext ;
83- } , [ _contextFilters , address , userWalletAddress , userChainIds , userAutoExecute ] ) ;
102+ } , [
103+ _contextFilters ,
104+ address ,
105+ userWalletAddress ,
106+ userChainIds ,
107+ userAutoExecute ,
108+ ] ) ;
84109
85110 const setContextFilters = useCallback ( ( v : NebulaContext | undefined ) => {
86111 _setContextFilters ( v ) ;
@@ -114,19 +139,6 @@ export function ChatPageContent(props: {
114139 } ) ;
115140 } , [ ] ) ;
116141
117- const [ chatAbortController , setChatAbortController ] = useState <
118- AbortController | undefined
119- > ( ) ;
120-
121- const [ isChatStreaming , setIsChatStreaming ] = useState ( false ) ;
122- const [ enableAutoScroll , setEnableAutoScroll ] = useState ( false ) ;
123- const [ showConnectModal , setShowConnectModal ] = useState ( false ) ;
124-
125- // User-configurable context options
126- const [ userWalletAddress , setUserWalletAddress ] = useState ( "" ) ;
127- const [ userChainIds , setUserChainIds ] = useState ( "" ) ;
128- const [ userAutoExecute , setUserAutoExecute ] = useState ( false ) ;
129-
130142 const handleSendMessage = useCallback (
131143 async ( message : NebulaUserMessage ) => {
132144 setUserHasSubmittedMessage ( true ) ;
@@ -748,7 +760,10 @@ function ContextOptionsBar(props: {
748760 < div className = "mb-4 rounded-lg border bg-card p-3" >
749761 < div className = "flex flex-wrap items-center gap-4" >
750762 < div className = "flex items-center gap-2" >
751- < label htmlFor = "wallet-address" className = "text-sm font-medium text-muted-foreground" >
763+ < label
764+ htmlFor = "wallet-address"
765+ className = "text-sm font-medium text-muted-foreground"
766+ >
752767 Wallet Address:
753768 </ label >
754769 < input
@@ -761,9 +776,12 @@ function ContextOptionsBar(props: {
761776 style = { { width : "200px" } }
762777 />
763778 </ div >
764-
779+
765780 < div className = "flex items-center gap-2" >
766- < label htmlFor = "chain-ids" className = "text-sm font-medium text-muted-foreground" >
781+ < label
782+ htmlFor = "chain-ids"
783+ className = "text-sm font-medium text-muted-foreground"
784+ >
767785 Chain IDs:
768786 </ label >
769787 < input
@@ -776,7 +794,7 @@ function ContextOptionsBar(props: {
776794 style = { { width : "100px" } }
777795 />
778796 </ div >
779-
797+
780798 < div className = "flex items-center gap-2" >
781799 < input
782800 id = "auto-execute"
@@ -785,7 +803,10 @@ function ContextOptionsBar(props: {
785803 onChange = { ( e ) => props . onAutoExecuteChange ( e . target . checked ) }
786804 className = "w-4 h-4 text-primary border-border rounded focus:ring-ring"
787805 />
788- < label htmlFor = "auto-execute" className = "text-sm font-medium text-muted-foreground" >
806+ < label
807+ htmlFor = "auto-execute"
808+ className = "text-sm font-medium text-muted-foreground"
809+ >
789810 Auto Execute Transactions
790811 </ label >
791812 </ div >
0 commit comments