Prevent empty flicker on best view - 1.122 - 1.123

Closes #148
This commit is contained in:
Brandon 2023-02-04 15:07:56 -07:00 committed by Brandon Presley
parent 1a75d8897d
commit a03731c6ff
3 changed files with 13 additions and 13 deletions

View File

@ -16,8 +16,8 @@ import Volume from './volume'
export default function ViewBest() {
const {params} = useRoute<RouteProp<BestPageParams, 'ViewBest'>>()
const [weights, setWeights] = useState<GymSet[]>([])
const [volumes, setVolumes] = useState<Volume[]>([])
const [weights, setWeights] = useState<GymSet[]>()
const [volumes, setVolumes] = useState<Volume[]>()
const [metric, setMetric] = useState(Metrics.Weight)
const [period, setPeriod] = useState(Periods.Monthly)
@ -64,12 +64,12 @@ export default function ViewBest() {
const charts = useMemo(() => {
if (
(metric === Metrics.Volume && volumes.length === 0) ||
(metric === Metrics.Weight && weights.length === 0) ||
(metric === Metrics.OneRepMax && weights.length === 0)
(metric === Metrics.Volume && volumes?.length === 0) ||
(metric === Metrics.Weight && weights?.length === 0) ||
(metric === Metrics.OneRepMax && weights?.length === 0)
)
return <List.Item title="No data yet." />
if (metric === Metrics.Volume)
if (metric === Metrics.Volume && volumes?.length && weights?.length)
return (
<Chart
yData={volumes.map(v => v.value)}
@ -87,11 +87,11 @@ export default function ViewBest() {
return (
<Chart
yData={weights.map(set => set.weight)}
yFormat={value => `${value}${weights[0].unit}`}
xData={weights}
yData={weights?.map(set => set.weight) || []}
yFormat={value => `${value}${weights?.[0].unit}`}
xData={weights || []}
xFormat={(_value, index) =>
format(new Date(weights[index].created), 'd/M')
format(new Date(weights?.[index].created), 'd/M')
}
/>
)

View File

@ -41,8 +41,8 @@ android {
missingDimensionStrategy "RNNotifications.reactNativeVersion", "reactNative60"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 36145
versionName "1.119"
versionCode 36149
versionName "1.123"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {

View File

@ -1,6 +1,6 @@
{
"name": "massive",
"version": "1.119",
"version": "1.123",
"private": true,
"license": "GPL-3.0-only",
"scripts": {