Files
inji-wallet/screens/Home/HomeScreen.tsx
srikanth716 832d922282 Inji 569 using svg instead png (#1093)
* refactor(INJI-569): changing png to svg images from setup to home screen

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* Refactor(INJI-569): changing png to svg images settings screen

Signed-off-by: anil_majji <majjianilkumar050@gmail.com>

* [INJI-569] changing png to svg image

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-569]: Adjusted all the alignment in settings screen

Signed-off-by: anil_majji <majjianilkumar050@gmail.com>

* [INJI-569] fix SuccessLogo size and and alignment

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-569] refactor theme files and removing unused QrLoginWarning component

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-569] changing the naming convention of svg images

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-569] fix Typo mistake and remove unused imports

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-569] fix Typo mistake, misssing imports and remove unused elements

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

* [INJI-569]: Adjusted all the alignment of icons with tag name in settings screen

Signed-off-by: anil_majji <majjianilkumar050@gmail.com>

* [INJI-569] renaming the files

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>

---------

Signed-off-by: Sri Kanth Kola <srikanthsri7447@gmail.com>
Signed-off-by: anil_majji <majjianilkumar050@gmail.com>
Co-authored-by: anil_majji <majjianilkumar050@gmail.com>
2023-12-20 10:17:46 +05:30

111 lines
3.4 KiB
TypeScript

import React, {useEffect} from 'react';
import {Icon, Tab} from 'react-native-elements';
import {Column, Text} from '../../components/ui';
import {Theme} from '../../components/ui/styleUtils';
import {HomeRouteProps} from '../../routes/main';
import {MyVcsTab} from './MyVcsTab';
import {ReceivedVcsTab} from './ReceivedVcsTab';
import {ViewVcModal} from './ViewVcModal';
import {useHomeScreen} from './HomeScreenController';
import {TabRef} from './HomeScreenMachine';
import {useTranslation} from 'react-i18next';
import {ActorRefFrom} from 'xstate';
import {ExistingMosipVCItemMachine} from '../../machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine';
import LinearGradient from 'react-native-linear-gradient';
import {EsignetMosipVCItemMachine} from '../../machines/VCItemMachine/EsignetMosipVCItem/EsignetMosipVCItemMachine';
import {ErrorMessageOverlay} from '../../components/MessageOverlay';
import {Pressable} from 'react-native';
export const HomeScreen: React.FC<HomeRouteProps> = props => {
const {t} = useTranslation('HomeScreen');
const controller = useHomeScreen(props);
useEffect(() => {
if (controller.IssuersService) {
navigateToIssuers();
}
}, [controller.IssuersService]);
const navigateToIssuers = () => {
props.navigation.navigate('IssuersScreen', {
service: controller.IssuersService,
});
};
const DownloadFABIcon: React.FC = () => {
const plusIcon = (
<Icon
name={'plus'}
type={'entypo'}
size={36}
color={Theme.Colors.whiteText}
/>
);
return (
<LinearGradient
colors={Theme.Colors.gradientBtn}
style={Theme.Styles.downloadFabIconContainer}>
<Pressable
onPress={() => {
controller.GOTO_ISSUERS();
}}
testID="downloadIcon"
style={({pressed}) =>
pressed
? Theme.Styles.downloadFabIconPressed
: Theme.Styles.downloadFabIconNormal
}>
{plusIcon}
</Pressable>
</LinearGradient>
);
};
return (
<React.Fragment>
<Column fill backgroundColor={Theme.Colors.lightGreyBackgroundColor}>
{controller.haveTabsLoaded && (
<Column fill>
<MyVcsTab
isVisible={controller.activeTab === 0}
service={controller.tabRefs.myVcs}
vcItemActor={controller.selectedVc}
/>
<ReceivedVcsTab
isVisible={controller.activeTab === 1}
service={controller.tabRefs.receivedVcs}
vcItemActor={controller.selectedVc}
/>
</Column>
)}
</Column>
<DownloadFABIcon />
<ErrorMessageOverlay
translationPath={'MyVcsTab'}
isVisible={controller.isMinimumStorageLimitReached}
error={'errors.storageLimitReached'}
onDismiss={controller.DISMISS}
/>
{controller.selectedVc && (
<ViewVcModal
isVisible={controller.isViewingVc}
onDismiss={controller.DISMISS_MODAL}
vcItemActor={controller.selectedVc}
onRevokeDelete={() => {
controller.REVOKE();
}}
activeTab={controller.activeTab}
/>
)}
</React.Fragment>
);
};
export interface HomeScreenTabProps {
isVisible: boolean;
service: TabRef;
vcItemActor:
| ActorRefFrom<typeof ExistingMosipVCItemMachine>
| ActorRefFrom<typeof EsignetMosipVCItemMachine>;
}