Skip to content
This repository has been archived by the owner on Feb 11, 2023. It is now read-only.

Commit

Permalink
Add Warning if English is selected #94
Browse files Browse the repository at this point in the history
  • Loading branch information
demianh committed Jun 14, 2022
1 parent 70ce3d3 commit 2a3d5df
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions src/components/infos/InfosList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import LanguageSwitcher from './LanguageSwitcher';
import {useIsFocused} from '@react-navigation/native';
import MovaSearchbarHeading from '../generic/MovaSearchbarHeading';
import MovaLoading from "../generic/MovaLoading";
import languageManager from '../../helpers/LanguageManager';

const MainContainer = styled.SafeAreaView`
background-color: #fff;
Expand All @@ -25,6 +26,11 @@ const InfosHeader = styled.View`
height: 78px;
`;

const EnglishWarning = styled.View`
padding: 10px;
background: black;
`;

type NavigationProp = StackNavigationProp<{infopage: {page: IPage}}, 'infopage'>;

function mainPageFilter(page: IPage): boolean {
Expand Down Expand Up @@ -96,15 +102,25 @@ export default function InfosList({navigation}: {navigation: NavigationProp}) {
)}
keyExtractor={item => String(item.id)}
ListHeaderComponent={
<InfosHeader>
<MovaSearchbarHeading
headerText={t('info')}
searchableAttributes={['title', 'content']}
getData={InfopagesStore.get}
getDefaultData={mainPages}
handleSearch={handleSearch}
isFocused={isFocused}></MovaSearchbarHeading>
</InfosHeader>
<>
<InfosHeader>
<MovaSearchbarHeading
headerText={t('info')}
searchableAttributes={['title', 'content']}
getData={InfopagesStore.get}
getDefaultData={mainPages}
handleSearch={handleSearch}
isFocused={isFocused}></MovaSearchbarHeading>
</InfosHeader>
{ languageManager.currentLanguage === 'en' ?
<EnglishWarning>
<MovaText style={{textAlign: 'center', color: 'white', fontSize: 16}}>
Not all information is available in English. Change the language to see everything.
</MovaText>
</EnglishWarning>
: null
}
</>
}
ListFooterComponent={<LanguageSwitcher />}
refreshControl={<RefreshControl refreshing={isRefreshing} onRefresh={onRefresh} />}
Expand Down

0 comments on commit 2a3d5df

Please sign in to comment.