-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35058 from lukemorawski/20354-quick_fix_searchpag…
…e_list_refactor 20354 quick fix searchpage list refactor
- Loading branch information
Showing
6 changed files
with
46 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,19 @@ | ||
import React, {useState} from 'react'; | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import ReferralProgramCTA from '@components/ReferralProgramCTA'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import * as User from '@userActions/User'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import type {DismissedReferralBanners} from '@src/types/onyx/Account'; | ||
|
||
type SearchPageFooterOnyxProps = { | ||
dismissedReferralBanners: DismissedReferralBanners; | ||
}; | ||
function SearchPageFooter({dismissedReferralBanners}: SearchPageFooterOnyxProps) { | ||
const [shouldShowReferralCTA, setShouldShowReferralCTA] = useState(!dismissedReferralBanners[CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND]); | ||
function SearchPageFooter() { | ||
const themeStyles = useThemeStyles(); | ||
|
||
const closeCallToActionBanner = () => { | ||
setShouldShowReferralCTA(false); | ||
User.dismissReferralBanner(CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND); | ||
}; | ||
|
||
return ( | ||
<> | ||
{shouldShowReferralCTA && ( | ||
<View style={[themeStyles.pb5, themeStyles.flexShrink0]}> | ||
<ReferralProgramCTA | ||
referralContentType={CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND} | ||
onCloseButtonPress={closeCallToActionBanner} | ||
/> | ||
</View> | ||
)} | ||
</> | ||
<View style={[themeStyles.flexShrink0]}> | ||
<ReferralProgramCTA referralContentType={CONST.REFERRAL_PROGRAM.CONTENT_TYPES.REFER_FRIEND} /> | ||
</View> | ||
); | ||
} | ||
|
||
SearchPageFooter.displayName = 'SearchPageFooter'; | ||
|
||
export default withOnyx<SearchPageFooterOnyxProps, SearchPageFooterOnyxProps>({ | ||
dismissedReferralBanners: { | ||
key: ONYXKEYS.ACCOUNT, | ||
selector: (data) => data?.dismissedReferralBanners ?? {}, | ||
}, | ||
})(SearchPageFooter); | ||
export default SearchPageFooter; |
Oops, something went wrong.