diff --git a/APIkit.js b/APIkit.js index 740b4ab1f30fbec57da064fcd78eff935faca20a..a99c700e6836fdab2fdf19c91a8a3cd7e82f6e2e 100644 --- a/APIkit.js +++ b/APIkit.js @@ -1,6 +1,13 @@ import axios from "axios"; -// Create axios client, pre-configured with baseURL +/** + * An instance of axios which is used everytime a network request is needed. + * @baseURL where the request should be sent to. + * @timeout how long the system will try to perform the request. + * @headers what type of data is accepted. + * + * @return the instance. + */ let APIKit = axios.create({ baseURL: "http://192.168.0.30:5000", timeout: 60000, diff --git a/App.js b/App.js index c23ec439f3ca207b900f0d064e6a6b4efc48adfc..9739e73486676ad879921df0db1eb6dee7cfc7ca 100644 --- a/App.js +++ b/App.js @@ -9,10 +9,26 @@ import theme from "./assets/themes/Theme"; import RootStackScreen from "./navigation/RootStackScreen"; import Toast from "react-native-toast-message"; +/** + * The application. + * + * @store - used for redux and the state store. + * @theme - used for theming and the look of the application (react native paper) + * @authContext - the first way of handling the state of the user. Still in use to switch the stack based on the users + * log in state. Should be replaced by redux. + * @userToken - used for handling the user state. + * @Toast - used for the toast messages to be visible on all screens when used. + * + * @returns the application. + */ export default function App() { const [isLoading, setIsLoading] = React.useState(true); const [userToken, setUserToken] = React.useState(null); + /** + * An early version of handling state in the application, to see if a user is logged in or not. + * Should be replaced by redux in the future. + */ const authContext = React.useMemo(() => { return { signInApp: () => { diff --git a/assets/themes/Theme.js b/assets/themes/Theme.js index de5471deb592e704ef1ab1b69d16e2e8e3914f2f..2357b5fa089e003a93fdb8d73ced1fa405fb667d 100644 --- a/assets/themes/Theme.js +++ b/assets/themes/Theme.js @@ -1,6 +1,9 @@ -import React from "react"; import { DefaultTheme } from "react-native-paper"; +/** + * Defines the overall theme of the application. See https://callstack.github.io/react-native-paper/theming.html for more documentation. + */ + const theme = { ...DefaultTheme, roundness: 2, diff --git a/components/AccountData.js b/components/AccountData.js index 4ac66cd4e49e270575728102477a729ed8abbb43..ccfd121b76ed4c0e9abbc9288bcd62d8c95c23a4 100644 --- a/components/AccountData.js +++ b/components/AccountData.js @@ -1,6 +1,17 @@ import React from "react"; import { StyleSheet, Text, View } from "react-native"; +/** + * This component simply shows a user's data. This is used in the ChangeNameScreen component and + * the ChangeEmailScreen component. + * + * @param {String} props.currentLabel - bolded text to show label for current + * @param {String} props.current - text to show current data + * @param {String} props.newLabel - text to show label for new + * + * @returns the component + */ + const AccountData = (props) => { return ( diff --git a/components/CustomActivityIndicator.js b/components/CustomActivityIndicator.js index cdc300efdd509ef92c6efd86583084e7148228cb..8d87231a4c798a68520a7cdfde7457ec133ee77f 100644 --- a/components/CustomActivityIndicator.js +++ b/components/CustomActivityIndicator.js @@ -2,6 +2,20 @@ import React from 'react' import { StyleSheet, View, Modal, Text } from 'react-native' import { Colors, ActivityIndicator } from "react-native-paper"; +/** + * This component is used in screens where there are newtwork requests. This can be done better in the + * future, but its purpose is to prevent the user from aborting their task until they have received a response, + * and to prevent them from spamming a request. It is also used to visualize that the server is working. + * + * @param {Boolean} props.visible - this is the prop that makes the indicator visible or not. + * @param {Object} props.style - the style can be passed down to this component to customize it. + * @param {String} props.text - optional feature where a text can be passed to the component to + * indicate that it is processing something. Currently only used when + * image processing, since it takes some time. + * + * @returns the component + */ + const CustomActivityIndicator = (props) => { return ( diff --git a/components/CustomButton.js b/components/CustomButton.js index 98f06b201dbcb1d15048227b322854091e46b199..1d2caf78fe40221d8d432a69830e2e69391fa015 100644 --- a/components/CustomButton.js +++ b/components/CustomButton.js @@ -2,6 +2,20 @@ import * as React from "react"; import { Button } from "react-native-paper"; import { StyleSheet } from "react-native"; +/** + * A customizable component, that renders a button styled by the react native paper library. + * + * @param {Object} props.style - (Optional) can override the default style of the button where necessary, like size and position + * @param {String} props.color - (Optional) color of the button + * @param {IconSource} props.icon - (Optional) Icon to display for the button + * @param {String} props.mode - Mode/emphasis of the button. The modes outlined and contained have mostly been used. + * @param {Function} props.onPress - function that is run when the button the pressed (gets passed down from the mother component in this case) + * @param {Boolean} props.disabled - Whether the button is disabled. + * @param {String} props.title - The text on the button + * + * @returns the component + */ + const CustomButton = (props) => (