@@ -173,7 +173,8 @@ export default class CashuTokenView extends React.Component<
173173 selectedIndex,
174174 cashuBBQrParts,
175175 cashuFrameIndex,
176- cashuBcurPart
176+ cashuBcurPart,
177+ isTokenTooLarge
177178 } = this . state ;
178179 const { mintUrls, addMint, claimToken, loading, errorAddingMint } =
179180 CashuStore ! ! ;
@@ -196,6 +197,14 @@ export default class CashuTokenView extends React.Component<
196197 const haveMint = mintUrls . includes ( mint ) ;
197198 const hasOpenChannels = ChannelsStore ?. channels ?. length > 0 ;
198199
200+ const isSingleFrameSelected = ! isTokenTooLarge && selectedIndex === 0 ;
201+ const isBcurSelected =
202+ ( ! isTokenTooLarge && selectedIndex === 1 ) ||
203+ ( isTokenTooLarge && selectedIndex === 0 ) ;
204+ const isBbqrSelected =
205+ ( ! isTokenTooLarge && selectedIndex === 2 ) ||
206+ ( isTokenTooLarge && selectedIndex === 1 ) ;
207+
199208 const qrButton = ( ) => (
200209 < Text
201210 style = { {
@@ -242,7 +251,7 @@ export default class CashuTokenView extends React.Component<
242251 </ Text >
243252 ) ;
244253 const bcurButton = ( ) => {
245- const bcurIndex = this . state . isTokenTooLarge ? 0 : 1 ;
254+ const bcurIndex = isTokenTooLarge ? 0 : 1 ;
246255 return (
247256 < Text
248257 style = { {
@@ -259,7 +268,7 @@ export default class CashuTokenView extends React.Component<
259268 } ;
260269
261270 const bbqrButton = ( ) => {
262- const bbqrIndex = this . state . isTokenTooLarge ? 1 : 2 ;
271+ const bbqrIndex = isTokenTooLarge ? 1 : 2 ;
263272 return (
264273 < Text
265274 style = { {
@@ -276,7 +285,7 @@ export default class CashuTokenView extends React.Component<
276285 } ;
277286
278287 const qrButtons : any = [
279- ! this . state . isTokenTooLarge && { element : singleButton } ,
288+ ! isTokenTooLarge && { element : singleButton } ,
280289 { element : bcurButton } ,
281290 { element : bbqrButton }
282291 ] . filter ( Boolean ) ;
@@ -469,29 +478,18 @@ export default class CashuTokenView extends React.Component<
469478 >
470479 < CollapsedQR
471480 value = {
472- ! this . state . isTokenTooLarge
473- ? selectedIndex === 0
474- ? `cashu:${ token } `
475- : selectedIndex === 1
476- ? cashuBcurPart
477- : cashuBBQrParts [
478- cashuFrameIndex
479- ]
480- : selectedIndex === 0
481+ isSingleFrameSelected
482+ ? `cashu:${ token } `
483+ : isBcurSelected
481484 ? cashuBcurPart
482485 : cashuBBQrParts [ cashuFrameIndex ]
483486 }
484487 copyValue = { `cashu:${ token } ` }
485488 iconOnly
486489 showShare = {
487- ! this . state . isTokenTooLarge &&
488- selectedIndex === 0
489- }
490- showSpeed = {
491- this . state . isTokenTooLarge ||
492- ( ! this . state . isTokenTooLarge &&
493- selectedIndex > 0 )
490+ isSingleFrameSelected || isBbqrSelected
494491 }
492+ showSpeed = { isBcurSelected }
495493 truncateLongValue
496494 expanded
497495 qrAnimationSpeed = {
0 commit comments