Split out some type definitions into their own files

This commit is contained in:
Brandon Presley 2022-09-24 18:47:31 +12:00
parent 927e48ab2f
commit 39fafa353f
14 changed files with 38 additions and 33 deletions

View File

@ -12,18 +12,11 @@ import {
Provider,
} from 'react-native-paper';
import Ionicon from 'react-native-vector-icons/Ionicons';
import {DrawerParamList} from './drawer-param-list';
import MassiveSnack from './MassiveSnack';
import Routes from './Routes';
export const Drawer = createDrawerNavigator<DrawerParamList>();
export type DrawerParamList = {
Home: {};
Settings: {};
Best: {};
Plans: {};
Workouts: {};
Loading: {};
};
export const CombinedDefaultTheme = {
...NavigationDefaultTheme,

View File

@ -3,8 +3,8 @@ import {useNavigation} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import React from 'react';
import {IconButton} from 'react-native-paper';
import {DrawerParamList} from './App';
import BestList from './BestList';
import {DrawerParamList} from './drawer-param-list';
import Set from './set';
import ViewBest from './ViewBest';

View File

@ -3,8 +3,8 @@ import React, {useCallback, useContext, useState} from 'react';
import DocumentPicker from 'react-native-document-picker';
import {FileSystem} from 'react-native-file-access';
import {Divider, IconButton, Menu} from 'react-native-paper';
import {DrawerParamList} from './App';
import ConfirmDialog from './ConfirmDialog';
import {DrawerParamList} from './drawer-param-list';
import {SnackbarContext} from './MassiveSnack';
import {Plan} from './plan';
import {addPlans, deletePlans, getAllPlans} from './plan.service';

View File

@ -8,8 +8,8 @@ import {
import React, {useCallback, useEffect, useState} from 'react';
import {ScrollView, StyleSheet, Text, View} from 'react-native';
import {Button, IconButton} from 'react-native-paper';
import {DrawerParamList} from './App';
import {MARGIN, PADDING} from './constants';
import {DrawerParamList} from './drawer-param-list';
import MassiveSwitch from './MassiveSwitch';
import {addPlan, updatePlan} from './plan.service';
import {PlanPageParams} from './PlanPage';

View File

@ -8,7 +8,7 @@ import React, {useCallback, useContext} from 'react';
import {NativeModules, View} from 'react-native';
import {IconButton} from 'react-native-paper';
import {PADDING} from './constants';
import {HomePageParams} from './HomePage';
import {HomePageParams} from './home-page-params';
import {SnackbarContext} from './MassiveSnack';
import Set from './set';
import {addSet, updateSet} from './set.service';

View File

@ -3,19 +3,12 @@ import {useNavigation} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import React from 'react';
import {IconButton} from 'react-native-paper';
import {DrawerParamList} from './App';
import {DrawerParamList} from './drawer-param-list';
import EditSet from './EditSet';
import Set from './set';
import {HomePageParams} from './home-page-params';
import SetList from './SetList';
const Stack = createStackNavigator<HomePageParams>();
export type HomePageParams = {
Sets: {};
EditSet: {
set: Set;
workouts: string[];
};
};
export default function HomePage() {
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();

View File

@ -3,18 +3,12 @@ import {useNavigation} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import React from 'react';
import {IconButton} from 'react-native-paper';
import {DrawerParamList} from './App';
import {DrawerParamList} from './drawer-param-list';
import EditPlan from './EditPlan';
import {Plan} from './plan';
import {PlanPageParams} from './plan-page-params';
import PlanList from './PlanList';
const Stack = createStackNavigator<PlanPageParams>();
export type PlanPageParams = {
PlanList: {};
EditPlan: {
plan: Plan;
};
};
export default function PlanPage() {
const navigation = useNavigation<DrawerNavigationProp<DrawerParamList>>();

View File

@ -2,7 +2,7 @@ import {NavigationProp, useNavigation} from '@react-navigation/native';
import React, {useCallback, useState} from 'react';
import {GestureResponderEvent, Image} from 'react-native';
import {Divider, List, Menu, Text} from 'react-native-paper';
import {HomePageParams} from './HomePage';
import {HomePageParams} from './home-page-params';
import Set from './set';
import {deleteSet} from './set.service';

View File

@ -8,7 +8,7 @@ import {FlatList} from 'react-native';
import {List} from 'react-native-paper';
import {getBestSet} from './best.service';
import DrawerMenu from './DrawerMenu';
import {HomePageParams} from './HomePage';
import {HomePageParams} from './home-page-params';
import Page from './Page';
import {getTodaysPlan} from './plan.service';
import Set from './set';

View File

@ -3,7 +3,7 @@ import {useNavigation} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import React from 'react';
import {IconButton} from 'react-native-paper';
import {DrawerParamList} from './App';
import {DrawerParamList} from './drawer-param-list';
import EditWorkout from './EditWorkout';
import Set from './set';
import WorkoutList from './WorkoutList';

8
drawer-param-list.ts Normal file
View File

@ -0,0 +1,8 @@
export type DrawerParamList = {
Home: {};
Settings: {};
Best: {};
Plans: {};
Workouts: {};
Loading: {};
};

9
home-page-params.ts Normal file
View File

@ -0,0 +1,9 @@
import Set from './set';
export type HomePageParams = {
Sets: {};
EditSet: {
set: Set;
workouts: string[];
};
};

8
plan-page-params.ts Normal file
View File

@ -0,0 +1,8 @@
import {Plan} from './plan';
export type PlanPageParams = {
PlanList: {};
EditPlan: {
plan: Plan;
};
};

View File

@ -1,4 +1,4 @@
import {DrawerParamList} from './App';
import {DrawerParamList} from './drawer-param-list';
export default interface Route {
name: keyof DrawerParamList;