forked from vergnet/application-amicale
feat: fix typescript and eslint errors
This commit is contained in:
parent
d3e94ac9b3
commit
764296708c
39 changed files with 302 additions and 214 deletions
22
App.tsx
22
App.tsx
|
@ -50,6 +50,7 @@ import MainApp from './src/screens/MainApp';
|
||||||
import LoginProvider from './src/components/providers/LoginProvider';
|
import LoginProvider from './src/components/providers/LoginProvider';
|
||||||
import { retrieveLoginToken } from './src/utils/loginToken';
|
import { retrieveLoginToken } from './src/utils/loginToken';
|
||||||
import { setupNotifications } from './src/utils/Notifications';
|
import { setupNotifications } from './src/utils/Notifications';
|
||||||
|
import { TabRoutes } from './src/navigation/TabNavigator';
|
||||||
|
|
||||||
// Native optimizations https://reactnavigation.org/docs/react-native-screens
|
// Native optimizations https://reactnavigation.org/docs/react-native-screens
|
||||||
// Crashes app when navigating away from webview on android 9+
|
// Crashes app when navigating away from webview on android 9+
|
||||||
|
@ -76,11 +77,9 @@ type StateType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class App extends React.Component<{}, StateType> {
|
export default class App extends React.Component<{}, StateType> {
|
||||||
navigatorRef: { current: null | NavigationContainerRef };
|
navigatorRef: { current: null | NavigationContainerRef<any> };
|
||||||
|
|
||||||
defaultHomeRoute: string | undefined;
|
defaultData?: ParsedUrlDataType;
|
||||||
|
|
||||||
defaultHomeData: { [key: string]: string } | undefined;
|
|
||||||
|
|
||||||
urlHandler: URLHandler;
|
urlHandler: URLHandler;
|
||||||
|
|
||||||
|
@ -97,8 +96,7 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
loginToken: undefined,
|
loginToken: undefined,
|
||||||
};
|
};
|
||||||
this.navigatorRef = React.createRef();
|
this.navigatorRef = React.createRef();
|
||||||
this.defaultHomeRoute = undefined;
|
this.defaultData = undefined;
|
||||||
this.defaultHomeData = undefined;
|
|
||||||
this.urlHandler = new URLHandler(this.onInitialURLParsed, this.onDetectURL);
|
this.urlHandler = new URLHandler(this.onInitialURLParsed, this.onDetectURL);
|
||||||
this.urlHandler.listen();
|
this.urlHandler.listen();
|
||||||
setSafeBounceHeight(Platform.OS === 'ios' ? 100 : 20);
|
setSafeBounceHeight(Platform.OS === 'ios' ? 100 : 20);
|
||||||
|
@ -112,8 +110,7 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
* @param parsedData The data parsed from the url
|
* @param parsedData The data parsed from the url
|
||||||
*/
|
*/
|
||||||
onInitialURLParsed = (parsedData: ParsedUrlDataType) => {
|
onInitialURLParsed = (parsedData: ParsedUrlDataType) => {
|
||||||
this.defaultHomeRoute = parsedData.route;
|
this.defaultData = parsedData;
|
||||||
this.defaultHomeData = parsedData.data;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,9 +123,9 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
// Navigate to nested navigator and pass data to the index screen
|
// Navigate to nested navigator and pass data to the index screen
|
||||||
const nav = this.navigatorRef.current;
|
const nav = this.navigatorRef.current;
|
||||||
if (nav != null) {
|
if (nav != null) {
|
||||||
nav.navigate('home', {
|
nav.navigate(TabRoutes.Home, {
|
||||||
screen: 'index',
|
nextScreen: parsedData.route,
|
||||||
params: { nextScreen: parsedData.route, data: parsedData.data },
|
data: parsedData.data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -213,8 +210,7 @@ export default class App extends React.Component<{}, StateType> {
|
||||||
<LoginProvider initialToken={this.state.loginToken}>
|
<LoginProvider initialToken={this.state.loginToken}>
|
||||||
<MainApp
|
<MainApp
|
||||||
ref={this.navigatorRef}
|
ref={this.navigatorRef}
|
||||||
defaultHomeData={this.defaultHomeData}
|
defaultData={this.defaultData}
|
||||||
defaultHomeRoute={this.defaultHomeRoute}
|
|
||||||
/>
|
/>
|
||||||
</LoginProvider>
|
</LoginProvider>
|
||||||
</MascotPreferencesProvider>
|
</MascotPreferencesProvider>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import i18n from 'i18n-js';
|
||||||
import { FlatList, StyleSheet } from 'react-native';
|
import { FlatList, StyleSheet } from 'react-native';
|
||||||
import { ProfileClubType } from '../../../screens/Amicale/ProfileScreen';
|
import { ProfileClubType } from '../../../screens/Amicale/ProfileScreen';
|
||||||
import { useNavigation } from '@react-navigation/core';
|
import { useNavigation } from '@react-navigation/core';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
clubs?: Array<ProfileClubType>;
|
clubs?: Array<ProfileClubType>;
|
||||||
|
@ -26,7 +27,10 @@ export default function ProfileClubCard(props: Props) {
|
||||||
|
|
||||||
const getClubListItem = ({ item }: { item: ProfileClubType }) => {
|
const getClubListItem = ({ item }: { item: ProfileClubType }) => {
|
||||||
const onPress = () =>
|
const onPress = () =>
|
||||||
navigation.navigate('club-information', { clubId: item.id });
|
navigation.navigate(MainRoutes.ClubInformation, {
|
||||||
|
type: 'id',
|
||||||
|
clubId: item.id,
|
||||||
|
});
|
||||||
let description = i18n.t('screens.profile.isMember');
|
let description = i18n.t('screens.profile.isMember');
|
||||||
let icon = (leftProps: {
|
let icon = (leftProps: {
|
||||||
color: string;
|
color: string;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import {
|
||||||
import Urls from '../../../constants/Urls';
|
import Urls from '../../../constants/Urls';
|
||||||
import { ProfileDataType } from '../../../screens/Amicale/ProfileScreen';
|
import { ProfileDataType } from '../../../screens/Amicale/ProfileScreen';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
profile?: ProfileDataType;
|
profile?: ProfileDataType;
|
||||||
|
@ -93,7 +94,7 @@ export default function ProfilePersonalCard(props: Props) {
|
||||||
icon="account-edit"
|
icon="account-edit"
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate('website', {
|
navigation.navigate(MainRoutes.Website, {
|
||||||
host: Urls.websites.amicale,
|
host: Urls.websites.amicale,
|
||||||
path: profile?.link,
|
path: profile?.link,
|
||||||
title: i18n.t('screens.websites.amicale'),
|
title: i18n.t('screens.websites.amicale'),
|
||||||
|
|
|
@ -6,6 +6,7 @@ import i18n from 'i18n-js';
|
||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
import CardList from '../../Lists/CardList/CardList';
|
import CardList from '../../Lists/CardList/CardList';
|
||||||
import { getAmicaleServices, SERVICES_KEY } from '../../../utils/Services';
|
import { getAmicaleServices, SERVICES_KEY } from '../../../utils/Services';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
firstname?: string;
|
firstname?: string;
|
||||||
|
@ -51,9 +52,11 @@ 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, true, [
|
dataset={getAmicaleServices(
|
||||||
SERVICES_KEY.PROFILE,
|
(route) => navigation.navigate(route),
|
||||||
])}
|
true,
|
||||||
|
[SERVICES_KEY.PROFILE]
|
||||||
|
)}
|
||||||
isHorizontal={true}
|
isHorizontal={true}
|
||||||
/>
|
/>
|
||||||
<Paragraph>{i18n.t('screens.profile.welcomeFeedback')}</Paragraph>
|
<Paragraph>{i18n.t('screens.profile.welcomeFeedback')}</Paragraph>
|
||||||
|
@ -63,7 +66,7 @@ function ProfileWelcomeCard(props: Props) {
|
||||||
icon="bug"
|
icon="bug"
|
||||||
mode="contained"
|
mode="contained"
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
navigation.navigate('feedback');
|
navigation.navigate(MainRoutes.Feedback);
|
||||||
}}
|
}}
|
||||||
style={styles.editButton}
|
style={styles.editButton}
|
||||||
>
|
>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import * as Animatable from 'react-native-animatable';
|
||||||
import { TAB_BAR_HEIGHT } from '../Tabbar/CustomTabBar';
|
import { TAB_BAR_HEIGHT } from '../Tabbar/CustomTabBar';
|
||||||
import { useNavigation } from '@react-navigation/core';
|
import { useNavigation } from '@react-navigation/core';
|
||||||
import { useCollapsible } from '../../context/CollapsibleContext';
|
import { useCollapsible } from '../../context/CollapsibleContext';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
onPress: (action: string, data?: string) => void;
|
onPress: (action: string, data?: string) => void;
|
||||||
|
@ -138,7 +139,7 @@ function PlanexBottomBar(props: Props) {
|
||||||
>
|
>
|
||||||
<FAB
|
<FAB
|
||||||
icon={'account-clock'}
|
icon={'account-clock'}
|
||||||
onPress={() => navigation.navigate('group-select')}
|
onPress={() => navigation.navigate(MainRoutes.GroupSelect)}
|
||||||
/>
|
/>
|
||||||
</Animatable.View>
|
</Animatable.View>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { List } from 'react-native-paper';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
item: {
|
item: {
|
||||||
|
@ -53,7 +54,7 @@ function ActionsDashBoardItem() {
|
||||||
icon="chevron-right"
|
icon="chevron-right"
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
onPress={(): void => navigation.navigate('feedback')}
|
onPress={(): void => navigation.navigate(MainRoutes.Feedback)}
|
||||||
style={styles.item}
|
style={styles.item}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -30,6 +30,7 @@ import type { NewsSourceType } from '../../constants/NewsSourcesConstants';
|
||||||
import ImageGalleryButton from '../Media/ImageGalleryButton';
|
import ImageGalleryButton from '../Media/ImageGalleryButton';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import GENERAL_STYLES from '../../constants/Styles';
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
item: FeedItemType;
|
item: FeedItemType;
|
||||||
|
@ -67,7 +68,7 @@ const styles = StyleSheet.create({
|
||||||
function FeedItem(props: PropsType) {
|
function FeedItem(props: PropsType) {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
const onPress = () => {
|
const onPress = () => {
|
||||||
navigation.navigate('feed-information', {
|
navigation.navigate(MainRoutes.FeedInformation, {
|
||||||
data: item,
|
data: item,
|
||||||
date: getFormattedDate(props.item.time),
|
date: getFormattedDate(props.item.time),
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,6 +29,7 @@ import {
|
||||||
import { StyleSheet } from 'react-native';
|
import { StyleSheet } from 'react-native';
|
||||||
import GENERAL_STYLES from '../../../constants/Styles';
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
userDeviceRentDates: [string, string] | null;
|
userDeviceRentDates: [string, string] | null;
|
||||||
|
@ -56,14 +57,14 @@ function EquipmentListItem(props: PropsType) {
|
||||||
let onPress;
|
let onPress;
|
||||||
if (isRented) {
|
if (isRented) {
|
||||||
onPress = () => {
|
onPress = () => {
|
||||||
navigation.navigate('equipment-confirm', {
|
navigation.navigate(MainRoutes.EquipmentConfirm, {
|
||||||
item,
|
item,
|
||||||
dates: userDeviceRentDates,
|
dates: userDeviceRentDates,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
onPress = () => {
|
onPress = () => {
|
||||||
navigation.navigate('equipment-rent', { item });
|
navigation.navigate(MainRoutes.EquipmentRent, { item });
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import { TouchableRipple } from 'react-native-paper';
|
||||||
import { Image } from 'react-native-animatable';
|
import { Image } from 'react-native-animatable';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { StyleSheet, ViewStyle } from 'react-native';
|
import { StyleSheet, ViewStyle } from 'react-native';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
images: Array<{ url: string }>;
|
images: Array<{ url: string }>;
|
||||||
|
@ -39,7 +40,7 @@ function ImageGalleryButton(props: PropsType) {
|
||||||
const navigation = useNavigation();
|
const navigation = useNavigation();
|
||||||
|
|
||||||
const onPress = () => {
|
const onPress = () => {
|
||||||
navigation.navigate('gallery', { images: props.images });
|
navigation.navigate(MainRoutes.Gallery, { images: props.images });
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -30,7 +30,8 @@ const PROXIMO_ENDPOINT = STUDENT_SERVER + '~proximo/v2/api/';
|
||||||
const PROXIMO_IMAGES_ENDPOINT =
|
const PROXIMO_IMAGES_ENDPOINT =
|
||||||
STUDENT_SERVER + '~proximo/api_proximo/storage/app/public/';
|
STUDENT_SERVER + '~proximo/api_proximo/storage/app/public/';
|
||||||
const APP_IMAGES_ENDPOINT = STUDENT_SERVER + '~amicale_app/images/';
|
const APP_IMAGES_ENDPOINT = STUDENT_SERVER + '~amicale_app/images/';
|
||||||
const PROXIWASH_ENDPOINT = 'https://www.proxiwash.com/weblaverie/ma-laverie-2?s=';
|
const PROXIWASH_ENDPOINT =
|
||||||
|
'https://www.proxiwash.com/weblaverie/ma-laverie-2?s=';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
amicale: {
|
amicale: {
|
||||||
|
|
|
@ -147,10 +147,10 @@ export function useCurrentDashboard() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const allDatasets = [
|
const allDatasets = [
|
||||||
...getAmicaleServices(navigation.navigate, isLoggedIn),
|
...getAmicaleServices((route) => navigation.navigate(route), isLoggedIn),
|
||||||
...getStudentServices(navigation.navigate),
|
...getStudentServices((route) => navigation.navigate(route)),
|
||||||
...getINSAServices(navigation.navigate),
|
...getINSAServices((route) => navigation.navigate(route)),
|
||||||
...getSpecialServices(navigation.navigate),
|
...getSpecialServices((route) => navigation.navigate(route)),
|
||||||
];
|
];
|
||||||
return {
|
return {
|
||||||
currentDashboard: allDatasets.filter((item) =>
|
currentDashboard: allDatasets.filter((item) =>
|
||||||
|
|
|
@ -24,7 +24,7 @@ import SettingsScreen from '../screens/Other/Settings/SettingsScreen';
|
||||||
import AboutScreen from '../screens/About/AboutScreen';
|
import AboutScreen from '../screens/About/AboutScreen';
|
||||||
import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
|
import AboutDependenciesScreen from '../screens/About/AboutDependenciesScreen';
|
||||||
import DebugScreen from '../screens/About/DebugScreen';
|
import DebugScreen from '../screens/About/DebugScreen';
|
||||||
import TabNavigator from './TabNavigator';
|
import TabNavigator, { TabRoutes } from './TabNavigator';
|
||||||
import GameMainScreen from '../screens/Game/screens/GameMainScreen';
|
import GameMainScreen from '../screens/Game/screens/GameMainScreen';
|
||||||
import VoteScreen from '../screens/Amicale/VoteScreen';
|
import VoteScreen from '../screens/Amicale/VoteScreen';
|
||||||
import LoginScreen from '../screens/Amicale/LoginScreen';
|
import LoginScreen from '../screens/Amicale/LoginScreen';
|
||||||
|
@ -33,7 +33,10 @@ import ProximoMainScreen from '../screens/Services/Proximo/ProximoMainScreen';
|
||||||
import ProximoListScreen from '../screens/Services/Proximo/ProximoListScreen';
|
import ProximoListScreen from '../screens/Services/Proximo/ProximoListScreen';
|
||||||
import ProximoAboutScreen from '../screens/Services/Proximo/ProximoAboutScreen';
|
import ProximoAboutScreen from '../screens/Services/Proximo/ProximoAboutScreen';
|
||||||
import ProfileScreen from '../screens/Amicale/ProfileScreen';
|
import ProfileScreen from '../screens/Amicale/ProfileScreen';
|
||||||
import ClubListScreen from '../screens/Amicale/Clubs/ClubListScreen';
|
import ClubListScreen, {
|
||||||
|
ClubCategoryType,
|
||||||
|
ClubType,
|
||||||
|
} from '../screens/Amicale/Clubs/ClubListScreen';
|
||||||
import ClubAboutScreen from '../screens/Amicale/Clubs/ClubAboutScreen';
|
import ClubAboutScreen from '../screens/Amicale/Clubs/ClubAboutScreen';
|
||||||
import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
|
import ClubDisplayScreen from '../screens/Amicale/Clubs/ClubDisplayScreen';
|
||||||
import BugReportScreen from '../screens/Other/FeedbackScreen';
|
import BugReportScreen from '../screens/Other/FeedbackScreen';
|
||||||
|
@ -60,6 +63,10 @@ import FeedItemScreen from '../screens/Home/FeedItemScreen';
|
||||||
import GroupSelectionScreen from '../screens/Planex/GroupSelectionScreen';
|
import GroupSelectionScreen from '../screens/Planex/GroupSelectionScreen';
|
||||||
import ServicesSectionScreen from '../screens/Services/ServicesSectionScreen';
|
import ServicesSectionScreen from '../screens/Services/ServicesSectionScreen';
|
||||||
import AmicaleContactScreen from '../screens/Amicale/AmicaleContactScreen';
|
import AmicaleContactScreen from '../screens/Amicale/AmicaleContactScreen';
|
||||||
|
import { FeedItemType } from '../screens/Home/HomeScreen';
|
||||||
|
import { PlanningEventType } from '../utils/Planning';
|
||||||
|
import { ServiceCategoryType } from '../utils/Services';
|
||||||
|
import { ParsedUrlDataType } from '../utils/URLHandler';
|
||||||
|
|
||||||
export enum MainRoutes {
|
export enum MainRoutes {
|
||||||
Main = 'main',
|
Main = 'main',
|
||||||
|
@ -77,6 +84,7 @@ export enum MainRoutes {
|
||||||
Proximo = 'proximo',
|
Proximo = 'proximo',
|
||||||
ProximoList = 'proximo-list',
|
ProximoList = 'proximo-list',
|
||||||
ProximoAbout = 'proximo-about',
|
ProximoAbout = 'proximo-about',
|
||||||
|
ProxiwashAbout = 'proxiwash-about',
|
||||||
Profile = 'profile',
|
Profile = 'profile',
|
||||||
ClubList = 'club-list',
|
ClubList = 'club-list',
|
||||||
ClubInformation = 'club-information',
|
ClubInformation = 'club-information',
|
||||||
|
@ -87,28 +95,72 @@ export enum MainRoutes {
|
||||||
Vote = 'vote',
|
Vote = 'vote',
|
||||||
Feedback = 'feedback',
|
Feedback = 'feedback',
|
||||||
Website = 'website',
|
Website = 'website',
|
||||||
|
PlanningInformation = 'planning-information',
|
||||||
|
Scanner = 'scanner',
|
||||||
|
FeedInformation = 'feed-information',
|
||||||
|
GroupSelect = 'group-select',
|
||||||
|
ServicesSection = 'services-section',
|
||||||
|
AmicaleContact = 'amicale-contact',
|
||||||
}
|
}
|
||||||
|
|
||||||
type DefaultParams = { [key in MainRoutes]: object | undefined };
|
type DefaultParams = { [key in MainRoutes]: object | undefined } & {
|
||||||
|
[key in TabRoutes]: object | undefined;
|
||||||
|
};
|
||||||
|
|
||||||
export type FullParamsList = DefaultParams & {
|
export type MainStackParamsList = DefaultParams & {
|
||||||
'login': { nextScreen: string };
|
[MainRoutes.Login]: { nextScreen: string };
|
||||||
'equipment-confirm': {
|
[MainRoutes.EquipmentConfirm]: {
|
||||||
item?: DeviceType;
|
item?: DeviceType;
|
||||||
dates: [string, string];
|
dates: [string, string];
|
||||||
};
|
};
|
||||||
'equipment-rent': { item?: DeviceType };
|
[MainRoutes.EquipmentRent]: { item?: DeviceType };
|
||||||
'gallery': { images: Array<{ url: string }> };
|
[MainRoutes.Gallery]: { images: Array<{ url: string }> };
|
||||||
[MainRoutes.ProximoList]: {
|
[MainRoutes.ProximoList]: {
|
||||||
shouldFocusSearchBar: boolean;
|
shouldFocusSearchBar: boolean;
|
||||||
category: number;
|
category: number;
|
||||||
};
|
};
|
||||||
|
[MainRoutes.ClubInformation]: ClubInformationScreenParams;
|
||||||
|
[MainRoutes.Website]: {
|
||||||
|
host: string;
|
||||||
|
path?: string;
|
||||||
|
title: string;
|
||||||
|
};
|
||||||
|
[MainRoutes.FeedInformation]: {
|
||||||
|
data: FeedItemType;
|
||||||
|
date: string;
|
||||||
|
};
|
||||||
|
[MainRoutes.PlanningInformation]: PlanningInformationScreenParams;
|
||||||
|
[MainRoutes.ServicesSection]: {
|
||||||
|
data: ServiceCategoryType;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't know why but TS is complaining without this
|
export type ClubInformationScreenParams =
|
||||||
// See: https://stackoverflow.com/questions/63652687/interface-does-not-satisfy-the-constraint-recordstring-object-undefined
|
| {
|
||||||
export type MainStackParamsList = FullParamsList &
|
type: 'full';
|
||||||
Record<string, object | undefined>;
|
data: ClubType;
|
||||||
|
categories: Array<ClubCategoryType>;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: 'id';
|
||||||
|
clubId: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type PlanningInformationScreenParams =
|
||||||
|
| {
|
||||||
|
type: 'full';
|
||||||
|
data: PlanningEventType;
|
||||||
|
}
|
||||||
|
| {
|
||||||
|
type: 'id';
|
||||||
|
eventId: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
namespace ReactNavigation {
|
||||||
|
interface RootParamList extends MainStackParamsList {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const MainStack = createStackNavigator<MainStackParamsList>();
|
const MainStack = createStackNavigator<MainStackParamsList>();
|
||||||
|
|
||||||
|
@ -312,41 +364,41 @@ function getRegularScreens(createTabNavigator: () => React.ReactElement) {
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'proxiwash-about'}
|
name={MainRoutes.ProxiwashAbout}
|
||||||
component={ProxiwashAboutScreen}
|
component={ProxiwashAboutScreen}
|
||||||
options={{ title: i18n.t('screens.proxiwash.title') }}
|
options={{ title: i18n.t('screens.proxiwash.title') }}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'planning-information'}
|
name={MainRoutes.PlanningInformation}
|
||||||
component={PlanningDisplayScreen}
|
component={PlanningDisplayScreen}
|
||||||
options={{ title: i18n.t('screens.planning.eventDetails') }}
|
options={{ title: i18n.t('screens.planning.eventDetails') }}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'scanner'}
|
name={MainRoutes.Scanner}
|
||||||
component={ScannerScreen}
|
component={ScannerScreen}
|
||||||
options={{ title: i18n.t('screens.scanner.title') }}
|
options={{ title: i18n.t('screens.scanner.title') }}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'feed-information'}
|
name={MainRoutes.FeedInformation}
|
||||||
component={FeedItemScreen}
|
component={FeedItemScreen}
|
||||||
options={{
|
options={{
|
||||||
title: i18n.t('screens.home.feed'),
|
title: i18n.t('screens.home.feed'),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'group-select'}
|
name={MainRoutes.GroupSelect}
|
||||||
component={GroupSelectionScreen}
|
component={GroupSelectionScreen}
|
||||||
options={{
|
options={{
|
||||||
title: '',
|
title: '',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'services-section'}
|
name={MainRoutes.ServicesSection}
|
||||||
component={ServicesSectionScreen}
|
component={ServicesSectionScreen}
|
||||||
options={{ title: 'SECTION' }}
|
options={{ title: 'SECTION' }}
|
||||||
/>
|
/>
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name={'amicale-contact'}
|
name={MainRoutes.AmicaleContact}
|
||||||
component={AmicaleContactScreen}
|
component={AmicaleContactScreen}
|
||||||
options={{ title: i18n.t('screens.amicaleAbout.title') }}
|
options={{ title: i18n.t('screens.amicaleAbout.title') }}
|
||||||
/>
|
/>
|
||||||
|
@ -363,7 +415,9 @@ function MainStackComponent(props: {
|
||||||
return (
|
return (
|
||||||
<MainStack.Navigator
|
<MainStack.Navigator
|
||||||
initialRouteName={showIntro ? MainRoutes.Intro : MainRoutes.Main}
|
initialRouteName={showIntro ? MainRoutes.Intro : MainRoutes.Main}
|
||||||
headerMode={'float'}
|
screenOptions={{
|
||||||
|
headerMode: 'float',
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{showIntro ? getIntroScreens() : getRegularScreens(createTabNavigator)}
|
{showIntro ? getIntroScreens() : getRegularScreens(createTabNavigator)}
|
||||||
{isloggedIn ? getAmicaleScreens() : null}
|
{isloggedIn ? getAmicaleScreens() : null}
|
||||||
|
@ -372,8 +426,7 @@ function MainStackComponent(props: {
|
||||||
}
|
}
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
defaultHomeRoute?: string;
|
defaultData?: ParsedUrlDataType;
|
||||||
defaultHomeData?: { [key: string]: string };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function MainNavigator(props: PropsType) {
|
function MainNavigator(props: PropsType) {
|
||||||
|
@ -395,7 +448,5 @@ function MainNavigator(props: PropsType) {
|
||||||
|
|
||||||
export default React.memo(
|
export default React.memo(
|
||||||
MainNavigator,
|
MainNavigator,
|
||||||
(pp: PropsType, np: PropsType) =>
|
(pp: PropsType, np: PropsType) => pp.defaultData === np.defaultData
|
||||||
pp.defaultHomeRoute === np.defaultHomeRoute &&
|
|
||||||
pp.defaultHomeData === np.defaultHomeData
|
|
||||||
);
|
);
|
||||||
|
|
|
@ -36,6 +36,7 @@ import {
|
||||||
getPreferenceString,
|
getPreferenceString,
|
||||||
GeneralPreferenceKeys,
|
GeneralPreferenceKeys,
|
||||||
} from '../utils/asyncStorage';
|
} from '../utils/asyncStorage';
|
||||||
|
import { ParsedUrlDataType } from '../utils/URLHandler';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
header: {
|
header: {
|
||||||
|
@ -51,25 +52,24 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export enum TabRoutes {
|
||||||
|
Services = 'services',
|
||||||
|
Proxiwash = 'proxiwash',
|
||||||
|
Home = 'home',
|
||||||
|
Planning = 'events',
|
||||||
|
Planex = 'planex',
|
||||||
|
}
|
||||||
|
|
||||||
type DefaultParams = { [key in TabRoutes]: object | undefined };
|
type DefaultParams = { [key in TabRoutes]: object | undefined };
|
||||||
|
|
||||||
export type FullParamsList = DefaultParams & {
|
export type TabStackParamsList = DefaultParams & {
|
||||||
[TabRoutes.Home]: {
|
[TabRoutes.Home]: ParsedUrlDataType;
|
||||||
nextScreen: string;
|
|
||||||
data: Record<string, object | undefined>;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Don't know why but TS is complaining without this
|
|
||||||
// See: https://stackoverflow.com/questions/63652687/interface-does-not-satisfy-the-constraint-recordstring-object-undefined
|
|
||||||
export type TabStackParamsList = FullParamsList &
|
|
||||||
Record<string, object | undefined>;
|
|
||||||
|
|
||||||
const Tab = createBottomTabNavigator<TabStackParamsList>();
|
const Tab = createBottomTabNavigator<TabStackParamsList>();
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = {
|
||||||
defaultHomeRoute?: string;
|
defaultData?: ParsedUrlDataType;
|
||||||
defaultHomeData?: { [key: string]: string };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const ICONS: {
|
const ICONS: {
|
||||||
|
@ -111,15 +111,6 @@ function TabNavigator(props: PropsType) {
|
||||||
} else {
|
} else {
|
||||||
defaultRoute = defaultRoute.toLowerCase();
|
defaultRoute = defaultRoute.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
let params;
|
|
||||||
if (props.defaultHomeRoute) {
|
|
||||||
params = {
|
|
||||||
data: props.defaultHomeData,
|
|
||||||
nextScreen: props.defaultHomeRoute,
|
|
||||||
shouldOpen: true,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
|
|
||||||
const LABELS: {
|
const LABELS: {
|
||||||
|
@ -133,23 +124,23 @@ function TabNavigator(props: PropsType) {
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Tab.Navigator
|
<Tab.Navigator
|
||||||
initialRouteName={defaultRoute}
|
initialRouteName={defaultRoute as TabRoutes}
|
||||||
tabBar={(tabProps) => (
|
tabBar={(tabProps) => (
|
||||||
<CustomTabBar {...tabProps} labels={LABELS} icons={ICONS} />
|
<CustomTabBar {...tabProps} labels={LABELS} icons={ICONS} />
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name={'services'}
|
name={TabRoutes.Services}
|
||||||
component={WebsitesHomeScreen}
|
component={WebsitesHomeScreen}
|
||||||
options={{ title: i18n.t('screens.services.title') }}
|
options={{ title: i18n.t('screens.services.title') }}
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name={'proxiwash'}
|
name={TabRoutes.Proxiwash}
|
||||||
component={ProxiwashScreen}
|
component={ProxiwashScreen}
|
||||||
options={{ title: i18n.t('screens.proxiwash.title') }}
|
options={{ title: i18n.t('screens.proxiwash.title') }}
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name={'home'}
|
name={TabRoutes.Home}
|
||||||
component={HomeScreen}
|
component={HomeScreen}
|
||||||
options={{
|
options={{
|
||||||
title: i18n.t('screens.home.title'),
|
title: i18n.t('screens.home.title'),
|
||||||
|
@ -176,15 +167,15 @@ function TabNavigator(props: PropsType) {
|
||||||
</View>
|
</View>
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
initialParams={params}
|
initialParams={props.defaultData}
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name={'events'}
|
name={TabRoutes.Planning}
|
||||||
component={PlanningScreen}
|
component={PlanningScreen}
|
||||||
options={{ title: i18n.t('screens.planning.title') }}
|
options={{ title: i18n.t('screens.planning.title') }}
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name={'planex'}
|
name={TabRoutes.Planex}
|
||||||
component={PlanexScreen}
|
component={PlanexScreen}
|
||||||
options={{
|
options={{
|
||||||
title: i18n.t('screens.planex.title'),
|
title: i18n.t('screens.planex.title'),
|
||||||
|
@ -196,15 +187,5 @@ function TabNavigator(props: PropsType) {
|
||||||
|
|
||||||
export default React.memo(
|
export default React.memo(
|
||||||
TabNavigator,
|
TabNavigator,
|
||||||
(pp: PropsType, np: PropsType) =>
|
(pp: PropsType, np: PropsType) => pp.defaultData === np.defaultData
|
||||||
pp.defaultHomeRoute === np.defaultHomeRoute &&
|
|
||||||
pp.defaultHomeData === np.defaultHomeData
|
|
||||||
);
|
);
|
||||||
|
|
||||||
export enum TabRoutes {
|
|
||||||
Services = 'services',
|
|
||||||
Proxiwash = 'proxiwash',
|
|
||||||
Home = 'home',
|
|
||||||
Planning = 'events',
|
|
||||||
Planex = 'planex',
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ import OptionsDialog from '../../components/Dialogs/OptionsDialog';
|
||||||
import type { OptionsDialogButtonType } from '../../components/Dialogs/OptionsDialog';
|
import type { OptionsDialogButtonType } from '../../components/Dialogs/OptionsDialog';
|
||||||
import GENERAL_STYLES from '../../constants/Styles';
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
import Urls from '../../constants/Urls';
|
import Urls from '../../constants/Urls';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
const APP_LOGO = require('../../../assets/android.icon.round.png');
|
const APP_LOGO = require('../../../assets/android.icon.round.png');
|
||||||
|
|
||||||
|
@ -179,7 +180,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
{
|
{
|
||||||
onPressCallback: () => {
|
onPressCallback: () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
navigation.navigate('feedback');
|
navigation.navigate(MainRoutes.Feedback);
|
||||||
},
|
},
|
||||||
icon: 'bug',
|
icon: 'bug',
|
||||||
text: i18n.t('screens.feedback.homeButtonTitle'),
|
text: i18n.t('screens.feedback.homeButtonTitle'),
|
||||||
|
@ -236,7 +237,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
{
|
{
|
||||||
onPressCallback: () => {
|
onPressCallback: () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
navigation.navigate('dependencies');
|
navigation.navigate(MainRoutes.Dependencies);
|
||||||
},
|
},
|
||||||
icon: 'developer-board',
|
icon: 'developer-board',
|
||||||
text: i18n.t('screens.about.libs'),
|
text: i18n.t('screens.about.libs'),
|
||||||
|
@ -275,7 +276,7 @@ class AboutScreen extends React.Component<PropsType, StateType> {
|
||||||
{
|
{
|
||||||
onPressCallback: () => {
|
onPressCallback: () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
navigation.navigate('feedback');
|
navigation.navigate(MainRoutes.Feedback);
|
||||||
},
|
},
|
||||||
icon: 'hand-pointing-right',
|
icon: 'hand-pointing-right',
|
||||||
text: i18n.t('screens.about.user.you'),
|
text: i18n.t('screens.about.user.you'),
|
||||||
|
|
|
@ -38,16 +38,13 @@ import { useFocusEffect } from '@react-navigation/core';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { useAuthenticatedRequest } from '../../../context/loginContext';
|
import { useAuthenticatedRequest } from '../../../context/loginContext';
|
||||||
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
type Props = {
|
type Props = StackScreenProps<MainStackParamsList, MainRoutes.ClubInformation>;
|
||||||
route: {
|
|
||||||
params?: {
|
|
||||||
data?: ClubType;
|
|
||||||
categories?: Array<ClubCategoryType>;
|
|
||||||
clubId?: number;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
type ResponseType = ClubType;
|
type ResponseType = ClubType;
|
||||||
|
|
||||||
|
@ -94,18 +91,19 @@ function ClubDisplayScreen(props: Props) {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const [displayData, setDisplayData] = useState<ClubType | undefined>();
|
const [displayData, setDisplayData] = useState<ClubType | undefined>();
|
||||||
const [categories, setCategories] =
|
const [categories, setCategories] = useState<
|
||||||
useState<Array<ClubCategoryType> | undefined>();
|
Array<ClubCategoryType> | undefined
|
||||||
|
>();
|
||||||
const [clubId, setClubId] = useState<number | undefined>();
|
const [clubId, setClubId] = useState<number | undefined>();
|
||||||
|
|
||||||
useFocusEffect(
|
useFocusEffect(
|
||||||
useCallback(() => {
|
useCallback(() => {
|
||||||
if (props.route.params?.data && props.route.params?.categories) {
|
if (props.route.params.type === 'full') {
|
||||||
setDisplayData(props.route.params.data);
|
setDisplayData(props.route.params.data);
|
||||||
setCategories(props.route.params.categories);
|
setCategories(props.route.params.categories);
|
||||||
setClubId(props.route.params.data.id);
|
setClubId(props.route.params.data.id);
|
||||||
} else {
|
} else {
|
||||||
const id = props.route.params?.clubId;
|
const id = props.route.params.clubId;
|
||||||
setClubId(id ? id : 0);
|
setClubId(id ? id : 0);
|
||||||
}
|
}
|
||||||
}, [props.route.params])
|
}, [props.route.params])
|
||||||
|
|
|
@ -33,6 +33,7 @@ import MaterialHeaderButtons, {
|
||||||
import WebSectionList from '../../../components/Screens/WebSectionList';
|
import WebSectionList from '../../../components/Screens/WebSectionList';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { useAuthenticatedRequest } from '../../../context/loginContext';
|
import { useAuthenticatedRequest } from '../../../context/loginContext';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
export type ClubCategoryType = {
|
export type ClubCategoryType = {
|
||||||
id: number;
|
id: number;
|
||||||
|
@ -80,7 +81,7 @@ function ClubListScreen() {
|
||||||
<Item
|
<Item
|
||||||
title="main"
|
title="main"
|
||||||
iconName="information"
|
iconName="information"
|
||||||
onPress={() => navigation.navigate('club-about')}
|
onPress={() => navigation.navigate(MainRoutes.ClubAbout)}
|
||||||
/>
|
/>
|
||||||
</MaterialHeaderButtons>
|
</MaterialHeaderButtons>
|
||||||
);
|
);
|
||||||
|
@ -108,7 +109,8 @@ function ClubListScreen() {
|
||||||
* @param item The article pressed
|
* @param item The article pressed
|
||||||
*/
|
*/
|
||||||
const onListItemPress = (item: ClubType) => {
|
const onListItemPress = (item: ClubType) => {
|
||||||
navigation.navigate('club-information', {
|
navigation.navigate(MainRoutes.ClubInformation, {
|
||||||
|
type: 'full',
|
||||||
data: item,
|
data: item,
|
||||||
categories: categories.current,
|
categories: categories.current,
|
||||||
});
|
});
|
||||||
|
|
|
@ -31,12 +31,15 @@ import i18n from 'i18n-js';
|
||||||
import { getRelativeDateString } from '../../../utils/EquipmentBooking';
|
import { getRelativeDateString } from '../../../utils/EquipmentBooking';
|
||||||
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
||||||
import { StackScreenProps } from '@react-navigation/stack';
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
import { MainStackParamsList } from '../../../navigation/MainNavigator';
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../../navigation/MainNavigator';
|
||||||
import GENERAL_STYLES from '../../../constants/Styles';
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
|
||||||
type EquipmentConfirmScreenNavigationProp = StackScreenProps<
|
type EquipmentConfirmScreenNavigationProp = StackScreenProps<
|
||||||
MainStackParamsList,
|
MainStackParamsList,
|
||||||
'equipment-confirm'
|
MainRoutes.EquipmentConfirm
|
||||||
>;
|
>;
|
||||||
|
|
||||||
type Props = EquipmentConfirmScreenNavigationProp;
|
type Props = EquipmentConfirmScreenNavigationProp;
|
||||||
|
|
|
@ -60,13 +60,13 @@ const styles = StyleSheet.create({
|
||||||
|
|
||||||
function EquipmentListScreen() {
|
function EquipmentListScreen() {
|
||||||
const userRents = useRef<undefined | Array<RentedDeviceType>>();
|
const userRents = useRef<undefined | Array<RentedDeviceType>>();
|
||||||
const [mascotDialogVisible, setMascotDialogVisible] =
|
const [mascotDialogVisible, setMascotDialogVisible] = useState<
|
||||||
useState<undefined | boolean>(undefined);
|
undefined | boolean
|
||||||
|
>(undefined);
|
||||||
|
|
||||||
const requestAll =
|
const requestAll =
|
||||||
useAuthenticatedRequest<{ devices: Array<DeviceType> }>('location/all');
|
useAuthenticatedRequest<{ devices: Array<DeviceType> }>('location/all');
|
||||||
const requestOwn =
|
const requestOwn = useAuthenticatedRequest<{
|
||||||
useAuthenticatedRequest<{
|
|
||||||
locations: Array<RentedDeviceType>;
|
locations: Array<RentedDeviceType>;
|
||||||
}>('location/my');
|
}>('location/my');
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,10 @@ import {
|
||||||
isEquipmentAvailable,
|
isEquipmentAvailable,
|
||||||
} from '../../../utils/EquipmentBooking';
|
} from '../../../utils/EquipmentBooking';
|
||||||
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../../components/Collapsible/CollapsibleScrollView';
|
||||||
import { MainStackParamsList } from '../../../navigation/MainNavigator';
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../../navigation/MainNavigator';
|
||||||
import GENERAL_STYLES from '../../../constants/Styles';
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
import { ApiRejectType } from '../../../utils/WebData';
|
import { ApiRejectType } from '../../../utils/WebData';
|
||||||
import { REQUEST_STATUS } from '../../../utils/Requests';
|
import { REQUEST_STATUS } from '../../../utils/Requests';
|
||||||
|
@ -50,7 +53,7 @@ import { useFocusEffect } from '@react-navigation/core';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { useAuthenticatedRequest } from '../../../context/loginContext';
|
import { useAuthenticatedRequest } from '../../../context/loginContext';
|
||||||
|
|
||||||
type Props = StackScreenProps<MainStackParamsList, 'equipment-rent'>;
|
type Props = StackScreenProps<MainStackParamsList, MainRoutes.EquipmentRent>;
|
||||||
|
|
||||||
export type MarkedDatesObjectType = {
|
export type MarkedDatesObjectType = {
|
||||||
[key: string]: PeriodMarking;
|
[key: string]: PeriodMarking;
|
||||||
|
|
|
@ -26,7 +26,10 @@ import ErrorDialog from '../../components/Dialogs/ErrorDialog';
|
||||||
import { MASCOT_STYLE } from '../../components/Mascot/Mascot';
|
import { MASCOT_STYLE } from '../../components/Mascot/Mascot';
|
||||||
import MascotPopup from '../../components/Mascot/MascotPopup';
|
import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
||||||
import { MainStackParamsList } from '../../navigation/MainNavigator';
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../navigation/MainNavigator';
|
||||||
import GENERAL_STYLES from '../../constants/Styles';
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
import Urls from '../../constants/Urls';
|
import Urls from '../../constants/Urls';
|
||||||
import { ApiRejectType, connectToAmicale } from '../../utils/WebData';
|
import { ApiRejectType, connectToAmicale } from '../../utils/WebData';
|
||||||
|
@ -37,15 +40,16 @@ import { TabRoutes } from '../../navigation/TabNavigator';
|
||||||
import { useShouldShowMascot } from '../../context/preferencesContext';
|
import { useShouldShowMascot } from '../../context/preferencesContext';
|
||||||
import { useLogin } from '../../context/loginContext';
|
import { useLogin } from '../../context/loginContext';
|
||||||
|
|
||||||
type Props = StackScreenProps<MainStackParamsList, 'login'>;
|
type Props = StackScreenProps<MainStackParamsList, MainRoutes.Login>;
|
||||||
|
|
||||||
function LoginScreen(props: Props) {
|
function LoginScreen(props: Props) {
|
||||||
const navigation = useNavigation<StackNavigationProp<any>>();
|
const navigation = useNavigation<StackNavigationProp<any>>();
|
||||||
const { setLogin } = useLogin();
|
const { setLogin } = useLogin();
|
||||||
const [loading, setLoading] = useState(false);
|
const [loading, setLoading] = useState(false);
|
||||||
const [nextScreen, setNextScreen] = useState<string | undefined>(undefined);
|
const [nextScreen, setNextScreen] = useState<string | undefined>(undefined);
|
||||||
const [mascotDialogVisible, setMascotDialogVisible] =
|
const [mascotDialogVisible, setMascotDialogVisible] = useState<
|
||||||
useState<undefined | boolean>(undefined);
|
undefined | boolean
|
||||||
|
>(undefined);
|
||||||
const [currentError, setCurrentError] = useState<ApiRejectType>({
|
const [currentError, setCurrentError] = useState<ApiRejectType>({
|
||||||
status: REQUEST_STATUS.SUCCESS,
|
status: REQUEST_STATUS.SUCCESS,
|
||||||
});
|
});
|
||||||
|
@ -58,7 +62,7 @@ function LoginScreen(props: Props) {
|
||||||
);
|
);
|
||||||
|
|
||||||
const onResetPasswordClick = () => {
|
const onResetPasswordClick = () => {
|
||||||
navigation.navigate('website', {
|
navigation.navigate(MainRoutes.Website, {
|
||||||
host: Urls.websites.amicale,
|
host: Urls.websites.amicale,
|
||||||
path: Urls.amicale.resetPassword,
|
path: Urls.amicale.resetPassword,
|
||||||
title: i18n.t('screens.websites.amicale'),
|
title: i18n.t('screens.websites.amicale'),
|
||||||
|
|
|
@ -133,8 +133,9 @@ const styles = StyleSheet.create({
|
||||||
*/
|
*/
|
||||||
export default function VoteScreen() {
|
export default function VoteScreen() {
|
||||||
const [hasVoted, setHasVoted] = useState(false);
|
const [hasVoted, setHasVoted] = useState(false);
|
||||||
const [mascotDialogVisible, setMascotDialogVisible] =
|
const [mascotDialogVisible, setMascotDialogVisible] = useState<
|
||||||
useState<undefined | boolean>(undefined);
|
undefined | boolean
|
||||||
|
>(undefined);
|
||||||
|
|
||||||
const datesRequest =
|
const datesRequest =
|
||||||
useAuthenticatedRequest<VoteDatesStringType>('elections/dates');
|
useAuthenticatedRequest<VoteDatesStringType>('elections/dates');
|
||||||
|
|
|
@ -79,8 +79,7 @@ export default function GameMainScreen() {
|
||||||
gameLevel: 0,
|
gameLevel: 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [dialogContent, setDialogContent] =
|
const [dialogContent, setDialogContent] = useState<{
|
||||||
useState<{
|
|
||||||
dialogTitle: string;
|
dialogTitle: string;
|
||||||
dialogMessage: string;
|
dialogMessage: string;
|
||||||
dialogButtons: Array<OptionsDialogButtonType>;
|
dialogButtons: Array<OptionsDialogButtonType>;
|
||||||
|
|
|
@ -21,7 +21,7 @@ import * as React from 'react';
|
||||||
import { Linking, Image, StyleSheet } from 'react-native';
|
import { Linking, Image, StyleSheet } from 'react-native';
|
||||||
import { Card, Text } from 'react-native-paper';
|
import { Card, Text } from 'react-native-paper';
|
||||||
import Autolink from 'react-native-autolink';
|
import Autolink from 'react-native-autolink';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
import MaterialHeaderButtons, {
|
import MaterialHeaderButtons, {
|
||||||
Item,
|
Item,
|
||||||
} from '../../components/Overrides/CustomHeaderButton';
|
} from '../../components/Overrides/CustomHeaderButton';
|
||||||
|
@ -33,11 +33,15 @@ import NewsSourcesConstants, {
|
||||||
AvailablePages,
|
AvailablePages,
|
||||||
} from '../../constants/NewsSourcesConstants';
|
} from '../../constants/NewsSourcesConstants';
|
||||||
import type { NewsSourceType } from '../../constants/NewsSourcesConstants';
|
import type { NewsSourceType } from '../../constants/NewsSourcesConstants';
|
||||||
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = StackScreenProps<
|
||||||
navigation: StackNavigationProp<any>;
|
MainStackParamsList,
|
||||||
route: { params: { data: FeedItemType; date: string } };
|
MainRoutes.FeedInformation
|
||||||
};
|
>;
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
|
|
@ -154,7 +154,7 @@ function HomeScreen(props: Props) {
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
const getHeaderButton = () => {
|
const getHeaderButton = () => {
|
||||||
let onPressLog = () =>
|
let onPressLog = () =>
|
||||||
navigation.navigate('login', { nextScreen: 'profile' });
|
navigation.navigate(MainRoutes.Login, { nextScreen: 'profile' });
|
||||||
let logIcon = 'login';
|
let logIcon = 'login';
|
||||||
let logColor = theme.colors.primary;
|
let logColor = theme.colors.primary;
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
|
@ -190,8 +190,8 @@ function HomeScreen(props: Props) {
|
||||||
const handleNavigationParams = () => {
|
const handleNavigationParams = () => {
|
||||||
const { route } = props;
|
const { route } = props;
|
||||||
if (route.params != null) {
|
if (route.params != null) {
|
||||||
if (route.params.nextScreen != null) {
|
if (route.params.route != null) {
|
||||||
navigation.navigate(route.params.nextScreen, route.params.data);
|
navigation.navigate(route.params.route, route.params.data);
|
||||||
// reset params to prevent infinite loop
|
// reset params to prevent infinite loop
|
||||||
navigation.dispatch(CommonActions.setParams({ nextScreen: null }));
|
navigation.dispatch(CommonActions.setParams({ nextScreen: null }));
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ function HomeScreen(props: Props) {
|
||||||
|
|
||||||
const hideDisconnectDialog = () => setDialogVisible(false);
|
const hideDisconnectDialog = () => setDialogVisible(false);
|
||||||
|
|
||||||
const openScanner = () => navigation.navigate('scanner');
|
const openScanner = () => navigation.navigate(MainRoutes.Scanner);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the dataset to be used in the FlatList
|
* Creates the dataset to be used in the FlatList
|
||||||
|
|
|
@ -13,13 +13,13 @@ import { Platform, SafeAreaView, View } from 'react-native';
|
||||||
import { useDarkTheme } from '../context/preferencesContext';
|
import { useDarkTheme } from '../context/preferencesContext';
|
||||||
import { CustomDarkTheme, CustomWhiteTheme } from '../utils/Themes';
|
import { CustomDarkTheme, CustomWhiteTheme } from '../utils/Themes';
|
||||||
import { setupStatusBar } from '../utils/Utils';
|
import { setupStatusBar } from '../utils/Utils';
|
||||||
|
import { ParsedUrlDataType } from '../utils/URLHandler';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
defaultHomeRoute?: string;
|
defaultData?: ParsedUrlDataType;
|
||||||
defaultHomeData?: { [key: string]: string };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function MainApp(props: Props, ref?: Ref<NavigationContainerRef>) {
|
function MainApp(props: Props, ref?: Ref<NavigationContainerRef<any>>) {
|
||||||
const darkTheme = useDarkTheme();
|
const darkTheme = useDarkTheme();
|
||||||
const theme = darkTheme ? CustomDarkTheme : CustomWhiteTheme;
|
const theme = darkTheme ? CustomDarkTheme : CustomWhiteTheme;
|
||||||
|
|
||||||
|
@ -44,10 +44,7 @@ function MainApp(props: Props, ref?: Ref<NavigationContainerRef>) {
|
||||||
>
|
>
|
||||||
<SafeAreaView style={GENERAL_STYLES.flex}>
|
<SafeAreaView style={GENERAL_STYLES.flex}>
|
||||||
<NavigationContainer theme={theme} ref={ref}>
|
<NavigationContainer theme={theme} ref={ref}>
|
||||||
<MainNavigator
|
<MainNavigator defaultData={props.defaultData} />
|
||||||
defaultHomeRoute={props.defaultHomeRoute}
|
|
||||||
defaultHomeData={props.defaultHomeData}
|
|
||||||
/>
|
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
</SafeAreaView>
|
</SafeAreaView>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
@ -23,11 +23,14 @@ import ImageViewer from 'react-native-image-zoom-viewer';
|
||||||
import { StackNavigationProp, StackScreenProps } from '@react-navigation/stack';
|
import { StackNavigationProp, StackScreenProps } from '@react-navigation/stack';
|
||||||
import * as Animatable from 'react-native-animatable';
|
import * as Animatable from 'react-native-animatable';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { MainStackParamsList } from '../../navigation/MainNavigator';
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type ImageGalleryScreenNavigationProp = StackScreenProps<
|
type ImageGalleryScreenNavigationProp = StackScreenProps<
|
||||||
MainStackParamsList,
|
MainStackParamsList,
|
||||||
'gallery'
|
MainRoutes.Gallery
|
||||||
>;
|
>;
|
||||||
|
|
||||||
type Props = ImageGalleryScreenNavigationProp & {
|
type Props = ImageGalleryScreenNavigationProp & {
|
||||||
|
|
|
@ -149,6 +149,7 @@ function DashboardEditScreen() {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CollapsibleFlatList
|
<CollapsibleFlatList
|
||||||
|
//@ts-ignore
|
||||||
data={getCategories(navigation.navigate, isLoggedIn)}
|
data={getCategories(navigation.navigate, isLoggedIn)}
|
||||||
renderItem={getRenderItem}
|
renderItem={getRenderItem}
|
||||||
ListHeaderComponent={getListHeader()}
|
ListHeaderComponent={getListHeader()}
|
||||||
|
|
|
@ -44,6 +44,7 @@ import {
|
||||||
GeneralPreferenceKeys,
|
GeneralPreferenceKeys,
|
||||||
ProxiwashPreferenceKeys,
|
ProxiwashPreferenceKeys,
|
||||||
} from '../../../utils/asyncStorage';
|
} from '../../../utils/asyncStorage';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
slider: {
|
slider: {
|
||||||
|
@ -204,7 +205,7 @@ function SettingsScreen() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNavigateItem = (
|
const getNavigateItem = (
|
||||||
route: string,
|
route: MainRoutes,
|
||||||
icon: string,
|
icon: string,
|
||||||
title: string,
|
title: string,
|
||||||
subtitle: string,
|
subtitle: string,
|
||||||
|
@ -283,7 +284,7 @@ function SettingsScreen() {
|
||||||
/>
|
/>
|
||||||
{getStartScreenPicker()}
|
{getStartScreenPicker()}
|
||||||
{getNavigateItem(
|
{getNavigateItem(
|
||||||
'dashboard-edit',
|
MainRoutes.DashboardEdit,
|
||||||
'view-dashboard',
|
'view-dashboard',
|
||||||
i18n.t('screens.settings.dashboard'),
|
i18n.t('screens.settings.dashboard'),
|
||||||
i18n.t('screens.settings.dashboardSub')
|
i18n.t('screens.settings.dashboardSub')
|
||||||
|
@ -328,21 +329,21 @@ function SettingsScreen() {
|
||||||
<List.Section>
|
<List.Section>
|
||||||
{isDebugUnlocked
|
{isDebugUnlocked
|
||||||
? getNavigateItem(
|
? getNavigateItem(
|
||||||
'debug',
|
MainRoutes.Debug,
|
||||||
'bug-check',
|
'bug-check',
|
||||||
i18n.t('screens.debug.title'),
|
i18n.t('screens.debug.title'),
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
: null}
|
: null}
|
||||||
{getNavigateItem(
|
{getNavigateItem(
|
||||||
'about',
|
MainRoutes.About,
|
||||||
'information',
|
'information',
|
||||||
i18n.t('screens.about.title'),
|
i18n.t('screens.about.title'),
|
||||||
i18n.t('screens.about.buttonDesc'),
|
i18n.t('screens.about.buttonDesc'),
|
||||||
unlockDebugMode
|
unlockDebugMode
|
||||||
)}
|
)}
|
||||||
{getNavigateItem(
|
{getNavigateItem(
|
||||||
'feedback',
|
MainRoutes.Feedback,
|
||||||
'comment-quote',
|
'comment-quote',
|
||||||
i18n.t('screens.feedback.homeButtonTitle'),
|
i18n.t('screens.feedback.homeButtonTitle'),
|
||||||
i18n.t('screens.feedback.homeButtonSubtitle')
|
i18n.t('screens.feedback.homeButtonSubtitle')
|
||||||
|
|
|
@ -42,6 +42,7 @@ import {
|
||||||
} from '../../utils/asyncStorage';
|
} from '../../utils/asyncStorage';
|
||||||
import { usePlanexPreferences } from '../../context/preferencesContext';
|
import { usePlanexPreferences } from '../../context/preferencesContext';
|
||||||
import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
|
import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -59,8 +60,7 @@ function PlanexScreen() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { preferences } = usePlanexPreferences();
|
const { preferences } = usePlanexPreferences();
|
||||||
|
|
||||||
const [dialogContent, setDialogContent] =
|
const [dialogContent, setDialogContent] = useState<
|
||||||
useState<
|
|
||||||
| undefined
|
| undefined
|
||||||
| {
|
| {
|
||||||
title: string | React.ReactElement;
|
title: string | React.ReactElement;
|
||||||
|
@ -106,7 +106,7 @@ function PlanexScreen() {
|
||||||
* Callback used when the user clicks on the navigate to settings button.
|
* Callback used when the user clicks on the navigate to settings button.
|
||||||
* This will hide the banner and open the SettingsScreen
|
* This will hide the banner and open the SettingsScreen
|
||||||
*/
|
*/
|
||||||
const onGoToSettings = () => navigation.navigate('settings');
|
const onGoToSettings = () => navigation.navigate(MainRoutes.Settings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sends a FullCalendar action to the web page inside the webview.
|
* Sends a FullCalendar action to the web page inside the webview.
|
||||||
|
|
|
@ -21,7 +21,7 @@ import * as React from 'react';
|
||||||
import { StyleSheet, View } from 'react-native';
|
import { StyleSheet, View } from 'react-native';
|
||||||
import { Card } from 'react-native-paper';
|
import { Card } from 'react-native-paper';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
import { getDateOnlyString, getTimeOnlyString } from '../../utils/Planning';
|
import { getDateOnlyString, getTimeOnlyString } from '../../utils/Planning';
|
||||||
import DateManager from '../../managers/DateManager';
|
import DateManager from '../../managers/DateManager';
|
||||||
import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
|
import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
|
||||||
|
@ -33,11 +33,15 @@ import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrol
|
||||||
import type { PlanningEventType } from '../../utils/Planning';
|
import type { PlanningEventType } from '../../utils/Planning';
|
||||||
import ImageGalleryButton from '../../components/Media/ImageGalleryButton';
|
import ImageGalleryButton from '../../components/Media/ImageGalleryButton';
|
||||||
import { API_REQUEST_CODES, REQUEST_STATUS } from '../../utils/Requests';
|
import { API_REQUEST_CODES, REQUEST_STATUS } from '../../utils/Requests';
|
||||||
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = StackScreenProps<
|
||||||
navigation: StackNavigationProp<any>;
|
MainStackParamsList,
|
||||||
route: { params: { data: PlanningEventType; id: number; eventId: number } };
|
MainRoutes.PlanningInformation
|
||||||
};
|
>;
|
||||||
|
|
||||||
type StateType = {
|
type StateType = {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
|
@ -78,7 +82,7 @@ class PlanningDisplayScreen extends React.Component<PropsType, StateType> {
|
||||||
constructor(props: PropsType) {
|
constructor(props: PropsType) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
if (props.route.params.data != null) {
|
if (props.route.params.type === 'full') {
|
||||||
this.displayData = props.route.params.data;
|
this.displayData = props.route.params.data;
|
||||||
this.eventId = this.displayData.id;
|
this.eventId = this.displayData.id;
|
||||||
this.shouldFetchData = false;
|
this.shouldFetchData = false;
|
||||||
|
|
|
@ -36,6 +36,7 @@ import { MASCOT_STYLE } from '../../components/Mascot/Mascot';
|
||||||
import MascotPopup from '../../components/Mascot/MascotPopup';
|
import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
import GENERAL_STYLES from '../../constants/Styles';
|
import GENERAL_STYLES from '../../constants/Styles';
|
||||||
import Urls from '../../constants/Urls';
|
import Urls from '../../constants/Urls';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
LocaleConfig.locales.fr = {
|
LocaleConfig.locales.fr = {
|
||||||
monthNames: [
|
monthNames: [
|
||||||
|
@ -217,7 +218,7 @@ class PlanningScreen extends React.Component<PropsType, StateType> {
|
||||||
getRenderItem = (item: PlanningEventType) => {
|
getRenderItem = (item: PlanningEventType) => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
const onPress = () => {
|
const onPress = () => {
|
||||||
navigation.navigate('planning-information', {
|
navigation.navigate(MainRoutes.PlanningInformation, {
|
||||||
data: item,
|
data: item,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,6 +61,7 @@ import {
|
||||||
} from '../../utils/asyncStorage';
|
} from '../../utils/asyncStorage';
|
||||||
import { useProxiwashPreferences } from '../../context/preferencesContext';
|
import { useProxiwashPreferences } from '../../context/preferencesContext';
|
||||||
import { useSubsequentEffect } from '../../utils/customHooks';
|
import { useSubsequentEffect } from '../../utils/customHooks';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
const REFRESH_TIME = 1000 * 10; // Refresh every 10 seconds
|
const REFRESH_TIME = 1000 * 10; // Refresh every 10 seconds
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
|
@ -170,7 +171,7 @@ function ProxiwashScreen() {
|
||||||
<Item
|
<Item
|
||||||
title={'information'}
|
title={'information'}
|
||||||
iconName={'information'}
|
iconName={'information'}
|
||||||
onPress={() => navigation.navigate('proxiwash-about')}
|
onPress={() => navigation.navigate(MainRoutes.ProxiwashAbout)}
|
||||||
/>
|
/>
|
||||||
</MaterialHeaderButtons>
|
</MaterialHeaderButtons>
|
||||||
),
|
),
|
||||||
|
@ -494,7 +495,7 @@ function ProxiwashScreen() {
|
||||||
action: {
|
action: {
|
||||||
message: i18n.t('screens.proxiwash.mascotDialog.ok'),
|
message: i18n.t('screens.proxiwash.mascotDialog.ok'),
|
||||||
icon: 'cog',
|
icon: 'cog',
|
||||||
onPress: () => navigation.navigate('settings'),
|
onPress: () => navigation.navigate(MainRoutes.Settings),
|
||||||
},
|
},
|
||||||
cancel: {
|
cancel: {
|
||||||
message: i18n.t('screens.proxiwash.mascotDialog.cancel'),
|
message: i18n.t('screens.proxiwash.mascotDialog.cancel'),
|
||||||
|
|
|
@ -123,8 +123,9 @@ function ProximoListScreen(props: Props) {
|
||||||
|
|
||||||
const [currentSearchString, setCurrentSearchString] = useState('');
|
const [currentSearchString, setCurrentSearchString] = useState('');
|
||||||
const [currentSortMode, setCurrentSortMode] = useState(2);
|
const [currentSortMode, setCurrentSortMode] = useState(2);
|
||||||
const [modalCurrentDisplayItem, setModalCurrentDisplayItem] =
|
const [modalCurrentDisplayItem, setModalCurrentDisplayItem] = useState<
|
||||||
useState<React.ReactChild | undefined>();
|
React.ReactChild | undefined
|
||||||
|
>();
|
||||||
|
|
||||||
const sortModes = [sortPrice, sortPriceReverse, sortName, sortNameReverse];
|
const sortModes = [sortPrice, sortPriceReverse, sortName, sortNameReverse];
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ import { useNavigation } from '@react-navigation/core';
|
||||||
import { useLayoutEffect } from 'react';
|
import { useLayoutEffect } from 'react';
|
||||||
import { useCachedProximoCategories } from '../../../context/cacheContext';
|
import { useCachedProximoCategories } from '../../../context/cacheContext';
|
||||||
import GENERAL_STYLES from '../../../constants/Styles';
|
import GENERAL_STYLES from '../../../constants/Styles';
|
||||||
|
import { MainRoutes } from '../../../navigation/MainNavigator';
|
||||||
|
|
||||||
const LIST_ITEM_HEIGHT = 84;
|
const LIST_ITEM_HEIGHT = 84;
|
||||||
|
|
||||||
|
@ -122,10 +123,10 @@ function ProximoMainScreen() {
|
||||||
shouldFocusSearchBar: true,
|
shouldFocusSearchBar: true,
|
||||||
category: -1,
|
category: -1,
|
||||||
};
|
};
|
||||||
navigation.navigate('proximo-list', searchScreenData);
|
navigation.navigate(MainRoutes.ProximoList, searchScreenData);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPressAboutBtn = () => navigation.navigate('proximo-about');
|
const onPressAboutBtn = () => navigation.navigate(MainRoutes.ProximoAbout);
|
||||||
|
|
||||||
const getHeaderButtons = () => {
|
const getHeaderButtons = () => {
|
||||||
return (
|
return (
|
||||||
|
@ -170,7 +171,8 @@ function ProximoMainScreen() {
|
||||||
? i18n.t('screens.proximo.articles')
|
? i18n.t('screens.proximo.articles')
|
||||||
: i18n.t('screens.proximo.article')
|
: i18n.t('screens.proximo.article')
|
||||||
}`;
|
}`;
|
||||||
const onPress = () => navigation.navigate('proximo-list', dataToSend);
|
const onPress = () =>
|
||||||
|
navigation.navigate(MainRoutes.ProximoList, dataToSend);
|
||||||
if (article_number > 0) {
|
if (article_number > 0) {
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
|
|
|
@ -42,6 +42,7 @@ import {
|
||||||
} from '../../utils/Services';
|
} from '../../utils/Services';
|
||||||
import { useNavigation } from '@react-navigation/native';
|
import { useNavigation } from '@react-navigation/native';
|
||||||
import { useLoginState } from '../../context/loginContext';
|
import { useLoginState } from '../../context/loginContext';
|
||||||
|
import { MainRoutes } from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
@ -62,6 +63,7 @@ function ServicesScreen() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isLoggedIn = useLoginState();
|
const isLoggedIn = useLoginState();
|
||||||
|
|
||||||
|
//@ts-ignore
|
||||||
const finalDataset = getCategories(navigation.navigate, isLoggedIn, [
|
const finalDataset = getCategories(navigation.navigate, isLoggedIn, [
|
||||||
SERVICES_CATEGORIES_KEY.SPECIAL,
|
SERVICES_CATEGORIES_KEY.SPECIAL,
|
||||||
]);
|
]);
|
||||||
|
@ -72,7 +74,7 @@ function ServicesScreen() {
|
||||||
<Item
|
<Item
|
||||||
title="information"
|
title="information"
|
||||||
iconName="information"
|
iconName="information"
|
||||||
onPress={() => navigation.navigate('amicale-contact')}
|
onPress={() => navigation.navigate(MainRoutes.AmicaleContact)}
|
||||||
/>
|
/>
|
||||||
</MaterialHeaderButtons>
|
</MaterialHeaderButtons>
|
||||||
);
|
);
|
||||||
|
@ -114,7 +116,9 @@ function ServicesScreen() {
|
||||||
return (
|
return (
|
||||||
<TouchableRipple
|
<TouchableRipple
|
||||||
style={styles.container}
|
style={styles.container}
|
||||||
onPress={() => navigation.navigate('services-section', { data: item })}
|
onPress={() =>
|
||||||
|
navigation.navigate(MainRoutes.ServicesSection, { data: item })
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<View>
|
<View>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
|
|
|
@ -18,17 +18,19 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { Collapsible } from 'react-navigation-collapsible';
|
|
||||||
import { CommonActions } from '@react-navigation/native';
|
import { CommonActions } from '@react-navigation/native';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
import CardList from '../../components/Lists/CardList/CardList';
|
import CardList from '../../components/Lists/CardList/CardList';
|
||||||
import { ServiceCategoryType } from '../../utils/Services';
|
import { ServiceCategoryType } from '../../utils/Services';
|
||||||
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type PropsType = {
|
type PropsType = StackScreenProps<
|
||||||
navigation: StackNavigationProp<any>;
|
MainStackParamsList,
|
||||||
route: { params: { data: ServiceCategoryType | null } };
|
MainRoutes.ServicesSection
|
||||||
collapsibleStack: Collapsible;
|
>;
|
||||||
};
|
|
||||||
|
|
||||||
class ServicesSectionScreen extends React.Component<PropsType> {
|
class ServicesSectionScreen extends React.Component<PropsType> {
|
||||||
finalDataset: null | ServiceCategoryType;
|
finalDataset: null | ServiceCategoryType;
|
||||||
|
|
|
@ -18,15 +18,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { StackNavigationProp } from '@react-navigation/stack';
|
import { StackScreenProps } from '@react-navigation/stack';
|
||||||
import WebViewScreen from '../../components/Screens/WebViewScreen';
|
import WebViewScreen from '../../components/Screens/WebViewScreen';
|
||||||
import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
|
import BasicLoadingScreen from '../../components/Screens/BasicLoadingScreen';
|
||||||
import Urls from '../../constants/Urls';
|
import Urls from '../../constants/Urls';
|
||||||
|
import {
|
||||||
|
MainRoutes,
|
||||||
|
MainStackParamsList,
|
||||||
|
} from '../../navigation/MainNavigator';
|
||||||
|
|
||||||
type Props = {
|
type Props = StackScreenProps<MainStackParamsList, MainRoutes.Website>;
|
||||||
navigation: StackNavigationProp<any>;
|
|
||||||
route: { params: { host: string; path: string | null; title: string } };
|
|
||||||
};
|
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
url: string;
|
url: string;
|
||||||
|
|
|
@ -87,8 +87,8 @@ export type ServiceCategoryType = {
|
||||||
};
|
};
|
||||||
|
|
||||||
function getAmicaleOnPress(
|
function getAmicaleOnPress(
|
||||||
route: string,
|
route: MainRoutes,
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (route: MainRoutes, params?: { [key: string]: any }) => void,
|
||||||
isLoggedIn: boolean
|
isLoggedIn: boolean
|
||||||
) {
|
) {
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
|
@ -99,7 +99,7 @@ function getAmicaleOnPress(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getAmicaleServices(
|
export function getAmicaleServices(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (route: MainRoutes, params?: { [key: string]: any }) => void,
|
||||||
isLoggedIn: boolean,
|
isLoggedIn: boolean,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceItemType> {
|
): Array<ServiceItemType> {
|
||||||
|
@ -148,7 +148,7 @@ export function getAmicaleServices(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getStudentServices(
|
export function getStudentServices(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (route: MainRoutes, params?: { [key: string]: any }) => void,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceItemType> {
|
): Array<ServiceItemType> {
|
||||||
const studentsDataset = [
|
const studentsDataset = [
|
||||||
|
@ -201,7 +201,7 @@ export function getStudentServices(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getINSAServices(
|
export function getINSAServices(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (route: MainRoutes, params?: { [key: string]: any }) => void,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceItemType> {
|
): Array<ServiceItemType> {
|
||||||
const insaDataset = [
|
const insaDataset = [
|
||||||
|
@ -274,7 +274,10 @@ export function getINSAServices(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getSpecialServices(
|
export function getSpecialServices(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (
|
||||||
|
route: MainRoutes | TabRoutes,
|
||||||
|
params?: { [key: string]: any }
|
||||||
|
) => void,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceItemType> {
|
): Array<ServiceItemType> {
|
||||||
const specialDataset = [
|
const specialDataset = [
|
||||||
|
@ -301,7 +304,10 @@ export function getSpecialServices(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getCategories(
|
export function getCategories(
|
||||||
onPress: (route: string, params?: { [key: string]: any }) => void,
|
onPress: (
|
||||||
|
route: MainRoutes | TabRoutes,
|
||||||
|
params?: { [key: string]: any }
|
||||||
|
) => void,
|
||||||
isLoggedIn: boolean,
|
isLoggedIn: boolean,
|
||||||
excludedItems?: Array<string>
|
excludedItems?: Array<string>
|
||||||
): Array<ServiceCategoryType> {
|
): Array<ServiceCategoryType> {
|
||||||
|
|
|
@ -18,10 +18,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Linking } from 'react-native';
|
import { Linking } from 'react-native';
|
||||||
|
import {
|
||||||
|
ClubInformationScreenParams,
|
||||||
|
MainRoutes,
|
||||||
|
PlanningInformationScreenParams,
|
||||||
|
} from '../navigation/MainNavigator';
|
||||||
|
|
||||||
export type ParsedUrlDataType = {
|
export type ParsedUrlDataType = {
|
||||||
route: string;
|
route: MainRoutes.ClubInformation | MainRoutes.PlanningInformation;
|
||||||
data: { [key: string]: string };
|
data: ClubInformationScreenParams | PlanningInformationScreenParams;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ParsedUrlCallbackType = (parsedData: ParsedUrlDataType) => void;
|
export type ParsedUrlCallbackType = (parsedData: ParsedUrlDataType) => void;
|
||||||
|
@ -41,10 +46,6 @@ export default class URLHandler {
|
||||||
|
|
||||||
static EVENT_INFO_URL_PATH = 'event';
|
static EVENT_INFO_URL_PATH = 'event';
|
||||||
|
|
||||||
static CLUB_INFO_ROUTE = 'club-information';
|
|
||||||
|
|
||||||
static EVENT_INFO_ROUTE = 'planning-information';
|
|
||||||
|
|
||||||
onInitialURLParsed: ParsedUrlCallbackType;
|
onInitialURLParsed: ParsedUrlCallbackType;
|
||||||
|
|
||||||
onDetectURL: ParsedUrlCallbackType;
|
onDetectURL: ParsedUrlCallbackType;
|
||||||
|
@ -152,8 +153,11 @@ export default class URLHandler {
|
||||||
const id = parseInt(params.id, 10);
|
const id = parseInt(params.id, 10);
|
||||||
if (!Number.isNaN(id)) {
|
if (!Number.isNaN(id)) {
|
||||||
return {
|
return {
|
||||||
route: URLHandler.CLUB_INFO_ROUTE,
|
route: MainRoutes.ClubInformation,
|
||||||
data: { clubId: id.toString() },
|
data: {
|
||||||
|
type: 'id',
|
||||||
|
clubId: id,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,8 +177,11 @@ export default class URLHandler {
|
||||||
const id = parseInt(params.id, 10);
|
const id = parseInt(params.id, 10);
|
||||||
if (!Number.isNaN(id)) {
|
if (!Number.isNaN(id)) {
|
||||||
return {
|
return {
|
||||||
route: URLHandler.EVENT_INFO_ROUTE,
|
route: MainRoutes.PlanningInformation,
|
||||||
data: { eventId: id.toString() },
|
data: {
|
||||||
|
type: 'id',
|
||||||
|
eventId: id,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue