Prettify rest of the components files except stats

This commit is contained in:
Sofiya Tepikin
2022-09-08 12:19:36 +02:00
parent 23549ee72d
commit 840fca5b9e
14 changed files with 208 additions and 226 deletions
@@ -27,22 +27,20 @@ export default class ConfirmWithPassword extends Component {
this.setState({ password: null })
}
onIncorrectPassword = () => {
Alert.alert(
shared.incorrectPassword,
shared.incorrectPasswordMessage,
[{
Alert.alert(shared.incorrectPassword, shared.incorrectPasswordMessage, [
{
text: shared.cancel,
onPress: this.props.onCancel
}, {
onPress: this.props.onCancel,
},
{
text: shared.tryAgain,
onPress: this.resetPasswordInput
}]
)
onPress: this.resetPasswordInput,
},
])
}
checkPassword = async hash => {
checkPassword = async (hash) => {
try {
await openDb(hash)
this.props.onSuccess()
@@ -73,9 +71,7 @@ export default class ConfirmWithPassword extends Component {
secureTextEntry={true}
/>
<View style={styles.container}>
<Button onPress={this.props.onCancel}>
{shared.cancel}
</Button>
<Button onPress={this.props.onCancel}>{shared.cancel}</Button>
<Button
disabled={!isPassword}
isCTA={isPassword}
@@ -86,17 +82,16 @@ export default class ConfirmWithPassword extends Component {
</View>
</React.Fragment>
)
}
}
ConfirmWithPassword.propTypes = {
onSuccess: PropTypes.func,
onCancel: PropTypes.func
onCancel: PropTypes.func,
}
const styles = StyleSheet.create({
container: {
...Containers.rowContainer
}
})
...Containers.rowContainer,
},
})
@@ -23,7 +23,7 @@ export default class DeleteData extends Component {
this.state = {
isPasswordSet: hasEncryptionObservable.value,
isConfirmingWithPassword: false
isConfirmingWithPassword: false,
}
}
@@ -38,21 +38,20 @@ export default class DeleteData extends Component {
alertBeforeDeletion = async () => {
const { question, message, confirmation, errors } = settings.deleteSegment
if (isDbEmpty() && !await RNFS.exists(exportedFilePath)) {
if (isDbEmpty() && !(await RNFS.exists(exportedFilePath))) {
alertError(errors.noData)
} else {
Alert.alert(
question,
message,
[{
Alert.alert(question, message, [
{
text: confirmation,
onPress: this.onAlertConfirmation
}, {
onPress: this.onAlertConfirmation,
},
{
text: sharedLabels.cancel,
style: 'cancel',
onPress: this.cancelConfirmationWithPassword
}]
)
onPress: this.cancelConfirmationWithPassword,
},
])
}
}
@@ -104,5 +103,5 @@ export default class DeleteData extends Component {
DeleteData.propTypes = {
isDeletingData: PropTypes.bool,
onStartDeletion: PropTypes.func.isRequired
onStartDeletion: PropTypes.func.isRequired,
}
+6 -7
View File
@@ -14,13 +14,12 @@ import labels from '../../../i18n/en/settings'
import { ACTION_DELETE, ACTION_EXPORT, ACTION_IMPORT } from '../../../config'
export default class DataManagement extends Component {
constructor(props) {
super(props)
this.state = {
isLoading: false,
currentAction: null
currentAction: null,
}
}
@@ -62,7 +61,7 @@ export default class DataManagement extends Component {
return (
<React.Fragment>
{isLoading && <AppLoadingView />}
{!isLoading &&
{!isLoading && (
<AppPage>
<Segment title={labels.export.button}>
<AppText>{labels.export.segmentExplainer}</AppText>
@@ -79,13 +78,13 @@ export default class DataManagement extends Component {
<Segment title={labels.deleteSegment.title} last>
<AppText>{labels.deleteSegment.explainer}</AppText>
<DeleteData
isDeletingData = {isDeletingData}
onStartDeletion = {() => this.setCurrentAction(ACTION_DELETE)}
isDeletingData={isDeletingData}
onStartDeletion={() => this.setCurrentAction(ACTION_DELETE)}
/>
</Segment>
</AppPage>
}
)}
</React.Fragment>
)
}
}
}
+8 -11
View File
@@ -23,7 +23,7 @@ const MenuItem = ({ item, last, navigate }) => {
<AppText style={styles.title}>{item.name}</AppText>
{item.text.length > 0 && <AppText>{item.text}</AppText>}
</View>
<AppIcon name='chevron-right' color={Colors.orange}/>
<AppIcon name="chevron-right" color={Colors.orange} />
</TouchableOpacity>
</Segment>
)
@@ -32,26 +32,23 @@ const MenuItem = ({ item, last, navigate }) => {
MenuItem.propTypes = {
item: PropTypes.object.isRequired,
last: PropTypes.bool.isRequired,
navigate: PropTypes.func.isRequired
navigate: PropTypes.func.isRequired,
}
const styles = StyleSheet.create({
container: {
...Containers.rowContainer
...Containers.rowContainer,
},
title: {
color: Colors.purple,
fontSize: Sizes.subtitle
}
fontSize: Sizes.subtitle,
},
})
const mapDispatchToProps = (dispatch) => {
return({
return {
navigate: (page) => dispatch(navigate(page)),
})
}
}
export default connect(
null,
mapDispatchToProps
)(MenuItem)
export default connect(null, mapDispatchToProps)(MenuItem)
@@ -21,12 +21,12 @@ export default class TemperatureSlider extends Component {
onTemperatureSliderChange = (values) => {
this.setState({
minTemperature: values[0],
maxTemperature: values[1]
maxTemperature: values[1],
})
try {
saveTempScale({ min: values[0], max: values[1] })
} catch(err) {
} catch (err) {
alertError(labels.tempScale.saveError)
}
}
@@ -58,23 +58,23 @@ export default class TemperatureSlider extends Component {
const styles = StyleSheet.create({
container: {
alignItems: 'center',
paddingTop: Sizes.base
paddingTop: Sizes.base,
},
marker: {
backgroundColor: Colors.turquoiseDark,
borderRadius: 50,
elevation: 4,
height: Sizes.subtitle,
width: Sizes.subtitle
width: Sizes.subtitle,
},
slider: {
borderRadius: 25,
height: Sizes.small
height: Sizes.small,
},
sliderAccentBackground: {
backgroundColor: Colors.turquoiseDark
backgroundColor: Colors.turquoiseDark,
},
sliderBackground: {
backgroundColor: Colors.turquoise
backgroundColor: Colors.turquoise,
},
})
+5 -2
View File
@@ -5,7 +5,10 @@ import AppSwitch from '../../common/app-switch'
import Segment from '../../common/segment'
import TemperatureReminder from './temperature-reminder'
import { periodReminderObservable, savePeriodReminder } from '../../../local-storage'
import {
periodReminderObservable,
savePeriodReminder,
} from '../../../local-storage'
import labels from '../../../i18n/en/settings'
@@ -14,7 +17,7 @@ export default class Reminders extends Component {
super(props)
this.state = {
isPeriodReminderEnabled: periodReminderObservable.value.enabled
isPeriodReminderEnabled: periodReminderObservable.value.enabled,
}
}