From 3e50991d121fc7be90855d80ae5a6bfdc48eeae5 Mon Sep 17 00:00:00 2001 From: bl00dymarie Date: Fri, 5 Jan 2024 15:43:29 +0100 Subject: [PATCH 1/5] Rename nfp-settings into customization --- components/pages.js | 2 +- .../settings/{nfp-settings => customization}/index.js | 0 .../{nfp-settings => customization}/slider-label.js | 0 .../{nfp-settings => customization}/temperature-slider.js | 0 components/settings/index.js | 4 ++-- components/settings/settings-menu.js | 2 +- i18n/en.json | 6 +++--- 7 files changed, 7 insertions(+), 7 deletions(-) rename components/settings/{nfp-settings => customization}/index.js (100%) rename components/settings/{nfp-settings => customization}/slider-label.js (100%) rename components/settings/{nfp-settings => customization}/temperature-slider.js (100%) diff --git a/components/pages.js b/components/pages.js index deb7707..880ef70 100644 --- a/components/pages.js +++ b/components/pages.js @@ -37,7 +37,7 @@ export const pages = [ parent: 'SettingsMenu', }, { - component: 'NfpSettings', + component: 'Customization', parent: 'SettingsMenu', }, { diff --git a/components/settings/nfp-settings/index.js b/components/settings/customization/index.js similarity index 100% rename from components/settings/nfp-settings/index.js rename to components/settings/customization/index.js diff --git a/components/settings/nfp-settings/slider-label.js b/components/settings/customization/slider-label.js similarity index 100% rename from components/settings/nfp-settings/slider-label.js rename to components/settings/customization/slider-label.js diff --git a/components/settings/nfp-settings/temperature-slider.js b/components/settings/customization/temperature-slider.js similarity index 100% rename from components/settings/nfp-settings/temperature-slider.js rename to components/settings/customization/temperature-slider.js diff --git a/components/settings/index.js b/components/settings/index.js index bdbc941..b0b3c88 100644 --- a/components/settings/index.js +++ b/components/settings/index.js @@ -1,5 +1,5 @@ import Reminders from './reminders/reminders' -import NfpSettings from './nfp-settings' +import Customization from './customization' import DataManagement from './data-management/DataManagement' import Password from './password' import About from './About' @@ -8,7 +8,7 @@ import PrivacyPolicy from './privacy-policy' export default { Reminders, - NfpSettings, + Customization, DataManagement, Password, About, diff --git a/components/settings/settings-menu.js b/components/settings/settings-menu.js index fa2a65d..49e0ac2 100644 --- a/components/settings/settings-menu.js +++ b/components/settings/settings-menu.js @@ -7,8 +7,8 @@ import MenuItem from './menu-item' import { useTranslation } from 'react-i18next' const menuItems = [ + { label: 'customization', componentName: 'Customization' }, { label: 'reminders', componentName: 'Reminders' }, - { label: 'nfpSettings', componentName: 'NfpSettings' }, { label: 'dataManagement', componentName: 'DataManagement' }, { label: 'password', componentName: 'Password' }, ] diff --git a/i18n/en.json b/i18n/en.json index 90e8a60..7dce148 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -116,9 +116,9 @@ "name": "Data", "text": "import, export or delete your data" }, - "nfpSettings": { - "name": "NFP settings", - "text": "define how you want to use NFP" + "customization": { + "name": "Customization", + "text": "define how you want to use drip" }, "password": { "name": "Password", From e18eedd4e79d48e95f07f7f88c6c2b6e6f8d3ade Mon Sep 17 00:00:00 2001 From: bl00dymarie Date: Fri, 5 Jan 2024 15:40:33 +0100 Subject: [PATCH 2/5] Add info section under settings --- components/pages.js | 4 +++ components/settings/Info.js | 50 ++++++++++++++++++++++++++++ components/settings/index.js | 2 ++ components/settings/settings-menu.js | 1 + i18n/en.json | 7 ++++ 5 files changed, 64 insertions(+) create mode 100644 components/settings/Info.js diff --git a/components/pages.js b/components/pages.js index 880ef70..1d4b1d0 100644 --- a/components/pages.js +++ b/components/pages.js @@ -44,6 +44,10 @@ export const pages = [ component: 'DataManagement', parent: 'SettingsMenu', }, + { + component: 'Info', + parent: 'SettingsMenu', + }, { component: 'Password', parent: 'SettingsMenu', diff --git a/components/settings/Info.js b/components/settings/Info.js new file mode 100644 index 0000000..9a934f6 --- /dev/null +++ b/components/settings/Info.js @@ -0,0 +1,50 @@ +import React from 'react' +import { StyleSheet, View } from 'react-native' +import PropTypes from 'prop-types' +import { useTranslation } from 'react-i18next' + +import AppIcon from '../common/app-icon' +import AppPage from '../common/app-page' +import AppText from '../common/app-text' +import Segment from '../common/segment' + +import { Colors, Spacing, Typography } from '../../styles' +import labels from '../../i18n/en/settings' + +const Info = () => { + const { t } = useTranslation(null, { keyPrefix: 'hamburgerMenu.info' }) + return ( + + + + + {labels.preOvu.title} + + {labels.preOvu.note} + + + ) +} + +Info.propTypes = { + children: PropTypes.node, +} + +export default Info + +const styles = StyleSheet.create({ + icon: { + marginRight: Spacing.base, + }, + line: { + flexDirection: 'row', + alignItems: 'center', + }, + title: { + ...Typography.subtitle, + }, +}) diff --git a/components/settings/index.js b/components/settings/index.js index b0b3c88..950b138 100644 --- a/components/settings/index.js +++ b/components/settings/index.js @@ -1,6 +1,7 @@ import Reminders from './reminders/reminders' import Customization from './customization' import DataManagement from './data-management/DataManagement' +import Info from './Info' import Password from './password' import About from './About' import License from './License' @@ -10,6 +11,7 @@ export default { Reminders, Customization, DataManagement, + Info, Password, About, License, diff --git a/components/settings/settings-menu.js b/components/settings/settings-menu.js index 49e0ac2..773ca2e 100644 --- a/components/settings/settings-menu.js +++ b/components/settings/settings-menu.js @@ -11,6 +11,7 @@ const menuItems = [ { label: 'reminders', componentName: 'Reminders' }, { label: 'dataManagement', componentName: 'DataManagement' }, { label: 'password', componentName: 'Password' }, + { label: 'info', componentName: 'Info' }, ] const SettingsMenu = ({ navigate }) => { diff --git a/i18n/en.json b/i18n/en.json index 7dce148..f3d6bff 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -127,9 +127,16 @@ "reminders": { "name": "Reminders", "text": "turn on/off reminders" + }, + "info": { + "name": "Info", + "text": "Learn more about how drip works" } }, "title": "Settings" + }, + "info": { + "title": "info" } }, "stats": { From 09f0a0f11d44a6d5bb4c51769ee8d6374ab2853e Mon Sep 17 00:00:00 2001 From: bl00dymarie Date: Fri, 5 Jan 2024 15:48:14 +0100 Subject: [PATCH 3/5] Add WIP for customization section --- components/common/app-switch.js | 10 +- components/settings/customization/index.js | 115 +++++++++++++++------ 2 files changed, 89 insertions(+), 36 deletions(-) diff --git a/components/common/app-switch.js b/components/common/app-switch.js index 2333c0c..ce835a6 100644 --- a/components/common/app-switch.js +++ b/components/common/app-switch.js @@ -6,13 +6,18 @@ import AppText from './app-text' import { Containers } from '../../styles' -const AppSwitch = ({ onToggle, text, value }) => { +const AppSwitch = ({ onToggle, text, value, trackColor }) => { return ( {text} - + ) } @@ -21,6 +26,7 @@ AppSwitch.propTypes = { onToggle: PropTypes.func.isRequired, text: PropTypes.string, value: PropTypes.bool, + trackColor: PropTypes.string, } const styles = StyleSheet.create({ diff --git a/components/settings/customization/index.js b/components/settings/customization/index.js index bf83580..e700518 100644 --- a/components/settings/customization/index.js +++ b/components/settings/customization/index.js @@ -1,7 +1,5 @@ import React, { useState } from 'react' -import { Platform, StyleSheet, View } from 'react-native' -import AppIcon from '../../common/app-icon' import AppPage from '../../common/app-page' import AppSwitch from '../../common/app-switch' import AppText from '../../common/app-text' @@ -9,7 +7,7 @@ import TemperatureSlider from './temperature-slider' import Segment from '../../common/segment' import { useCervixObservable, saveUseCervix } from '../../../local-storage' -import { Colors, Spacing, Typography } from '../../../styles' +import { Colors } from '../../../styles' import labels from '../../../i18n/en/settings' const Settings = () => { @@ -17,6 +15,9 @@ const Settings = () => { useCervixObservable.value ) + const [isEnabled, setIsEnabled] = useState(false) + const toggleSwitch = () => setIsEnabled((previousState) => !previousState) + const onCervixToggle = (value) => { setShouldUseCervix(value) saveUseCervix(value) @@ -27,47 +28,93 @@ const Settings = () => { : labels.useCervix.cervixModeOff return ( - + + + + + + + + + + + + + + + + + + {labels.tempScale.segmentExplainer} + + + - {/* for iOS disabled temporarily, TODO https://gitlab.com/bloodyhealth/drip/-/issues/545 */} - {Platform.OS !== 'ios' && ( - - {labels.tempScale.segmentExplainer} - - - )} - - - - {labels.preOvu.title} - - {labels.preOvu.note} + + + ) } export default Settings - -const styles = StyleSheet.create({ - icon: { - marginRight: Spacing.base, - }, - line: { - flexDirection: 'row', - alignItems: 'center', - }, - title: { - ...Typography.subtitle, - }, -}) From 31e87db23fabf03af808178c6b360ec6dc08943f Mon Sep 17 00:00:00 2001 From: bl00dymarie Date: Fri, 5 Jan 2024 15:59:59 +0100 Subject: [PATCH 4/5] Update license year snapshot --- test/__snapshots__/License.spec.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/__snapshots__/License.spec.js.snap b/test/__snapshots__/License.spec.js.snap index 3d11134..a622d7d 100644 --- a/test/__snapshots__/License.spec.js.snap +++ b/test/__snapshots__/License.spec.js.snap @@ -65,7 +65,7 @@ exports[`License screen should match the snapshot 1`] = ` ] } > - Copyright (C) 2023 Heart of Code e.V. + Copyright (C) 2024 Heart of Code e.V. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details: From 4d7895b9f28732f9423916f5bad8eabeaab61bf1 Mon Sep 17 00:00:00 2001 From: wunderfisch Date: Mon, 8 Jan 2024 10:35:13 +0000 Subject: [PATCH 5/5] Toggles set to true by default --- components/settings/customization/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/settings/customization/index.js b/components/settings/customization/index.js index e700518..373888c 100644 --- a/components/settings/customization/index.js +++ b/components/settings/customization/index.js @@ -15,7 +15,7 @@ const Settings = () => { useCervixObservable.value ) - const [isEnabled, setIsEnabled] = useState(false) + const [isEnabled, setIsEnabled] = useState(true) const toggleSwitch = () => setIsEnabled((previousState) => !previousState) const onCervixToggle = (value) => {