diff --git a/EditExercises.tsx b/EditExercises.tsx index df622d5..2637172 100644 --- a/EditExercises.tsx +++ b/EditExercises.tsx @@ -11,18 +11,18 @@ import DocumentPicker from "react-native-document-picker"; import { Button, Card, TouchableRipple } from "react-native-paper"; import { In } from "typeorm"; import AppInput from "./AppInput"; +import { StackParams } from "./AppStack"; import ConfirmDialog from "./ConfirmDialog"; +import StackHeader from "./StackHeader"; import { MARGIN, PADDING } from "./constants"; import { planRepo, setRepo, settingsRepo } from "./db"; -import { ExercisesPageParams } from "./ExercisesPage"; +import { DrawerParams } from "./drawer-param-list"; import { fixNumeric } from "./fix-numeric"; import Settings from "./settings"; -import StackHeader from "./StackHeader"; import { toast } from "./toast"; export default function EditExercises() { - const { params } = - useRoute>(); + const { params } = useRoute>(); const [removeImage, setRemoveImage] = useState(false); const [showRemove, setShowRemove] = useState(false); const [name, setName] = useState(""); @@ -36,7 +36,7 @@ export default function EditExercises() { const [oldSeconds, setOldSeconds] = useState(""); const [sets, setSets] = useState(""); const [oldSets, setOldSets] = useState(""); - const navigation = useNavigation>(); + const navigation = useNavigation>(); const setsRef = useRef(null); const stepsRef = useRef(null); const minutesRef = useRef(null); @@ -85,7 +85,7 @@ export default function EditExercises() { .where("exercises LIKE :name", { name: `%${oldName}%` }) .execute(); } - navigation.navigate("ExerciseList", { clearNames: true }); + navigation.navigate("Exercises"); }; const changeImage = useCallback(async () => { diff --git a/ExerciseItem.tsx b/ExerciseItem.tsx index 49b555d..7b7f5af 100644 --- a/ExerciseItem.tsx +++ b/ExerciseItem.tsx @@ -3,9 +3,9 @@ import { useCallback, useMemo } from "react"; import { Image } from "react-native"; import { List } from "react-native-paper"; import { DARK_RIPPLE, LIGHT_RIPPLE } from "./constants"; -import { ExercisesPageParams } from "./ExercisesPage"; import GymSet from "./gym-set"; import useDark from "./use-dark"; +import { StackParams } from "./AppStack"; export default function ExerciseItem({ item, @@ -20,7 +20,7 @@ export default function ExerciseItem({ names: string[]; alarm: boolean; }) { - const navigation = useNavigation>(); + const navigation = useNavigation>(); const dark = useDark(); const description = useMemo(() => { diff --git a/ExercisesPage.tsx b/ExercisesPage.tsx deleted file mode 100644 index 3c06739..0000000 --- a/ExercisesPage.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { createStackNavigator } from "@react-navigation/stack"; -import EditExercise from "./EditExercise"; -import EditExercises from "./EditExercises"; -import ExerciseList from "./ExerciseList"; -import GymSet from "./gym-set"; - -export type ExercisesPageParams = { - ExerciseList: { - clearNames?: boolean; - search?: string; - update?: GymSet; - reset?: number; - }; - EditExercise: { - gymSet: GymSet; - }; - EditExercises: { - names: string[]; - }; -}; - -const Stack = createStackNavigator(); - -export default function ExercisesPage() { - return ( - - - - - - ); -} diff --git a/GraphsList.tsx b/GraphsList.tsx index f78464d..db50131 100644 --- a/GraphsList.tsx +++ b/GraphsList.tsx @@ -10,17 +10,17 @@ import { getBestSets } from "./best.service"; import { LIMIT } from "./constants"; import { settingsRepo } from "./db"; import DrawerHeader from "./DrawerHeader"; -import { GraphsPageParams } from "./GraphsPage"; import GymSet from "./gym-set"; import Page from "./Page"; import Settings from "./settings"; +import { StackParams } from "./AppStack"; export default function GraphsList() { const [bests, setBests] = useState(); const [offset, setOffset] = useState(0); const [end, setEnd] = useState(false); const [term, setTerm] = useState(""); - const navigation = useNavigation>(); + const navigation = useNavigation>(); const [settings, setSettings] = useState(); const [refreshing, setRefreshing] = useState(false); diff --git a/GraphsPage.tsx b/GraphsPage.tsx deleted file mode 100644 index ce8be99..0000000 --- a/GraphsPage.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createStackNavigator } from "@react-navigation/stack"; -import GraphsList from "./GraphsList"; - -const Stack = createStackNavigator(); -export type GraphsPageParams = { - GraphsList: {}; - ViewGraph: { - name: string; - }; -}; - -export default function GraphsPage() { - return ( - - - - ); -} diff --git a/ViewGraph.tsx b/ViewGraph.tsx index 0ee28bc..f3e2ec9 100644 --- a/ViewGraph.tsx +++ b/ViewGraph.tsx @@ -9,16 +9,16 @@ import { captureScreen } from "react-native-view-shot"; import Chart from "./Chart"; import { PADDING } from "./constants"; import { setRepo } from "./db"; -import { GraphsPageParams } from "./GraphsPage"; import GymSet from "./gym-set"; import { Metrics } from "./metrics"; import { Periods } from "./periods"; import Select from "./Select"; import StackHeader from "./StackHeader"; import Volume from "./volume"; +import { StackParams } from "./AppStack"; export default function ViewGraph() { - const { params } = useRoute>(); + const { params } = useRoute>(); const [weights, setWeights] = useState(); const [volumes, setVolumes] = useState(); const [metric, setMetric] = useState(Metrics.OneRepMax); diff --git a/WeightItem.tsx b/WeightItem.tsx index 3ae9062..f5e6b89 100644 --- a/WeightItem.tsx +++ b/WeightItem.tsx @@ -4,7 +4,7 @@ import { useCallback, useMemo } from "react"; import { List, Text } from "react-native-paper"; import Settings from "./settings"; import Weight from "./weight"; -import { WeightPageParams } from "./WeightPage"; +import { StackParams } from "./AppStack"; export default function WeightItem({ item, @@ -13,7 +13,7 @@ export default function WeightItem({ item: Weight; settings: Settings; }) { - const navigation = useNavigation>(); + const navigation = useNavigation>(); const press = useCallback(() => { navigation.navigate("EditWeight", { weight: item }); diff --git a/WeightList.tsx b/WeightList.tsx index c7ee42e..567f006 100644 --- a/WeightList.tsx +++ b/WeightList.tsx @@ -14,7 +14,7 @@ import Page from "./Page"; import Settings from "./settings"; import { default as Weight, defaultWeight } from "./weight"; import WeightItem from "./WeightItem"; -import { WeightPageParams } from "./WeightPage"; +import { StackParams } from "./AppStack"; export default function WeightList() { const [refreshing, setRefreshing] = useState(false); @@ -22,7 +22,7 @@ export default function WeightList() { const [offset, setOffset] = useState(0); const [end, setEnd] = useState(false); const [settings, setSettings] = useState(); - const { navigate } = useNavigation>(); + const { navigate } = useNavigation>(); const [term, setTerm] = useState(""); const reset = useCallback( diff --git a/WeightPage.tsx b/WeightPage.tsx deleted file mode 100644 index a4e1fa1..0000000 --- a/WeightPage.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createStackNavigator } from "@react-navigation/stack"; -import Weight from "./weight"; -import WeightList from "./WeightList"; - -export type WeightPageParams = { - Weights: {}; - EditWeight: { - weight: Weight; - }; - ViewWeightGraph: {}; -}; - -const Stack = createStackNavigator(); - -export default function WeightPage() { - return ( - - - - ); -}