Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Remove the selected chain container and add it to the filter la… #1157

Merged
merged 1 commit into from
May 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 7 additions & 39 deletions src/components/chain-search/ChainSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ import {
SearchRoundInput,
} from '../../components/styled/Containers';
import _ from 'lodash';
import {Action, Slate, SlateDark, White} from '../../styles/colors';
import {Action, Slate, White} from '../../styles/colors';
import {BaseText} from '../../components/styled/Text';
import SearchSvg from '../../../assets/img/search.svg';
import ChevronDownSvgLight from '../../../assets/img/chevron-down-lightmode.svg';
import ChevronDownSvgDark from '../../../assets/img/chevron-down-darkmode.svg';
import CloseSvgDark from '../../../assets/img/close-darkmode.svg';
import CloseSvgLight from '../../../assets/img/close-lightmode.svg';
import debounce from 'lodash.debounce';
import {AppActions} from '../../store/app';
import {useTranslation} from 'react-i18next';
import {EIP155_CHAINS} from '../../constants/WalletConnectV2';
import cloneDeep from 'lodash.clonedeep';
import {Wallet} from '../../store/wallet/wallet.models';
import {useTheme} from 'styled-components/native';
import {setDefaultChainFilterOption} from '../../store/app/app.actions';
import {BitpaySupportedCoins} from '../../constants/currencies';

export const SearchIconContainer = styled.View`
margin: 14px;
Expand All @@ -38,13 +36,6 @@ export const SearchFilterContainer = styled.TouchableOpacity`
background: ${({theme: {dark}}) => (dark ? '#2240C440' : '#ECEFFD')};
`;

export const SelectedChainFilterContainer = styled(SearchFilterContainer)`
right: 140px;
margin: 8px 8px 8px 8px;
border: 1px solid ${({theme: {dark}}) => (dark ? SlateDark : Action)};
background-color: transparent;
`;

export const RowFilterContainer = styled.View`
flex-direction: row;
display: flex;
Expand All @@ -58,12 +49,6 @@ export const SearchFilterLabelContainer = styled.View`
margin-right: 15px;
`;

export const SelectedChainFilterLabelContainer = styled(
SearchFilterLabelContainer,
)`
margin-right: 10px;
`;

export const SearchFilterLabel = styled(BaseText)`
color: ${({theme: {dark}}) => (dark ? White : Action)};
font-size: 12px;
Expand Down Expand Up @@ -215,34 +200,17 @@ const SearchComponent = <T extends SearchableItem>({
placeholder={t('Search')}
onChangeText={updateSearchResults}
/>
{selectedChainFilterOption ? (
<SelectedChainFilterContainer
onPress={() => {
dispatch(setDefaultChainFilterOption(undefined));
}}>
<RowFilterContainer>
<SelectedChainFilterLabelContainer>
<SearchFilterLabel>
{selectedChainFilterOption.toUpperCase()}
</SearchFilterLabel>
</SelectedChainFilterLabelContainer>
<SearchFilterIconContainer>
{!theme.dark ? (
<CloseSvgLight width={10} height={10} />
) : (
<CloseSvgDark width={10} height={10} />
)}
</SearchFilterIconContainer>
</RowFilterContainer>
</SelectedChainFilterContainer>
) : null}
<SearchFilterContainer
onPress={() => {
dispatch(AppActions.showChainSelectorModal({}));
}}>
<RowFilterContainer>
<SearchFilterLabelContainer>
<SearchFilterLabel>{t('All Networks')}</SearchFilterLabel>
<SearchFilterLabel>
{selectedChainFilterOption
? BitpaySupportedCoins[selectedChainFilterOption]?.name
: t('All Networks')}
</SearchFilterLabel>
</SearchFilterLabelContainer>
<SearchFilterIconContainer>
{!theme.dark ? (
Expand Down