Resolve "Stats"

This commit is contained in:
Maria Zadnepryanets
2020-12-20 19:11:03 +00:00
committed by bl00dymarie
parent d375645316
commit d25af176d3
5 changed files with 26 additions and 20 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ const Icon = createIconSetFromIcoMoon(iconConfig, '', 'Menu')
const MenuIcon = ({ isActive, name }) => { const MenuIcon = ({ isActive, name }) => {
const color = isActive ? Colors.greyDark : Colors.grey const color = isActive ? Colors.greyDark : Colors.grey
return <Icon name={name} size={Sizes.huge} color={color} /> return <Icon name={name} size={Sizes.icon} color={color} />
} }
MenuIcon.propTypes = { MenuIcon.propTypes = {
+3 -3
View File
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types'
import AppText from './app-text' import AppText from './app-text'
import { Spacing, Typography } from '../../styles' import { Sizes, Spacing, Typography } from '../../styles'
const Table = ({ tableContent }) => { const Table = ({ tableContent }) => {
return ( return (
@@ -56,11 +56,11 @@ Cell.propTypes = {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
accentOrange: { accentOrange: {
...Typography.accentOrange, ...Typography.accentOrange,
fontSize: 18, fontSize: Sizes.small,
}, },
accentPurpleBig: { accentPurpleBig: {
...Typography.accentPurpleBig, ...Typography.accentPurpleBig,
marginRight: Spacing.base, marginRight: Spacing.small,
}, },
cellLeft: { cellLeft: {
alignItems: 'flex-end', alignItems: 'flex-end',
+4 -1
View File
@@ -99,7 +99,7 @@ class Home extends Component {
{phase && ( {phase && (
<View style={styles.line}> <View style={styles.line}>
<Asterisk /> <Asterisk />
<AppText linkStyle={styles.whiteText}> <AppText linkStyle={styles.whiteText} style={styles.greyText}>
{statusText} {statusText}
</AppText> </AppText>
</View> </View>
@@ -147,6 +147,9 @@ const styles = StyleSheet.create({
}, },
whiteText: { whiteText: {
color: 'white', color: 'white',
},
greyText: {
color: Colors.greyLight,
} }
}) })
+16 -14
View File
@@ -1,5 +1,5 @@
import React from 'react' import React from 'react'
import { ImageBackground, StyleSheet, View } from 'react-native' import { Dimensions, ImageBackground, StyleSheet, View } from 'react-native'
import AppPage from './common/app-page' import AppPage from './common/app-page'
import AppText from './common/app-text' import AppText from './common/app-text'
@@ -10,9 +10,11 @@ import cycleModule from '../lib/cycle'
import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length' import {getCycleLengthStats as getCycleInfo} from '../lib/cycle-length'
import {stats as labels} from '../i18n/en/labels' import {stats as labels} from '../i18n/en/labels'
import { Spacing, Typography } from '../styles' import { Sizes, Spacing, Typography } from '../styles'
import { fontRatio } from '../config'
const image = require('../assets/cycle-icon.png') const image = require('../assets/cycle-icon.png')
const screen = Dimensions.get('screen')
const Stats = () => { const Stats = () => {
const cycleLengths = cycleModule().getAllCycleLengths() const cycleLengths = cycleModule().getAllCycleLengths()
@@ -20,13 +22,15 @@ const Stats = () => {
const hasAtLeastOneCycle = numberOfCycles >= 1 const hasAtLeastOneCycle = numberOfCycles >= 1
const cycleData = hasAtLeastOneCycle ? getCycleInfo(cycleLengths) const cycleData = hasAtLeastOneCycle ? getCycleInfo(cycleLengths)
: { minimum: '—', maximum: '—', stdDeviation: '—' } : { minimum: '—', maximum: '—', stdDeviation: '—' }
const statsData = [ const statsData = [
[cycleData.minimum, labels.minLabel], [cycleData.minimum, labels.minLabel],
[cycleData.maximum, labels.maxLabel], [cycleData.maximum, labels.maxLabel],
[cycleData.stdDeviation ? cycleData.stdDeviation : '—', labels.stdLabel], [cycleData.stdDeviation ? cycleData.stdDeviation : '—', labels.stdLabel],
[numberOfCycles, labels.basisOfStatsEnd] [numberOfCycles, labels.basisOfStatsEnd]
] ]
const height = screen.height * 0.2
const marginTop = (height / 8 - Sizes.icon / fontRatio) / 4
return ( return (
<AppPage contentContainerStyle={styles.pageContainer}> <AppPage contentContainerStyle={styles.pageContainer}>
<Segment last style={styles.pageContainer}> <Segment last style={styles.pageContainer}>
@@ -38,12 +42,12 @@ const Stats = () => {
<ImageBackground <ImageBackground
source={image} source={image}
imageStyle={styles.image} imageStyle={styles.image}
style={styles.imageContainter} style={[styles.imageContainter, { height }]}
> >
<AppText <AppText
numberOfLines={1} numberOfLines={1}
ellipsizeMode="clip" ellipsizeMode="clip"
style={styles.accentPurpleGiant} style={[styles.accentPurpleGiant, { marginTop }]}
> >
{cycleData.mean} {cycleData.mean}
</AppText> </AppText>
@@ -72,15 +76,14 @@ const column = {
const styles = StyleSheet.create({ const styles = StyleSheet.create({
accentOrange: { accentOrange: {
...Typography.accentOrange, ...Typography.accentOrange,
fontSize: 20, fontSize: Sizes.small,
}, },
accentPurpleGiant: { accentPurpleGiant: {
...Typography.accentPurpleGiant, ...Typography.accentPurpleGiant,
}, },
accentPurpleHuge: { accentPurpleHuge: {
...Typography.accentPurpleHuge, ...Typography.accentPurpleHuge,
marginRight: Spacing.base, marginTop: Spacing.base * (-1),
marginTop: -15,
}, },
container: { container: {
alignItems: 'center', alignItems: 'center',
@@ -97,15 +100,14 @@ const styles = StyleSheet.create({
paddingTop: Spacing.small, paddingTop: Spacing.small,
}, },
image: { image: {
height: 120, marginLeft: Spacing.large,
marginLeft: 20, marginTop: Spacing.large,
marginTop: 20,
resizeMode: 'contain', resizeMode: 'contain',
width: 120,
}, },
imageContainter: { imageContainter: {
paddingTop: 40, paddingTop: Spacing.large * 2,
marginBottom: 20, marginBottom: Spacing.large,
}, },
pageContainer: { pageContainer: {
marginVertical: Spacing.base, marginVertical: Spacing.base,
+2 -1
View File
@@ -16,6 +16,7 @@ export const sizes = {
subtitle: 22 / fontRatio, subtitle: 22 / fontRatio,
title: 24 / fontRatio, title: 24 / fontRatio,
huge: 32 / fontRatio, huge: 32 / fontRatio,
icon: 40 / fontRatio,
} }
const accentText = { const accentText = {
@@ -31,7 +32,7 @@ const accentTextBig = {
const accentTextGiant = { const accentTextGiant = {
...accentText, ...accentText,
fontSize: 50 / fontRatio, fontSize: sizes.icon / fontRatio,
} }
const accentTextHuge = { const accentTextHuge = {