diff --git a/BatteryDialog.tsx b/BatteryDialog.tsx index 02d9d31..3972446 100644 --- a/BatteryDialog.tsx +++ b/BatteryDialog.tsx @@ -22,7 +22,9 @@ export default function BatteryDialog({ Disable battery optimizations for Massive to use rest timers. - Settings > Battery > Unrestricted + + Settings {'>'} Battery {'>'} Unrestricted + diff --git a/BestPage.tsx b/BestPage.tsx index 9d89f3e..294c958 100644 --- a/BestPage.tsx +++ b/BestPage.tsx @@ -39,11 +39,11 @@ export default function BestPage() { newBest = newBest.concat(reps.rows.raw()); } setBests(newBest); - }, [search]); + }, [search, db]); useEffect(() => { refresh(); - }, [search]); + }, [search, refresh]); const renderItem = ({item}: {item: Best}) => ( void; onDelete: () => void; - onAdd: () => void; selected: string; index: number; }) { const [show, setShow] = useState(false); - const add = () => { - onAdd(); - setShow(false); - }; - const select = (day: string) => { onSelect(day); setShow(false); diff --git a/EditPlan.tsx b/EditPlan.tsx index 74f6b1a..bad3629 100644 --- a/EditPlan.tsx +++ b/EditPlan.tsx @@ -40,7 +40,7 @@ export default function EditPlan({ setWorkouts(plan.workouts.split(',')); }; refresh(); - }, [plan]); + }, [plan, db]); const save = async () => { if (!days || !workouts) return; diff --git a/HomePage.tsx b/HomePage.tsx index 8cb5e42..be511eb 100644 --- a/HomePage.tsx +++ b/HomePage.tsx @@ -8,7 +8,7 @@ import MassiveFab from './MassiveFab'; import Set from './set'; import SetItem from './SetItem'; -const limit = 10; +const limit = 15; export default function HomePage() { const [sets, setSets] = useState(); @@ -33,7 +33,7 @@ export default function HomePage() { setSets(result.rows.raw()); setOffset(0); setEnd(false); - }, [search]); + }, [search, db, selectSets]); const refreshLoader = async () => { setRefresing(true); @@ -42,7 +42,7 @@ export default function HomePage() { useEffect(() => { refresh(); - }, [search]); + }, [search, refresh]); const renderItem = ({item}: {item: Set}) => ( @@ -62,7 +62,7 @@ export default function HomePage() { if (end) return; setRefresing(true); const newOffset = offset + limit; - console.log(`${HomePage.name}.${next.name}:`, { + console.log(`${HomePage.name}.next:`, { offset, limit, newOffset, @@ -76,7 +76,7 @@ export default function HomePage() { setSets([...sets, ...result.rows.raw()]); if (result.rows.length < limit) return setEnd(true); setOffset(newOffset); - }, [search, end, offset]); + }, [search, end, offset, sets, db, selectSets]); return ( diff --git a/SetItem.tsx b/SetItem.tsx index e069dfa..bb882a9 100644 --- a/SetItem.tsx +++ b/SetItem.tsx @@ -1,6 +1,6 @@ import React, {useContext, useState} from 'react'; -import {GestureResponderEvent, Text, View} from 'react-native'; -import {IconButton, List, Menu} from 'react-native-paper'; +import {GestureResponderEvent} from 'react-native'; +import {List, Menu} from 'react-native-paper'; import {DatabaseContext} from './App'; import Set from './set'; diff --git a/ViewBest.tsx b/ViewBest.tsx index 2399478..e09928a 100644 --- a/ViewBest.tsx +++ b/ViewBest.tsx @@ -1,10 +1,10 @@ +import * as shape from 'd3-shape'; import React, {useContext, useEffect, useState} from 'react'; -import {useColorScheme, View} from 'react-native'; +import {View} from 'react-native'; import {Button, Dialog, Portal} from 'react-native-paper'; +import {Grid, LineChart, YAxis} from 'react-native-svg-charts'; import {DatabaseContext} from './App'; import Best from './best'; -import {AreaChart, Grid, LineChart, YAxis} from 'react-native-svg-charts'; -import * as shape from 'd3-shape'; export default function ViewBest({ best, @@ -14,10 +14,8 @@ export default function ViewBest({ setBest: (best?: Best) => void; }) { const [data, setData] = useState([]); - const [labels, setLabels] = useState([]); const [unit, setUnit] = useState(); const db = useContext(DatabaseContext); - const dark = useColorScheme() === 'dark'; useEffect(() => { const selectBest = ` diff --git a/WorkoutMenu.tsx b/WorkoutMenu.tsx index 06a19e0..aa39728 100644 --- a/WorkoutMenu.tsx +++ b/WorkoutMenu.tsx @@ -1,29 +1,21 @@ -import {useState} from 'react'; -import React from 'react'; -import {Button, Divider, Menu} from 'react-native-paper'; +import React, {useState} from 'react'; +import {Button, Menu} from 'react-native-paper'; export default function DayMenu({ onSelect, onDelete, - onAdd, selected, index, names, }: { onSelect: (option: string) => void; onDelete: () => void; - onAdd: () => void; selected: string; index: number; names: string[]; }) { const [show, setShow] = useState(false); - const add = () => { - onAdd(); - setShow(false); - }; - const select = (day: string) => { onSelect(day); setShow(false); diff --git a/package.json b/package.json index 458be36..82868fd 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "ios": "react-native run-ios", "start": "react-native start", "test": "jest", - "lint": "eslint . --ext .js,.jsx,.ts,.tsx" + "lint": "eslint . --ext .js,.jsx,.ts,.tsx --quiet" }, "dependencies": { "@babel/preset-env": "^7.1.6", @@ -53,6 +53,12 @@ "react-test-renderer": "18.0.0", "typescript": "^4.4.4" }, + "eslintConfig": { + "extends": "react-app", + "rules": { + "curly": "off" + } + }, "resolutions": { "@types/react": "^18" },