diff --git a/mobile/App.tsx b/mobile/App.tsx index 4146f851..f8a91525 100644 --- a/mobile/App.tsx +++ b/mobile/App.tsx @@ -124,10 +124,7 @@ export default function App() { name={Screens.USER_DASHBOARD_SCREEN} component={UserDashboardScreen} /> - + { return internalRequest({ url: userUserUrl, @@ -53,7 +53,7 @@ export const userUpdateUser = async ( profileImage?: string, nextPrescriptionReminder?: Date, userCreation?: boolean, - unsubscribeEmail?: boolean, + unsubscribeEmail?: boolean ) => { const user = internalRequest({ url: userUserUrl, diff --git a/mobile/app.json b/mobile/app.json index 177de8ef..8b146c0c 100644 --- a/mobile/app.json +++ b/mobile/app.json @@ -14,9 +14,7 @@ "updates": { "fallbackToCacheTimeout": 0 }, - "assetBundlePatterns": [ - "**/*" - ], + "assetBundlePatterns": ["**/*"], "ios": { "supportsTablet": true, "infoPlist": { @@ -54,4 +52,4 @@ "package": "org.healing4heroes" } } -} \ No newline at end of file +} diff --git a/mobile/components/DashboardHeader.tsx b/mobile/components/DashboardHeader.tsx index 52707b2a..2a70ddfb 100644 --- a/mobile/components/DashboardHeader.tsx +++ b/mobile/components/DashboardHeader.tsx @@ -21,8 +21,13 @@ const DashboardHeader = ({ {userInfo?.firstName} {userInfo?.lastName} - + } callbackFunction={() => { navigationProp.navigate(Screens.USER_SETTINGS); diff --git a/mobile/package.json b/mobile/package.json index 761b7188..766aa46f 100644 --- a/mobile/package.json +++ b/mobile/package.json @@ -73,4 +73,4 @@ }, "private": true, "type": "commonjs" -} \ No newline at end of file +} diff --git a/mobile/screens/Banners/CampGraceBanner.tsx b/mobile/screens/Banners/CampGraceBanner.tsx index bebe5a0e..0cac8730 100644 --- a/mobile/screens/Banners/CampGraceBanner.tsx +++ b/mobile/screens/Banners/CampGraceBanner.tsx @@ -3,20 +3,23 @@ import { View, Text, StyleSheet, TouchableOpacity } from "react-native"; import dayjs from "dayjs"; const CampGraceBanner = () => { - const isCampGraceDay = new Date().getMonth() === 3 && new Date().getDate() === 13; - - if (!isCampGraceDay) return null; + const isCampGraceDay = + new Date().getMonth() === 3 && new Date().getDate() === 13; - return ( - - Countdown to Camp Grace! - - Get ready for a 4-Day advanced training at Camp Grace in Mobile, Alabama! Enjoy free cabin accommodations, fishing, kayaking, and group cooking sessions. Just bring bedding for a twin bed. See you soon! - - - ); + if (!isCampGraceDay) return null; + + return ( + + Countdown to Camp Grace! + + Get ready for a 4-Day advanced training at Camp Grace in Mobile, + Alabama! Enjoy free cabin accommodations, fishing, kayaking, and group + cooking sessions. Just bring bedding for a twin bed. See you soon! + + + ); }; - + const styles = StyleSheet.create({ banner: { borderRadius: 10, @@ -39,7 +42,7 @@ const styles = StyleSheet.create({ fontSize: 12, fontWeight: "400", textAlign: "center", - } + }, }); export default CampGraceBanner; diff --git a/mobile/screens/User/UserDashboardScreen.tsx b/mobile/screens/User/UserDashboardScreen.tsx index 0c8005f2..3627795c 100644 --- a/mobile/screens/User/UserDashboardScreen.tsx +++ b/mobile/screens/User/UserDashboardScreen.tsx @@ -111,7 +111,7 @@ export default function UserDashboardScreen(props: any) { ); return; } - + if (today >= new Date(userInformation?.nextPrescriptionReminder)) { addToModalQueue( "prescription", @@ -226,7 +226,7 @@ export default function UserDashboardScreen(props: any) { if ( new Date(animal?.dateOfBirth as Date).getMonth() === - new Date().getMonth() && + new Date().getMonth() && new Date(animal?.dateOfBirth as Date).getDate() === new Date().getDate() ) { addToModalQueue( @@ -234,7 +234,8 @@ export default function UserDashboardScreen(props: any) { `Happy birthday ${animal.name}!!! \uE312`, `${animal.name} turned ${calculateAge( new Date(animal.dateOfBirth ?? "") - )} year${calculateAge(new Date(animal.dateOfBirth ?? "")) !== 1 ? "s" : "" + )} year${ + calculateAge(new Date(animal.dateOfBirth ?? "")) !== 1 ? "s" : "" } old today!` ); } diff --git a/mobile/screens/User/UserSettings.tsx b/mobile/screens/User/UserSettings.tsx index 666944f4..e0b6bbcb 100644 --- a/mobile/screens/User/UserSettings.tsx +++ b/mobile/screens/User/UserSettings.tsx @@ -1,135 +1,132 @@ -import React from 'react'; -import { View, Text } from 'react-native'; -import { StyleSheet, Switch } from 'react-native'; -import { useEffect, useState } from 'react'; +import React from "react"; +import { View, Text } from "react-native"; +import { StyleSheet, Switch } from "react-native"; +import { useEffect, useState } from "react"; import { User } from "../../utils/types"; import { userGetUserInfo } from "../../actions/User"; import { ErrorWrapper, endOfExecutionHandler } from "../../utils/error"; import BaseOverlay from "../../components/Overlays/BaseOverlay"; import ErrorBox from "../../components/ErrorBox"; import IconButton from "../../components/IconButton"; -import { MaterialCommunityIcons } from '@expo/vector-icons'; -import { Screens } from '../../utils/types'; -import { userUpdateUser } from '../../actions/User'; +import { MaterialCommunityIcons } from "@expo/vector-icons"; +import { Screens } from "../../utils/types"; +import { userUpdateUser } from "../../actions/User"; export default function UserSettings(props: any) { - const [error, setError] = useState(""); - const [userInfo, setUserInfo] = useState(null); + const [error, setError] = useState(""); + const [userInfo, setUserInfo] = useState(null); - useEffect(() => { - async function getUserInfo() { - try { - const user: User = (await ErrorWrapper({ - functionToExecute: userGetUserInfo, - errorHandler: setError, - })) as User; - if (user.unsubscribeEmail === undefined) { - user.unsubscribeEmail = false; - await userUpdateUser( - user.roles, - user.birthday, - user.firstName, - user.lastName, - user.handlerType, - user.address, - user.annualPetVisitDay, - user.profileImage, - user.nextPrescriptionReminder, - false, - user.unsubscribeEmail, - ); - } - setUserInfo(user); - } catch (error) { - endOfExecutionHandler(error as Error); - } - } - getUserInfo().catch(); - }, []); - - - const toggleSwitch = async () => { - // Change userInfo on this page and change in database - const updatedUserInfo = { - ...userInfo, - unsubscribeEmail: !userInfo?.unsubscribeEmail - } - setUserInfo(updatedUserInfo as User); - await userUpdateUser( - updatedUserInfo.roles, - updatedUserInfo.birthday, - updatedUserInfo.firstName, - updatedUserInfo.lastName, - updatedUserInfo.handlerType, - updatedUserInfo.address, - updatedUserInfo.annualPetVisitDay, - updatedUserInfo.profileImage, - updatedUserInfo.nextPrescriptionReminder, + useEffect(() => { + async function getUserInfo() { + try { + const user: User = (await ErrorWrapper({ + functionToExecute: userGetUserInfo, + errorHandler: setError, + })) as User; + if (user.unsubscribeEmail === undefined) { + user.unsubscribeEmail = false; + await userUpdateUser( + user.roles, + user.birthday, + user.firstName, + user.lastName, + user.handlerType, + user.address, + user.annualPetVisitDay, + user.profileImage, + user.nextPrescriptionReminder, false, - updatedUserInfo.unsubscribeEmail, - ); + user.unsubscribeEmail + ); + } + setUserInfo(user); + } catch (error) { + endOfExecutionHandler(error as Error); + } } + getUserInfo().catch(); + }, []); - return ( - - {/* This is just to align the text */} - User Settings - { - props.navigation.navigate(Screens.USER_DASHBOARD_SCREEN); - }} - icon={ - - } - /> - - } + const toggleSwitch = async () => { + // Change userInfo on this page and change in database + const updatedUserInfo = { + ...userInfo, + unsubscribeEmail: !userInfo?.unsubscribeEmail, + }; + setUserInfo(updatedUserInfo as User); + await userUpdateUser( + updatedUserInfo.roles, + updatedUserInfo.birthday, + updatedUserInfo.firstName, + updatedUserInfo.lastName, + updatedUserInfo.handlerType, + updatedUserInfo.address, + updatedUserInfo.annualPetVisitDay, + updatedUserInfo.profileImage, + updatedUserInfo.nextPrescriptionReminder, + false, + updatedUserInfo.unsubscribeEmail + ); + }; - body={ - - - Unsubscribe from Emails? - - - + return ( + + {/* This is just to align the text */} + User Settings + { + props.navigation.navigate(Screens.USER_DASHBOARD_SCREEN); + }} + icon={ + } - - footer={} - /> - ); + /> + + } + body={ + + + Unsubscribe from Emails? + + + + } + footer={} + /> + ); } const styles = StyleSheet.create({ - header: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom: 30, - }, - headerText: { - fontSize: 24, - fontWeight: 'bold', - }, - container: { - flex: 1, - justifyContent: 'center', - alignItems: 'center', - }, - setting: { - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom: 20, - }, - settingText: { - paddingRight: 15, - } -}); \ No newline at end of file + header: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + marginBottom: 30, + }, + headerText: { + fontSize: 24, + fontWeight: "bold", + }, + container: { + flex: 1, + justifyContent: "center", + alignItems: "center", + }, + setting: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", + marginBottom: 20, + }, + settingText: { + paddingRight: 15, + }, +});