Redirect to login screen if not logged in
This commit is contained in:
parent
b289a85b8a
commit
c500ae05e6
6 changed files with 142 additions and 130 deletions
|
@ -51,7 +51,7 @@ function ProfileWelcomeCard(props: Props) {
|
||||||
<Divider />
|
<Divider />
|
||||||
<Paragraph>{i18n.t('screens.profile.welcomeDescription')}</Paragraph>
|
<Paragraph>{i18n.t('screens.profile.welcomeDescription')}</Paragraph>
|
||||||
<CardList
|
<CardList
|
||||||
dataset={getAmicaleServices(navigation.navigate, [
|
dataset={getAmicaleServices(navigation.navigate, true, [
|
||||||
SERVICES_KEY.PROFILE,
|
SERVICES_KEY.PROFILE,
|
||||||
])}
|
])}
|
||||||
isHorizontal={true}
|
isHorizontal={true}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import {
|
||||||
getSpecialServices,
|
getSpecialServices,
|
||||||
getStudentServices,
|
getStudentServices,
|
||||||
} from '../utils/Services';
|
} from '../utils/Services';
|
||||||
|
import { useLoginState } from './loginContext';
|
||||||
|
|
||||||
const colorScheme = Appearance.getColorScheme();
|
const colorScheme = Appearance.getColorScheme();
|
||||||
|
|
||||||
|
@ -135,6 +136,7 @@ export function useDarkTheme() {
|
||||||
export function useCurrentDashboard() {
|
export function useCurrentDashboard() {
|
||||||
const { preferences, updatePreferences } = usePreferences();
|
const { preferences, updatePreferences } = usePreferences();
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
const isLoggedIn = useLoginState();
|
||||||
const dashboardIdList = getPreferenceObject(
|
const dashboardIdList = getPreferenceObject(
|
||||||
GeneralPreferenceKeys.dashboardItems,
|
GeneralPreferenceKeys.dashboardItems,
|
||||||
preferences
|
preferences
|
||||||
|
@ -145,7 +147,7 @@ export function useCurrentDashboard() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const allDatasets = [
|
const allDatasets = [
|
||||||
...getAmicaleServices(navigation.navigate),
|
...getAmicaleServices(navigation.navigate, isLoggedIn),
|
||||||
...getStudentServices(navigation.navigate),
|
...getStudentServices(navigation.navigate),
|
||||||
...getINSAServices(navigation.navigate),
|
...getINSAServices(navigation.navigate),
|
||||||
...getSpecialServices(navigation.navigate),
|
...getSpecialServices(navigation.navigate),
|
||||||
|
|
|
@ -52,6 +52,7 @@ import {
|
||||||
GeneralPreferenceKeys,
|
GeneralPreferenceKeys,
|
||||||
} from '../utils/asyncStorage';
|
} from '../utils/asyncStorage';
|
||||||
import IntroScreen from '../screens/Intro/IntroScreen';
|
import IntroScreen from '../screens/Intro/IntroScreen';
|
||||||
|
import { useLoginState } from '../context/loginContext';
|
||||||
|
|
||||||
export enum MainRoutes {
|
export enum MainRoutes {
|
||||||
Main = 'main',
|
Main = 'main',
|
||||||
|
@ -118,6 +119,62 @@ function getIntroScreens() {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAmicaleScreens() {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.Profile}
|
||||||
|
component={ProfileScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.profile.title'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.ClubList}
|
||||||
|
component={ClubListScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.clubs.title'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.ClubInformation}
|
||||||
|
component={ClubDisplayScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.clubs.details'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.ClubAbout}
|
||||||
|
component={ClubAboutScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.clubs.title'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.EquipmentList}
|
||||||
|
component={EquipmentScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.equipment.title'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.EquipmentRent}
|
||||||
|
component={EquipmentLendScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.equipment.book'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<MainStack.Screen
|
||||||
|
name={MainRoutes.EquipmentConfirm}
|
||||||
|
component={EquipmentConfirmScreen}
|
||||||
|
options={{
|
||||||
|
title: i18n.t('screens.equipment.confirm'),
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function getRegularScreens(createTabNavigator: () => React.ReactElement) {
|
function getRegularScreens(createTabNavigator: () => React.ReactElement) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -233,55 +290,6 @@ function getRegularScreens(createTabNavigator: () => React.ReactElement) {
|
||||||
title: i18n.t('screens.proximo.title'),
|
title: i18n.t('screens.proximo.title'),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.Profile}
|
|
||||||
component={ProfileScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.profile.title'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.ClubList}
|
|
||||||
component={ClubListScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.clubs.title'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.ClubInformation}
|
|
||||||
component={ClubDisplayScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.clubs.details'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.ClubAbout}
|
|
||||||
component={ClubAboutScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.clubs.title'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.EquipmentList}
|
|
||||||
component={EquipmentScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.equipment.title'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.EquipmentRent}
|
|
||||||
component={EquipmentLendScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.equipment.book'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
|
||||||
name={MainRoutes.EquipmentConfirm}
|
|
||||||
component={EquipmentConfirmScreen}
|
|
||||||
options={{
|
|
||||||
title: i18n.t('screens.equipment.confirm'),
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={MainRoutes.Vote}
|
name={MainRoutes.Vote}
|
||||||
component={VoteScreen}
|
component={VoteScreen}
|
||||||
|
@ -302,15 +310,17 @@ function getRegularScreens(createTabNavigator: () => React.ReactElement) {
|
||||||
|
|
||||||
function MainStackComponent(props: {
|
function MainStackComponent(props: {
|
||||||
showIntro: boolean;
|
showIntro: boolean;
|
||||||
|
isloggedIn: boolean;
|
||||||
createTabNavigator: () => React.ReactElement;
|
createTabNavigator: () => React.ReactElement;
|
||||||
}) {
|
}) {
|
||||||
const { showIntro, createTabNavigator } = props;
|
const { showIntro, isloggedIn, createTabNavigator } = props;
|
||||||
return (
|
return (
|
||||||
<MainStack.Navigator
|
<MainStack.Navigator
|
||||||
initialRouteName={showIntro ? MainRoutes.Intro : MainRoutes.Main}
|
initialRouteName={showIntro ? MainRoutes.Intro : MainRoutes.Main}
|
||||||
headerMode={'screen'}
|
headerMode={'screen'}
|
||||||
>
|
>
|
||||||
{showIntro ? getIntroScreens() : getRegularScreens(createTabNavigator)}
|
{showIntro ? getIntroScreens() : getRegularScreens(createTabNavigator)}
|
||||||
|
{isloggedIn ? getAmicaleScreens() : null}
|
||||||
</MainStack.Navigator>
|
</MainStack.Navigator>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -322,6 +332,7 @@ type PropsType = {
|
||||||
|
|
||||||
function MainNavigator(props: PropsType) {
|
function MainNavigator(props: PropsType) {
|
||||||
const { preferences } = usePreferences();
|
const { preferences } = usePreferences();
|
||||||
|
const isloggedIn = useLoginState();
|
||||||
const showIntro = getPreferenceBool(
|
const showIntro = getPreferenceBool(
|
||||||
GeneralPreferenceKeys.showIntro,
|
GeneralPreferenceKeys.showIntro,
|
||||||
preferences
|
preferences
|
||||||
|
@ -330,6 +341,7 @@ function MainNavigator(props: PropsType) {
|
||||||
return (
|
return (
|
||||||
<MainStackComponent
|
<MainStackComponent
|
||||||
showIntro={showIntro !== false}
|
showIntro={showIntro !== false}
|
||||||
|
isloggedIn={isloggedIn}
|
||||||
createTabNavigator={createTabNavigator}
|
createTabNavigator={createTabNavigator}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
|
@ -32,6 +32,7 @@ import {
|
||||||
} from '../../../utils/Services';
|
} from '../../../utils/Services';
|
||||||
import { useNavigation } from '@react-navigation/core';
|
import { useNavigation } from '@react-navigation/core';
|
||||||
import { useCurrentDashboard } from '../../../context/preferencesContext';
|
import { useCurrentDashboard } from '../../../context/preferencesContext';
|
||||||
|
import { useLoginState } from '../../../context/loginContext';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
dashboardContainer: {
|
dashboardContainer: {
|
||||||
|
@ -63,6 +64,7 @@ const styles = StyleSheet.create({
|
||||||
*/
|
*/
|
||||||
function DashboardEditScreen() {
|
function DashboardEditScreen() {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
const isLoggedIn = useLoginState();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentDashboard,
|
currentDashboard,
|
||||||
|
@ -150,7 +152,7 @@ function DashboardEditScreen() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CollapsibleFlatList
|
<CollapsibleFlatList
|
||||||
data={getCategories(navigation.navigate)}
|
data={getCategories(navigation.navigate, isLoggedIn)}
|
||||||
renderItem={getRenderItem}
|
renderItem={getRenderItem}
|
||||||
ListHeaderComponent={getListHeader()}
|
ListHeaderComponent={getListHeader()}
|
||||||
style={{}}
|
style={{}}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
* along with Campus INSAT. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import React, { useLayoutEffect } from 'react';
|
||||||
import { Image, StyleSheet, View } from 'react-native';
|
import { Image, StyleSheet, View } from 'react-native';
|
||||||
import {
|
import {
|
||||||
Avatar,
|
Avatar,
|
||||||
|
@ -25,10 +25,9 @@ import {
|
||||||
Divider,
|
Divider,
|
||||||
List,
|
List,
|
||||||
TouchableRipple,
|
TouchableRipple,
|
||||||
withTheme,
|
useTheme,
|
||||||
} from 'react-native-paper';
|
} from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
|
||||||
import CardList from '../../components/Lists/CardList/CardList';
|
import CardList from '../../components/Lists/CardList/CardList';
|
||||||
import MaterialHeaderButtons, {
|
import MaterialHeaderButtons, {
|
||||||
Item,
|
Item,
|
||||||
|
@ -41,11 +40,8 @@ import {
|
||||||
ServiceCategoryType,
|
ServiceCategoryType,
|
||||||
SERVICES_CATEGORIES_KEY,
|
SERVICES_CATEGORIES_KEY,
|
||||||
} from '../../utils/Services';
|
} from '../../utils/Services';
|
||||||
|
import { useNavigation } from '@react-navigation/native';
|
||||||
type PropsType = {
|
import { useLoginState } from '../../context/loginContext';
|
||||||
navigation: StackNavigationProp<any>;
|
|
||||||
theme: ReactNativePaper.Theme;
|
|
||||||
};
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -61,37 +57,29 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
class ServicesScreen extends React.Component<PropsType> {
|
function ServicesScreen() {
|
||||||
finalDataset: Array<ServiceCategoryType>;
|
const navigation = useNavigation();
|
||||||
|
const theme = useTheme();
|
||||||
|
const isLoggedIn = useLoginState();
|
||||||
|
|
||||||
constructor(props: PropsType) {
|
const finalDataset = getCategories(navigation.navigate, isLoggedIn, [
|
||||||
super(props);
|
SERVICES_CATEGORIES_KEY.SPECIAL,
|
||||||
this.finalDataset = getCategories(props.navigation.navigate, [
|
]);
|
||||||
SERVICES_CATEGORIES_KEY.SPECIAL,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
useLayoutEffect(() => {
|
||||||
const { props } = this;
|
const getAboutButton = () => (
|
||||||
props.navigation.setOptions({
|
<MaterialHeaderButtons>
|
||||||
headerRight: this.getAboutButton,
|
<Item
|
||||||
|
title="information"
|
||||||
|
iconName="information"
|
||||||
|
onPress={() => navigation.navigate('amicale-contact')}
|
||||||
|
/>
|
||||||
|
</MaterialHeaderButtons>
|
||||||
|
);
|
||||||
|
navigation.setOptions({
|
||||||
|
headerRight: getAboutButton,
|
||||||
});
|
});
|
||||||
}
|
}, [navigation]);
|
||||||
|
|
||||||
getAboutButton = () => (
|
|
||||||
<MaterialHeaderButtons>
|
|
||||||
<Item
|
|
||||||
title="information"
|
|
||||||
iconName="information"
|
|
||||||
onPress={this.onAboutPress}
|
|
||||||
/>
|
|
||||||
</MaterialHeaderButtons>
|
|
||||||
);
|
|
||||||
|
|
||||||
onAboutPress = () => {
|
|
||||||
const { props } = this;
|
|
||||||
props.navigation.navigate('amicale-contact');
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the list title image for the list.
|
* Gets the list title image for the list.
|
||||||
|
@ -102,8 +90,7 @@ class ServicesScreen extends React.Component<PropsType> {
|
||||||
* @param source The source image to display. Can be a string for icons or a number for local images
|
* @param source The source image to display. Can be a string for icons or a number for local images
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
getListTitleImage(source: string | number) {
|
const getListTitleImage = (source: string | number) => {
|
||||||
const { props } = this;
|
|
||||||
if (typeof source === 'number') {
|
if (typeof source === 'number') {
|
||||||
return <Image source={source} style={styles.image} />;
|
return <Image source={source} style={styles.image} />;
|
||||||
}
|
}
|
||||||
|
@ -111,11 +98,11 @@ class ServicesScreen extends React.Component<PropsType> {
|
||||||
<Avatar.Icon
|
<Avatar.Icon
|
||||||
size={48}
|
size={48}
|
||||||
icon={source}
|
icon={source}
|
||||||
color={props.theme.colors.primary}
|
color={theme.colors.primary}
|
||||||
style={styles.icon}
|
style={styles.icon}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A list item showing a list of available services for the current category
|
* A list item showing a list of available services for the current category
|
||||||
|
@ -123,20 +110,17 @@ class ServicesScreen extends React.Component<PropsType> {
|
||||||
* @param item
|
* @param item
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
getRenderItem = ({ item }: { item: ServiceCategoryType }) => {
|
const getRenderItem = ({ item }: { item: ServiceCategoryType }) => {
|
||||||
const { props } = this;
|
|
||||||
return (
|
return (
|
||||||
<TouchableRipple
|
<TouchableRipple
|
||||||
style={styles.container}
|
style={styles.container}
|
||||||
onPress={() => {
|
onPress={() => navigation.navigate('services-section', { data: item })}
|
||||||
props.navigation.navigate('services-section', { data: item });
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<View>
|
<View>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
title={item.title}
|
title={item.title}
|
||||||
subtitle={item.subtitle}
|
subtitle={item.subtitle}
|
||||||
left={() => this.getListTitleImage(item.image)}
|
left={() => getListTitleImage(item.image)}
|
||||||
right={() => <List.Icon icon="chevron-right" />}
|
right={() => <List.Icon icon="chevron-right" />}
|
||||||
/>
|
/>
|
||||||
<CardList dataset={item.content} isHorizontal />
|
<CardList dataset={item.content} isHorizontal />
|
||||||
|
@ -145,33 +129,31 @@ class ServicesScreen extends React.Component<PropsType> {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
keyExtractor = (item: ServiceCategoryType): string => item.title;
|
const keyExtractor = (item: ServiceCategoryType): string => item.title;
|
||||||
|
|
||||||
render() {
|
return (
|
||||||
return (
|
<View>
|
||||||
<View>
|
<CollapsibleFlatList
|
||||||
<CollapsibleFlatList
|
data={finalDataset}
|
||||||
data={this.finalDataset}
|
renderItem={getRenderItem}
|
||||||
renderItem={this.getRenderItem}
|
keyExtractor={keyExtractor}
|
||||||
keyExtractor={this.keyExtractor}
|
ItemSeparatorComponent={() => <Divider />}
|
||||||
ItemSeparatorComponent={() => <Divider />}
|
hasTab
|
||||||
hasTab
|
/>
|
||||||
/>
|
<MascotPopup
|
||||||
<MascotPopup
|
title={i18n.t('screens.services.mascotDialog.title')}
|
||||||
title={i18n.t('screens.services.mascotDialog.title')}
|
message={i18n.t('screens.services.mascotDialog.message')}
|
||||||
message={i18n.t('screens.services.mascotDialog.message')}
|
icon="cloud-question"
|
||||||
icon="cloud-question"
|
buttons={{
|
||||||
buttons={{
|
cancel: {
|
||||||
cancel: {
|
message: i18n.t('screens.services.mascotDialog.button'),
|
||||||
message: i18n.t('screens.services.mascotDialog.button'),
|
icon: 'check',
|
||||||
icon: 'check',
|
},
|
||||||
},
|
}}
|
||||||
}}
|
emotion={MASCOT_STYLE.WINK}
|
||||||
emotion={MASCOT_STYLE.WINK}
|
/>
|
||||||
/>
|
</View>
|
||||||
</View>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withTheme(ServicesScreen);
|
export default ServicesScreen;
|
||||||
|
|
|
@ -86,8 +86,21 @@ export type ServiceCategoryType = {
|
||||||
content: Array<ServiceItemType>;
|
content: Array<ServiceItemType>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getAmicaleOnPress(
|
||||||
|
route: string,
|
||||||
|
onPress: (route: string, params?: { [key: string]: any }) => void,
|
||||||
|
isLoggedIn: boolean
|
||||||
|
) {
|
||||||
|
if (isLoggedIn) {
|
||||||
|
return () => onPress(route);
|
||||||
|
} else {
|
||||||
|
return () => onPress(MainRoutes.Login, { nextScreen: route });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export function getAmicaleServices(
|
export function getAmicaleServices(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (route: string, params?: { [key: string]: any }) => void,
|
||||||
|
isLoggedIn: boolean,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceItemType> {
|
): Array<ServiceItemType> {
|
||||||
const amicaleDataset = [
|
const amicaleDataset = [
|
||||||
|
@ -96,21 +109,21 @@ export function getAmicaleServices(
|
||||||
title: i18n.t('screens.clubs.title'),
|
title: i18n.t('screens.clubs.title'),
|
||||||
subtitle: i18n.t('screens.services.descriptions.clubs'),
|
subtitle: i18n.t('screens.services.descriptions.clubs'),
|
||||||
image: Urls.images.clubs,
|
image: Urls.images.clubs,
|
||||||
onPress: () => onPress(MainRoutes.ClubList),
|
onPress: getAmicaleOnPress(MainRoutes.ClubList, onPress, isLoggedIn),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SERVICES_KEY.PROFILE,
|
key: SERVICES_KEY.PROFILE,
|
||||||
title: i18n.t('screens.profile.title'),
|
title: i18n.t('screens.profile.title'),
|
||||||
subtitle: i18n.t('screens.services.descriptions.profile'),
|
subtitle: i18n.t('screens.services.descriptions.profile'),
|
||||||
image: Urls.images.profile,
|
image: Urls.images.profile,
|
||||||
onPress: () => onPress(MainRoutes.Profile),
|
onPress: getAmicaleOnPress(MainRoutes.Profile, onPress, isLoggedIn),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SERVICES_KEY.EQUIPMENT,
|
key: SERVICES_KEY.EQUIPMENT,
|
||||||
title: i18n.t('screens.equipment.title'),
|
title: i18n.t('screens.equipment.title'),
|
||||||
subtitle: i18n.t('screens.services.descriptions.equipment'),
|
subtitle: i18n.t('screens.services.descriptions.equipment'),
|
||||||
image: Urls.images.equipment,
|
image: Urls.images.equipment,
|
||||||
onPress: () => onPress(MainRoutes.EquipmentList),
|
onPress: getAmicaleOnPress(MainRoutes.EquipmentList, onPress, isLoggedIn),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SERVICES_KEY.AMICALE_WEBSITE,
|
key: SERVICES_KEY.AMICALE_WEBSITE,
|
||||||
|
@ -289,6 +302,7 @@ export function getSpecialServices(
|
||||||
|
|
||||||
export function getCategories(
|
export function getCategories(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (route: string, params?: { [key: string]: any }) => void,
|
||||||
|
isLoggedIn: boolean,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceCategoryType> {
|
): Array<ServiceCategoryType> {
|
||||||
const categoriesDataset = [
|
const categoriesDataset = [
|
||||||
|
@ -297,7 +311,7 @@ export function getCategories(
|
||||||
title: i18n.t('screens.services.categories.amicale'),
|
title: i18n.t('screens.services.categories.amicale'),
|
||||||
subtitle: i18n.t('screens.services.more'),
|
subtitle: i18n.t('screens.services.more'),
|
||||||
image: AMICALE_LOGO,
|
image: AMICALE_LOGO,
|
||||||
content: getAmicaleServices(onPress),
|
content: getAmicaleServices(onPress, isLoggedIn),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: SERVICES_CATEGORIES_KEY.STUDENTS,
|
key: SERVICES_CATEGORIES_KEY.STUDENTS,
|
||||||
|
|
Loading…
Reference in a new issue