Prettify misc files

This commit is contained in:
Sofiya Tepikin
2022-08-23 12:58:32 +02:00
parent 1b8fd97d16
commit ac7a36925f
8 changed files with 69 additions and 67 deletions
+9 -7
View File
@@ -23,14 +23,16 @@ export default function License({ setLicense }) {
return ( return (
<AppPage testID="licensePage"> <AppPage testID="licensePage">
<Segment last testID="test" title={t("settings.license.title")}> <Segment last testID="test" title={t('settings.license.title')}>
<AppText testID="test">{t("settings.license.text", { currentYear })}</AppText> <AppText testID="test">
{t('settings.license.text', { currentYear })}
</AppText>
<View style={styles.container}> <View style={styles.container}>
<Button onPress={BackHandler.exitApp} testID="licenseCancelButton"> <Button onPress={BackHandler.exitApp} testID="licenseCancelButton">
{t("labels.shared.cancel")} {t('labels.shared.cancel')}
</Button> </Button>
<Button isCTA onPress={onAcceptLicense} testID="licenseOkButton"> <Button isCTA onPress={onAcceptLicense} testID="licenseOkButton">
{t("labels.shared.ok")} {t('labels.shared.ok')}
</Button> </Button>
</View> </View>
</Segment> </Segment>
@@ -39,11 +41,11 @@ export default function License({ setLicense }) {
} }
License.propTypes = { License.propTypes = {
setLicense: PropTypes.func.isRequired setLicense: PropTypes.func.isRequired,
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
...Containers.rowContainer ...Containers.rowContainer,
} },
}) })
+8 -8
View File
@@ -9,7 +9,7 @@ import { Colors, Containers } from '../../styles'
const SelectBoxGroup = ({ labels, optionsState, onSelect }) => { const SelectBoxGroup = ({ labels, optionsState, onSelect }) => {
return ( return (
<View style={styles.container}> <View style={styles.container}>
{Object.keys(labels).map(key => { {Object.keys(labels).map((key) => {
const isActive = optionsState[key] const isActive = optionsState[key]
const boxStyle = [styles.box, isActive && styles.boxActive] const boxStyle = [styles.box, isActive && styles.boxActive]
const textStyle = [styles.text, isActive && styles.textActive] const textStyle = [styles.text, isActive && styles.textActive]
@@ -31,25 +31,25 @@ const SelectBoxGroup = ({ labels, optionsState, onSelect }) => {
SelectBoxGroup.propTypes = { SelectBoxGroup.propTypes = {
labels: PropTypes.object.isRequired, labels: PropTypes.object.isRequired,
onSelect: PropTypes.func.isRequired, onSelect: PropTypes.func.isRequired,
optionsState: PropTypes.object.isRequired optionsState: PropTypes.object.isRequired,
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
box: { box: {
...Containers.box ...Containers.box,
}, },
boxActive: { boxActive: {
...Containers.boxActive ...Containers.boxActive,
}, },
container: { container: {
...Containers.selectGroupContainer ...Containers.selectGroupContainer,
}, },
text: { text: {
color: Colors.orange color: Colors.orange,
}, },
textActive: { textActive: {
color: 'white' color: 'white',
} },
}) })
export default SelectBoxGroup export default SelectBoxGroup
+21 -23
View File
@@ -9,23 +9,21 @@ import { Colors, Containers } from '../../styles'
export default function SelectTabGroup({ activeButton, buttons, onSelect }) { export default function SelectTabGroup({ activeButton, buttons, onSelect }) {
return ( return (
<View style={styles.container}> <View style={styles.container}>
{ {buttons.map(({ label, value }, i) => {
buttons.map(({ label, value }, i) => { const isActive = value === activeButton
const isActive = value === activeButton const boxStyle = [styles.box, isActive && styles.boxActive]
const boxStyle = [styles.box, isActive && styles.boxActive] const textStyle = [styles.text, isActive && styles.textActive]
const textStyle = [styles.text, isActive && styles.textActive]
return ( return (
<TouchableOpacity <TouchableOpacity
onPress={() => onSelect(value)} onPress={() => onSelect(value)}
key={i} key={i}
style={boxStyle} style={boxStyle}
> >
<AppText style={textStyle}>{label}</AppText> <AppText style={textStyle}>{label}</AppText>
</TouchableOpacity> </TouchableOpacity>
) )
}) })}
}
</View> </View>
) )
} }
@@ -33,23 +31,23 @@ export default function SelectTabGroup({ activeButton, buttons, onSelect }) {
SelectTabGroup.propTypes = { SelectTabGroup.propTypes = {
activeButton: PropTypes.number, activeButton: PropTypes.number,
buttons: PropTypes.array.isRequired, buttons: PropTypes.array.isRequired,
onSelect: PropTypes.func.isRequired onSelect: PropTypes.func.isRequired,
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
box: { box: {
...Containers.box ...Containers.box,
}, },
boxActive: { boxActive: {
...Containers.boxActive ...Containers.boxActive,
}, },
container: { container: {
...Containers.selectGroupContainer ...Containers.selectGroupContainer,
}, },
text: { text: {
color: Colors.orange color: Colors.orange,
}, },
textActive: { textActive: {
color: 'white' color: 'white',
} },
}) })
+5 -6
View File
@@ -8,29 +8,28 @@ import HamburgerMenu from './hamburger-menu'
import { Colors, Containers, Sizes } from '../../styles' import { Colors, Containers, Sizes } from '../../styles'
const Header = ({ isSideMenuEnabled }) => { const Header = ({ isSideMenuEnabled }) => {
return ( return (
<View style={styles.header}> <View style={styles.header}>
<Logo /> <Logo />
{isSideMenuEnabled && <HamburgerMenu />} {isSideMenuEnabled && <HamburgerMenu />}
</View > </View>
) )
} }
Header.propTypes = { Header.propTypes = {
isSideMenuEnabled: PropTypes.bool isSideMenuEnabled: PropTypes.bool,
} }
Header.defaultProps = { Header.defaultProps = {
isSideMenuEnabled: true isSideMenuEnabled: true,
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
header: { header: {
backgroundColor: Colors.purple, backgroundColor: Colors.purple,
padding: Sizes.base, padding: Sizes.base,
...Containers.rowContainer ...Containers.rowContainer,
} },
}) })
export default Header export default Header
+5 -3
View File
@@ -1,5 +1,7 @@
import Toast from 'react-native-simple-toast' import Toast from 'react-native-simple-toast'
export const showToast = (text) => Toast.show( export const showToast = (text) =>
text, Toast.SHORT, ['RCTModalHostViewController', 'UIAlertController'] Toast.show(text, Toast.SHORT, [
) 'RCTModalHostViewController',
'UIAlertController',
])
+2 -2
View File
@@ -1,2 +1,2 @@
export const getLabelsList = export const getLabelsList = (categories) =>
(categories) => categories.map((label, i) => ({ label, value: i })) categories.map((label, i) => ({ label, value: i }))
+8 -7
View File
@@ -1,10 +1,11 @@
export default function (jsDate) { export default function (jsDate) {
const vals = [jsDate.getHours(), jsDate.getMinutes()] const vals = [jsDate.getHours(), jsDate.getMinutes()]
return vals.map(val => { return vals
if (parseInt(val) < 10) { .map((val) => {
val = `0${val}` if (parseInt(val) < 10) {
} val = `0${val}`
return val }
}).join(':') return val
})
.join(':')
} }
+7 -7
View File
@@ -7,11 +7,11 @@ import { Containers } from '../../styles'
import { pages } from '../pages' import { pages } from '../pages'
const Menu = () => { const Menu = () => {
const menuItems = pages.filter(page => page.isInMenu) const menuItems = pages.filter((page) => page.isInMenu)
return ( return (
<View style={styles.container}> <View style={styles.container}>
{ menuItems.map(({ icon, label, component }) => { {menuItems.map(({ icon, label, component }) => {
return ( return (
<MenuItem <MenuItem
component={component} component={component}
@@ -19,17 +19,17 @@ const Menu = () => {
key={label} key={label}
label={label} label={label}
/> />
)} )
)} })}
</View > </View>
) )
} }
const styles = StyleSheet.create({ const styles = StyleSheet.create({
container: { container: {
backgroundColor: 'white', backgroundColor: 'white',
...Containers.rowContainer ...Containers.rowContainer,
} },
}) })
export default Menu export default Menu