Organize all imports

This commit is contained in:
Brandon Presley 2023-11-12 17:05:37 +13:00
parent 901cc72fbd
commit ef63fcf470
30 changed files with 62 additions and 109 deletions

View File

@ -8,18 +8,18 @@ import { useColorScheme } from "react-native";
import {
MD3DarkTheme as PaperDarkTheme,
MD3LightTheme as PaperDefaultTheme,
Provider as PaperProvider,
ProgressBar,
Provider as PaperProvider,
Snackbar,
} from "react-native-paper";
import MaterialIcon from "react-native-vector-icons/MaterialCommunityIcons";
import AppStack from "./AppStack";
import { AppDataSource } from "./data-source";
import { settingsRepo } from "./db";
import { emitter } from "./emitter";
import { TickEvent } from "./TimerPage";
import { TOAST } from "./toast";
import { ThemeContext } from "./use-theme";
import AppStack from "./AppStack";
import { TickEvent } from "./TimerPage";
export const CombinedDefaultTheme = {
...NavigationDefaultTheme,

View File

@ -1,15 +1,15 @@
import { createDrawerNavigator } from "@react-navigation/drawer";
import { IconButton } from "react-native-paper";
import { DrawerParams } from "./drawer-param-list";
import ExerciseList from "./ExerciseList";
import GraphsList from "./GraphsList";
import InsightsPage from "./InsightsPage";
import PlanList from "./PlanList";
import SetList from "./SetList";
import SettingsPage from "./SettingsPage";
import TimerPage from "./TimerPage";
import WeightList from "./WeightList";
import ExerciseList from "./ExerciseList";
import { DrawerParams } from "./drawer-param-list";
import useDark from "./use-dark";
import WeightList from "./WeightList";
const Drawer = createDrawerNavigator<DrawerParams>();

View File

@ -1,18 +1,18 @@
import { createStackNavigator } from "@react-navigation/stack";
import AppDrawer from "./AppDrawer";
import EditExercise from "./EditExercise";
import EditExercises from "./EditExercises";
import EditPlan from "./EditPlan";
import EditSet from "./EditSet";
import EditSets from "./EditSets";
import EditWeight from "./EditWeight";
import EditExercise from "./EditExercise";
import EditExercises from "./EditExercises";
import StartPlan from "./StartPlan";
import ViewGraph from "./ViewGraph";
import ViewWeightGraph from "./ViewWeightGraph";
import GymSet from "./gym-set";
import { Plan } from "./plan";
import Weight from "./weight";
import StartPlan from "./StartPlan";
import ViewGraph from "./ViewGraph";
import ViewSetList from "./ViewSetList";
import ViewWeightGraph from "./ViewWeightGraph";
import Weight from "./weight";
export type StackParams = {
Drawer: {};

View File

@ -10,17 +10,16 @@ import { ScrollView, TextInput, View } from "react-native";
import DocumentPicker from "react-native-document-picker";
import { Button, Card, TouchableRipple } from "react-native-paper";
import AppInput from "./AppInput";
import { StackParams } from "./AppStack";
import ConfirmDialog from "./ConfirmDialog";
import { MARGIN, PADDING } from "./constants";
import { getNow, planRepo, setRepo, settingsRepo } from "./db";
import { emitter } from "./emitter";
import { DrawerParams } from "./drawer-param-list";
import { fixNumeric } from "./fix-numeric";
import GymSet, { defaultSet, GYM_SET_CREATED } from "./gym-set";
import GymSet, { defaultSet } from "./gym-set";
import Settings from "./settings";
import StackHeader from "./StackHeader";
import { toast } from "./toast";
import { DrawerParams } from "./drawer-param-list";
import { StackParams } from "./AppStack";
export default function EditExercise() {
const { params } = useRoute<RouteProp<StackParams, "EditExercise">>();

View File

@ -14,13 +14,11 @@ import AppInput from "./AppInput";
import ConfirmDialog from "./ConfirmDialog";
import { MARGIN, PADDING } from "./constants";
import { planRepo, setRepo, settingsRepo } from "./db";
import { emitter } from "./emitter";
import { ExercisesPageParams } from "./ExercisesPage";
import { fixNumeric } from "./fix-numeric";
import { GYM_SET_CREATED } from "./gym-set";
import Settings from "./settings";
import StackHeader from "./StackHeader";
import { toast } from "./toast";
import { ExercisesPageParams } from "./ExercisesPage";
export default function EditExercises() {
const { params } =

View File

@ -17,13 +17,13 @@ import ReorderableList, {
} from "react-native-reorderable-list";
import AppInput from "./AppInput";
import { StackParams } from "./AppStack";
import StackHeader from "./StackHeader";
import Switch from "./Switch";
import { MARGIN, PADDING } from "./constants";
import { DAYS } from "./days";
import { planRepo, setRepo } from "./db";
import { DrawerParams } from "./drawer-param-list";
import { defaultSet } from "./gym-set";
import StackHeader from "./StackHeader";
import Switch from "./Switch";
export default function EditPlan() {
const { params } = useRoute<RouteProp<StackParams, "EditPlan">>();

View File

@ -20,18 +20,13 @@ import {
import AppInput from "./AppInput";
import { StackParams } from "./AppStack";
import ConfirmDialog from "./ConfirmDialog";
import StackHeader from "./StackHeader";
import { MARGIN, PADDING } from "./constants";
import { getNow, setRepo, settingsRepo } from "./db";
import { DrawerParams } from "./drawer-param-list";
import { emitter } from "./emitter";
import { fixNumeric } from "./fix-numeric";
import GymSet, {
GYM_SET_CREATED,
GYM_SET_DELETED,
GYM_SET_UPDATED,
} from "./gym-set";
import GymSet from "./gym-set";
import Settings from "./settings";
import StackHeader from "./StackHeader";
import { toast } from "./toast";
export default function EditSet() {

View File

@ -11,15 +11,14 @@ import DocumentPicker from "react-native-document-picker";
import { Button, Card, IconButton, TouchableRipple } from "react-native-paper";
import { In } from "typeorm";
import AppInput from "./AppInput";
import { StackParams } from "./AppStack";
import ConfirmDialog from "./ConfirmDialog";
import { MARGIN, PADDING } from "./constants";
import { setRepo, settingsRepo } from "./db";
import { emitter } from "./emitter";
import GymSet, { GYM_SET_CREATED } from "./gym-set";
import { DrawerParams } from "./drawer-param-list";
import GymSet from "./gym-set";
import Settings from "./settings";
import StackHeader from "./StackHeader";
import { StackParams } from "./AppStack";
import { DrawerParams } from "./drawer-param-list";
export default function EditSets() {
const { params } = useRoute<RouteProp<StackParams, "EditSets">>();

View File

@ -13,12 +13,12 @@ import { Button, IconButton } from "react-native-paper";
import AppInput from "./AppInput";
import { StackParams } from "./AppStack";
import ConfirmDialog from "./ConfirmDialog";
import StackHeader from "./StackHeader";
import { MARGIN, PADDING } from "./constants";
import { AppDataSource } from "./data-source";
import { getNow, settingsRepo, weightRepo } from "./db";
import { DrawerParams } from "./drawer-param-list";
import Settings from "./settings";
import StackHeader from "./StackHeader";
import { toast } from "./toast";
import Weight from "./weight";

View File

@ -2,11 +2,10 @@ import { NavigationProp, useNavigation } from "@react-navigation/native";
import { useCallback, useMemo } from "react";
import { Image } from "react-native";
import { List } from "react-native-paper";
import { DARK_RIPPLE } from "./constants";
import { LIGHT_RIPPLE } from "./constants";
import { DARK_RIPPLE, LIGHT_RIPPLE } from "./constants";
import { ExercisesPageParams } from "./ExercisesPage";
import GymSet from "./gym-set";
import useDark from "./use-dark";
import { ExercisesPageParams } from "./ExercisesPage";
export default function ExerciseItem({
item,

View File

@ -8,14 +8,14 @@ import { FlatList } from "react-native";
import { List } from "react-native-paper";
import { In } from "typeorm";
import { StackParams } from "./AppStack";
import { LIMIT } from "./constants";
import { setRepo, settingsRepo } from "./db";
import DrawerHeader from "./DrawerHeader";
import ExerciseItem from "./ExerciseItem";
import GymSet from "./gym-set";
import ListMenu from "./ListMenu";
import Page from "./Page";
import SetList from "./SetList";
import { LIMIT } from "./constants";
import { setRepo, settingsRepo } from "./db";
import GymSet from "./gym-set";
import Settings from "./settings";
export default function ExerciseList() {

View File

@ -1,8 +1,8 @@
import { createStackNavigator } from "@react-navigation/stack";
import EditExercise from "./EditExercise";
import EditExercises from "./EditExercises";
import GymSet from "./gym-set";
import ExerciseList from "./ExerciseList";
import GymSet from "./gym-set";
export type ExercisesPageParams = {
ExerciseList: {

View File

@ -6,13 +6,13 @@ import {
import { useCallback, useState } from "react";
import { FlatList, Image } from "react-native";
import { List } from "react-native-paper";
import DrawerHeader from "./DrawerHeader";
import { GraphsPageParams } from "./GraphsPage";
import Page from "./Page";
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";
export default function GraphsList() {

View File

@ -1,6 +1,5 @@
import { createStackNavigator } from "@react-navigation/stack";
import GraphsList from "./GraphsList";
import ViewGraph from "./ViewGraph";
const Stack = createStackNavigator<GraphsPageParams>();
export type GraphsPageParams = {

View File

@ -5,12 +5,12 @@ import { IconButton, Text } from "react-native-paper";
import AppPieChart from "./AppPieChart";
import Chart from "./Chart";
import ConfirmDialog from "./ConfirmDialog";
import DrawerHeader from "./DrawerHeader";
import Select from "./Select";
import { MARGIN, PADDING } from "./constants";
import { AppDataSource } from "./data-source";
import { Periods } from "./periods";
import { DAYS } from "./days";
import DrawerHeader from "./DrawerHeader";
import { Periods } from "./periods";
import Select from "./Select";
interface WeekCount {
week: string;

View File

@ -6,13 +6,13 @@ import {
import { useCallback, useMemo, useState } from "react";
import { Text } from "react-native";
import { List } from "react-native-paper";
import { StackParams } from "./AppStack";
import { DARK_RIPPLE, LIGHT_RIPPLE } from "./constants";
import { DAYS } from "./days";
import { setRepo } from "./db";
import { defaultSet } from "./gym-set";
import { Plan } from "./plan";
import { DAYS } from "./days";
import useDark from "./use-dark";
import { StackParams } from "./AppStack";
export default function PlanItem({
item,

View File

@ -7,13 +7,13 @@ import { useCallback, useState } from "react";
import { FlatList } from "react-native";
import { List } from "react-native-paper";
import { Like } from "typeorm";
import { StackParams } from "./AppStack";
import { planRepo } from "./db";
import DrawerHeader from "./DrawerHeader";
import ListMenu from "./ListMenu";
import Page from "./Page";
import { Plan } from "./plan";
import PlanItem from "./PlanItem";
import { StackParams } from "./AppStack";
export default function PlanList() {
const [term, setTerm] = useState("");

View File

@ -3,11 +3,11 @@ import { format } from "date-fns";
import { useCallback, useMemo } from "react";
import { Image } from "react-native";
import { List, Text } from "react-native-paper";
import { StackParams } from "./AppStack";
import { DARK_RIPPLE, LIGHT_RIPPLE } from "./constants";
import GymSet from "./gym-set";
import Settings from "./settings";
import useDark from "./use-dark";
import { StackParams } from "./AppStack";
export default function SetItem({
item,

View File

@ -8,13 +8,13 @@ import { FlatList } from "react-native";
import { List } from "react-native-paper";
import { Like } from "typeorm";
import { StackParams } from "./AppStack";
import { LIMIT } from "./constants";
import { getNow, setRepo, settingsRepo } from "./db";
import DrawerHeader from "./DrawerHeader";
import GymSet, { defaultSet } from "./gym-set";
import ListMenu from "./ListMenu";
import Page from "./Page";
import SetItem from "./SetItem";
import { LIMIT } from "./constants";
import { getNow, setRepo, settingsRepo } from "./db";
import GymSet, { defaultSet } from "./gym-set";
import Settings from "./settings";
export default function SetList() {

View File

@ -6,20 +6,20 @@ import { NativeModules, ScrollView } from "react-native";
import DocumentPicker from "react-native-document-picker";
import { Dirs, FileSystem } from "react-native-file-access";
import { Button } from "react-native-paper";
import { PERMISSIONS, RESULTS, check, request } from "react-native-permissions";
import { check, PERMISSIONS, request, RESULTS } from "react-native-permissions";
import AppInput from "./AppInput";
import ConfirmDialog from "./ConfirmDialog";
import DrawerHeader from "./DrawerHeader";
import Page from "./Page";
import Select from "./Select";
import Switch from "./Switch";
import { MARGIN } from "./constants";
import { AppDataSource } from "./data-source";
import { setRepo, settingsRepo } from "./db";
import { DrawerParams } from "./drawer-param-list";
import DrawerHeader from "./DrawerHeader";
import Input from "./input";
import { darkOptions, lightOptions, themeOptions } from "./options";
import Page from "./Page";
import Select from "./Select";
import Settings from "./settings";
import Switch from "./Switch";
import { toast } from "./toast";
import { useTheme } from "./use-theme";

View File

@ -9,19 +9,18 @@ import { useCallback, useMemo, useRef, useState } from "react";
import { FlatList, NativeModules, TextInput, View } from "react-native";
import { Button, IconButton, ProgressBar } from "react-native-paper";
import AppInput from "./AppInput";
import { StackParams } from "./AppStack";
import { getBestSet } from "./best.service";
import { PADDING } from "./constants";
import CountMany from "./count-many";
import { AppDataSource } from "./data-source";
import { getNow, setRepo, settingsRepo } from "./db";
import { emitter } from "./emitter";
import { fixNumeric } from "./fix-numeric";
import GymSet, { GYM_SET_CREATED } from "./gym-set";
import GymSet from "./gym-set";
import Settings from "./settings";
import StackHeader from "./StackHeader";
import StartPlanItem from "./StartPlanItem";
import { toast } from "./toast";
import { StackParams } from "./AppStack";
export default function StartPlan() {
const { params } = useRoute<RouteProp<StackParams, "StartPlan">>();

View File

@ -6,9 +6,6 @@ import { Like } from "typeorm";
import { StackParams } from "./AppStack";
import CountMany from "./count-many";
import { getNow, setRepo } from "./db";
import { DrawerParams } from "./drawer-param-list";
import { emitter } from "./emitter";
import { GYM_SET_DELETED } from "./gym-set";
import { toast } from "./toast";
interface Props extends ListRenderItemInfo<CountMany> {

View File

@ -4,10 +4,10 @@ import { NativeModules, View } from "react-native";
import { FAB, Text, useTheme } from "react-native-paper";
import { ProgressCircle } from "react-native-svg-charts";
import AppFab from "./AppFab";
import DrawerHeader from "./DrawerHeader";
import { darkenRgba } from "./colors";
import { MARGIN, PADDING } from "./constants";
import { settingsRepo } from "./db";
import DrawerHeader from "./DrawerHeader";
import Settings from "./settings";
import useTimer from "./use-timer";

View File

@ -1,4 +1,5 @@
import { RouteProp, useRoute } from "@react-navigation/native";
import { format } from "date-fns";
import { useEffect, useMemo, useState } from "react";
import { View } from "react-native";
import { FileSystem } from "react-native-file-access";
@ -6,16 +7,15 @@ import { IconButton, List } from "react-native-paper";
import Share from "react-native-share";
import { captureScreen } from "react-native-view-shot";
import Chart from "./Chart";
import { GraphsPageParams } from "./GraphsPage";
import Select from "./Select";
import StackHeader from "./StackHeader";
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 { format } from "date-fns";
export default function ViewGraph() {
const { params } = useRoute<RouteProp<GraphsPageParams, "ViewGraph">>();

View File

@ -4,12 +4,12 @@ import { FlatList } from "react-native";
import { List, useTheme } from "react-native-paper";
import { Like } from "typeorm";
import { StackParams } from "./AppStack";
import SetItem from "./SetItem";
import StackHeader from "./StackHeader";
import { LIMIT } from "./constants";
import { setRepo, settingsRepo } from "./db";
import GymSet from "./gym-set";
import SetItem from "./SetItem";
import Settings from "./settings";
import StackHeader from "./StackHeader";
interface ColorSet extends GymSet {
color?: string;

View File

@ -1,6 +1,4 @@
import { createStackNavigator } from "@react-navigation/stack";
import EditWeight from "./EditWeight";
import ViewWeightGraph from "./ViewWeightGraph";
import Weight from "./weight";
import WeightList from "./WeightList";

View File

@ -27,12 +27,12 @@ import { splitColor1669420187764 } from "./migrations/1669420187764-split-color"
import { addBackup1678334268359 } from "./migrations/1678334268359-add-backup";
import { planTitle1692654882408 } from "./migrations/1692654882408-plan-title";
import { weight1697766633971 } from "./migrations/1697766633971-weight";
import { Plan } from "./plan";
import Settings from "./settings";
import Weight from "./weight";
import { exercises1699508495726 } from "./migrations/1699508495726-exercises";
import { exercisesFix1699613077628 } from "./migrations/1699613077628-exercises-fix";
import { settingsDuration1699743753975 } from "./migrations/1699743753975-settings-duration";
import { Plan } from "./plan";
import Settings from "./settings";
import Weight from "./weight";
export const AppDataSource = new DataSource({
type: "react-native",

View File

@ -1,30 +0,0 @@
import { NavigationContainer } from "@react-navigation/native";
import React from "react";
import {
DefaultTheme,
MD3DarkTheme,
Provider as PaperProvider,
} from "react-native-paper";
import MaterialIcon from "react-native-vector-icons/MaterialIcons";
import { ThemeContext } from "./use-theme";
export const MockProviders = ({
children,
}: {
children: JSX.Element | JSX.Element[];
}) => (
<PaperProvider settings={{ icon: (props) => <MaterialIcon {...props} /> }}>
<ThemeContext.Provider
value={{
theme: "system",
setTheme: jest.fn(),
lightColor: DefaultTheme.colors.primary,
darkColor: MD3DarkTheme.colors.primary,
setLightColor: jest.fn(),
setDarkColor: jest.fn(),
}}
>
<NavigationContainer>{children}</NavigationContainer>
</ThemeContext.Provider>
</PaperProvider>
);

View File

@ -1,3 +1,3 @@
#!/bin/sh
organize-imports-cli *.ts* tests/*.ts* && deno fmt *.ts* tests/*.ts*
organize-imports-cli *.ts* && prettier --write *.ts*

View File

@ -1,8 +1,8 @@
import { useFocusEffect } from "@react-navigation/native";
import { useCallback, useState } from "react";
import { NativeModules } from "react-native";
import { emitter } from "./emitter";
import { TickEvent } from "./TimerPage";
import { NativeModules } from "react-native";
export default function useTimer() {
const [minutes, setMinutes] = useState("00");