set tip lbc as default when none is saved in state

This commit is contained in:
Anthony 2021-09-09 18:54:37 +02:00
parent 7b0cde601f
commit aba8b64dbe
No known key found for this signature in database
GPG key ID: C386D3C93D50E356

View file

@ -83,12 +83,18 @@ function WalletSendTip(props: Props) {
const [tipError, setTipError] = React.useState();
// denote which tab to show on the frontend
const [activeTab, setActiveTab] = usePersistedState(TAB_BOOST);
const [activeTab, setActiveTab] = usePersistedState(TAB_LBC);
// force to boost tab if it's someone's own upload
// handle default active tab
React.useEffect(() => {
// force to boost tab if it's someone's own upload
if (claimIsMine) {
setActiveTab(TAB_BOOST);
} else {
// or set LBC tip as the default if none is set yet
if (!activeTab || activeTab === 'undefined') {
setActiveTab(TAB_LBC);
}
}
}, []);
@ -564,6 +570,7 @@ function WalletSendTip(props: Props) {
<ChannelSelector />
</div>
{/* prompt to save a card */}
{activeTab === TAB_FIAT && !hasCardSaved && (
<h3 className="add-card-prompt">
<Button navigate={`/$/${PAGES.SETTINGS_STRIPE_CARD}`} label={__('Add a Card')} button="link" />{' '}