Add progress bar to plan items
Deploy this after using it for a day (on Sunday NZ time).
This commit is contained in:
parent
c70e9f5c69
commit
3a718142e5
|
@ -42,7 +42,7 @@ export default function StartPlan() {
|
||||||
.join(',')
|
.join(',')
|
||||||
console.log({questions, workouts})
|
console.log({questions, workouts})
|
||||||
const select = `
|
const select = `
|
||||||
SELECT workouts.name, COUNT(sets.id) as total
|
SELECT workouts.name, COUNT(sets.id) as total, sets.sets
|
||||||
FROM (select 0 as name, 0 as sequence union values ${questions}) as workouts
|
FROM (select 0 as name, 0 as sequence union values ${questions}) as workouts
|
||||||
LEFT JOIN sets ON sets.name = workouts.name
|
LEFT JOIN sets ON sets.name = workouts.name
|
||||||
AND sets.created LIKE STRFTIME('%Y-%m-%d%%', 'now', 'localtime')
|
AND sets.created LIKE STRFTIME('%Y-%m-%d%%', 'now', 'localtime')
|
||||||
|
|
|
@ -1,7 +1,14 @@
|
||||||
import {NavigationProp, useNavigation} from '@react-navigation/native'
|
import {NavigationProp, useNavigation} from '@react-navigation/native'
|
||||||
import React, {useCallback, useState} from 'react'
|
import React, {useCallback, useState} from 'react'
|
||||||
import {GestureResponderEvent, ListRenderItemInfo, View} from 'react-native'
|
import {GestureResponderEvent, ListRenderItemInfo, View} from 'react-native'
|
||||||
import {List, Menu, RadioButton, useTheme} from 'react-native-paper'
|
import {
|
||||||
|
List,
|
||||||
|
Menu,
|
||||||
|
ProgressBar,
|
||||||
|
RadioButton,
|
||||||
|
Text,
|
||||||
|
useTheme,
|
||||||
|
} from 'react-native-paper'
|
||||||
import {Like} from 'typeorm'
|
import {Like} from 'typeorm'
|
||||||
import CountMany from './count-many'
|
import CountMany from './count-many'
|
||||||
import {getNow, setRepo} from './db'
|
import {getNow, setRepo} from './db'
|
||||||
|
@ -66,7 +73,9 @@ export default function StartPlanItem(props: Props) {
|
||||||
<List.Item
|
<List.Item
|
||||||
onLongPress={longPress}
|
onLongPress={longPress}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
description={item.total.toString()}
|
description={
|
||||||
|
item.sets ? `${item.total} / ${item.sets}` : item.total.toString()
|
||||||
|
}
|
||||||
onPress={() => onSelect(index)}
|
onPress={() => onSelect(index)}
|
||||||
left={() => (
|
left={() => (
|
||||||
<View style={{alignItems: 'center', justifyContent: 'center'}}>
|
<View style={{alignItems: 'center', justifyContent: 'center'}}>
|
||||||
|
@ -79,7 +88,12 @@ export default function StartPlanItem(props: Props) {
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
right={() => (
|
right={() => (
|
||||||
<>
|
<View
|
||||||
|
style={{
|
||||||
|
width: '25%',
|
||||||
|
justifyContent: 'center',
|
||||||
|
}}>
|
||||||
|
{item.sets > 0 && <ProgressBar progress={item.total / item.sets} />}
|
||||||
<Menu
|
<Menu
|
||||||
anchor={anchor}
|
anchor={anchor}
|
||||||
visible={showMenu}
|
visible={showMenu}
|
||||||
|
@ -87,7 +101,7 @@ export default function StartPlanItem(props: Props) {
|
||||||
<Menu.Item icon="edit" onPress={edit} title="Edit" />
|
<Menu.Item icon="edit" onPress={edit} title="Edit" />
|
||||||
<Menu.Item icon="undo" onPress={undo} title="Undo" />
|
<Menu.Item icon="undo" onPress={undo} title="Undo" />
|
||||||
</Menu>
|
</Menu>
|
||||||
</>
|
</View>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user