Global

Members

(constant) browseLocalStorage

The browseLocalStorage function allows users to select an image file from their local storage and returns a Promise that resolves with the image data in base64 format.

Source:

(constant) cachedFoods

The line const cachedFoods = useMemo(() => foods, [foods]); is utilizing the useMemo hook in React to memoize the foods state variable.

Source:

(constant) calculateBMI

The calculateBMI function calculates the Body Mass Index (BMI) based on the provided height and weight inputs.

Source:

(constant) classes :Object

Represents the CSS classes generated using the useStyles hook.

Type:
  • Object
Source:

(constant) database

The line export const database = getDatabase(); is exporting a constant named database that is assigned the result of calling the getDatabase() function. In this context, getDatabase() is likely a function provided by Firebase SDK that initializes and returns a reference to the Firebase Realtime Database.

Source:

(constant) database

The line export const database = getDatabase(); is exporting a constant named database that is assigned the result of calling the getDatabase() function. In this context, getDatabase() is likely a function provided by Firebase SDK that initializes and returns a reference to the Firebase Realtime Database.

Source:

(constant) debouncedSearchFunction

The code snippet export const debouncedSearchFunction = debounce((searchValue) => { setDebouncedSearch(searchValue); }, 500); is defining a function named debouncedSearchFunction that utilizes the debounce function from the lodash library.

Source:

(constant) deleteUserRouteHandler

The deleteUserRouteHandler function deletes a saved route at a specific index and updates the state accordingly.

Source:

(constant) deleteWaypointHandler

The deleteWaypointHandler function removes a specific waypoint from an array of waypoints in JavaScript.

Source:

(constant) directionMatrixCallback

The function directionMatrixCallback processes a response from a directions API to extract segment information, total distance, and total duration of a path.

Source:

(constant) directionsCallback

The directionsCallback function checks the response status and logs the response accordingly.

Source:

(constant) extractClickedLocation

The function extractClickedLocation extracts the clicked location's latitude and longitude, retrieves the place name if available, and sets the click location with the name and location data.

Source:

(constant) fetchFoodInfo

The function fetchFoodInfo asynchronously retrieves food information based on provided IDs, filters the data, and sets states accordingly.

Source:

(constant) fetchFoods

The function fetches food data from a database, filters it based on a search query, and updates the state accordingly.

Source:

(constant) getAdvice

The function getAdvice takes a healthStatus parameter and returns a random advice based on the health status category.

Source:

(constant) getHealthStatus

The function getHealthStatus determines a person's health status based on their BMI and then updates the status and provides advice accordingly.

Source:

(constant) getPlaceDisplayName

The function getPlaceDisplayName makes an HTTP GET request to retrieve the display name of a place using the Google Places API. Get displayname from fetch()

Source:

(constant) handleApprove

The handleApprove function asynchronously accepts a point of interest (POI) named "foodpoint", logs a message if the POI is approved, and reloads the router, handling any errors that may occur.

Source:

(constant) handleApprove

The handleApprove function asynchronously approves a point of interest (POI) named "toiletpoint", logs a message if successful, and reloads the router, handling any errors that occur.

Source:

(constant) handleApprove

The handleApprove function asynchronously accepts a point of interest (POI) named "waterpoint", logs a message if the POI is approved, and reloads the router, handling any errors that may occur.

Source:

(constant) handleBackButtonClick

The function handleBackButtonClick is used to navigate back in the router history.

Source:

(constant) handleBrowseClick

The handleBrowseClick function asynchronously retrieves a picture from local storage, sets the picture, and calls the onImageSelect function with the selected picture.

Source:

(constant) handleCancel

The handleCancel function cancels the changes made by the user and resets the form to the original values.

Source:

(constant) handleCodeChanges

The function handleCodeChanges updates the value of verCode based on the input from an event.

Source:

(constant) handleConfirmPasswordChange

The function handleConfirmPasswordChange sets the value of the confirm password based on the input event.

Source:

(constant) handleDiscardClick

The function handleDiscardClick logs "Hello" to the console and resets the image and foods state variables.

Source:

(constant) handleDiscardClick

The handleDiscardClick function sets the picture state to null.

Source:

(constant) handleEdit

The handleEdit function enables the edit mode when the user clicks the "Edit" button. The user can then edit their information.

Source:

(constant) handleEmailChange

The function handleEmailChange updates the value of email based on the input from an event.

Source:

(constant) handleEmailChange

The handleEmailChange function updates the email state with the value entered in an input field.

Source:

(constant) handleEmailChange

The function handleEmailChange updates the email state with the value entered in an input field.

Source:

(constant) handleFacebookLogin

The function handleFacebookLogin attempts to log in with Facebook, sets loading and error states accordingly, and redirects to the main menu if successful.

Source:

(constant) handleFoodSearch

The handleFoodSearch function updates the searchedFood state with the value entered in an input field.

Source:

(constant) handleGetLocationClick

The handleGetLocationClick function uses the Geolocation API to get the current position of the user and update the current location accordingly.

Source:

(constant) handleGithubLogin

The handleGithubLogin function attempts to log in with GitHub, sets loading and error states accordingly, and redirects to the main menu upon successful login.

Source:

(constant) handleGoogleLogin

The handleGoogleLogin function attempts to log in with Google, sets loading and error states accordingly, and redirects to the main menu upon successful login.

Source:

(constant) handleMiddlePoints

The handleMiddlePoints function sets up middle points based on the input waypoints array and logs the resulting middle points.

Source:

(constant) handleNewPasswordChange

The function handleNewPasswordChange updates the value of a new password based on user input.

Source:

(constant) handlePasswordChange

The function handlePasswordChange updates the password state with the value entered in an input field.

Source:

(constant) handlePasswordChange

The function handlePasswordChange updates the password state with the value entered in an input field.

Source:

(constant) handlePlaceChanged

The function handlePlaceChanged retrieves and sets the selected place's details, including its geometry, and updates the search latitude and longitude accordingly.

Source:

(constant) handleProfilePicChange

The function handleProfilePicChange sets loading state to true, calls changeProfilePic function from context, and sets loading state to false after the update or if there is an error.

Source:

(constant) handleReconfirmPasswordChange

The function handleReconfirmPasswordChange updates the reconfirm password state based on user input.

Source:

(constant) handleReject

The function handleReject asynchronously rejects a point of interest (POI) for a given ID, logs a message if successful, and reloads the router, handling any errors that occur.

Source:

(constant) handleReject

The function handleReject asynchronously rejects a point of interest (POI) and reloads the router, handling any errors that occur.

Source:

(constant) handleReject

The function handleReject asynchronously rejects a point of interest (POI) with the type "waterpoint" and logs a message before reloading the router, handling any errors that occur.

Source:

(constant) handleRouteNameChange

The function handleRouteNameChange updates the route name based on the value entered in an input field.

Source:

(constant) handleSubmit

The handleSubmit function handles form submission for account creation, including verification code validation and error handling.

Source:

(constant) handleSubmit

The function handleSubmit is an asynchronous function that handles form submission for resetting a password, displaying alerts based on the outcome.

Source:

(constant) handleSubmit

The handleSubmit function is an asynchronous function that handles form submission by attempting to log in with the provided email and password, redirecting to the main menu on success, and displaying an alert for invalid credentials.

Source:

(constant) handleSubmit

The function handleSubmit is used to handle form submission, validate input fields, construct a data object, add a new point of interest (POI) to the database, clear the form, and redirect to the main menu.

Source:

(constant) handleSubmit

The handleSubmit function handles form submission, validates user input, generates a code, sends an email using EmailJS, and redirects the user to a verification page.

Source:

(constant) handleSubmit

The handleSubmit function handles form submission for changing a password, including validation and error handling.

Source:

(constant) handleSubmit

The handleSubmit function handles the form submission when the user updates their information. It checks if the height and weight are valid numbers and within a certain range. If the values are not valid, an alert is shown, and the form is reset to the original values. If the values are valid, the data object is constructed with the new values, and the user's data is updated in the Firebase Realtime Database. An alert is shown upon successful update, and the edit mode is disabled.

Source:

(constant) handleToggleChange

The function handleToggleChange toggles the boolean value at a specific index in an array and updates the state with the new array.

Source:

(constant) handleToggleForm

The function handleToggleForm toggles the visibility of a change password form and changes the color of the password field.

Source:

(constant) handleUsernameChange

The function handleUsernameChange updates the username based on the value entered in an input field.

Source:

(constant) renderIcon

The renderIcon function returns an icon based on the health status of the user.

Source:

The function restaurantLink asynchronously retrieves the download URL for a restaurant icon image stored in Firebase Storage.

Source:

The function restaurantLink asynchronously retrieves the download URL for a restaurant icon image stored in Firebase Storage.

Source:

(constant) router :Object

Represents the router instance provided by Next.js for handling routing.

Type:
  • Object
Source:

(constant) swapWappointHandler

The swapWaypointHandler function swaps a waypoint with either the previous or next waypoint based on the specified direction.

Source:

The toiletLink function asynchronously retrieves the download URL for a specific image file stored in Firebase Storage.

Source:

The toiletLink function asynchronously retrieves the download URL for a specific image file stored in Firebase Storage.

Source:

(constant) uploadImageAndGetPrediction

The function uploadImageAndGetPrediction fetches an image blob, sends it to a Flask API for prediction, processes the prediction result, and fetches additional food information based on the prediction.

Source:

The function waterpointLink asynchronously retrieves the download URL for a specific image stored in Firebase storage.

Source:

The function waterpointLink asynchronously retrieves the download URL for a specific image stored in Firebase storage.

Source:

Methods

AccountInfo()

The AccountInfo function in JavaScript handles user information display and password change functionality with validation and error handling.

Source:
Returns:

The AccountInfo component is returning a Card component containing user information such as username and email. If the user is allowed to change their password, a "Change Password" button is displayed. If the user clicks on the "Change Password" button, a form is shown where the user can enter a new password and confirm it. There is also a button to update the password. Error messages are displayed

BMI()

The BMU function in JavaScript handles user BMI display and health status

Source:
Returns:

The BMI component is returning a Card component containing user information such as BMI and health status. if the user has not entered their height and weight, the BMI will be unavailable. If the user has entered their height and weight, the BMI will be calculated and displayed. The health status

CameraContent()

The CameraContent function in JavaScript fetches food data based on image predictions and displays food information along with images.

Source:
Returns:

The CameraContent function is being exported as the default export. It returns JSX elements that conditionally render different sections based on the state of the component.

CameraInput()

The function CameraInput is a React component that allows users to capture images using a webcam and provides options to view, upload, and delete the captured images.

Source:
Returns:

The CameraInput component is being returned. It consists of conditional rendering based on the isCaptureEnable and url states. If isCaptureEnable is false, it displays a button to enable capturing. If isCaptureEnable is true and url is null, it shows the webcam component for capturing an image. If isCaptureEnable is true and

CreateAccountPage(props)

The CreateAccountPage function in JavaScript handles form submission, validates user input, sends an email using EmailJS, and redirects the user to a verification page with query parameters.

Parameters:
Name Type Description
props

The CreateAccountPage function takes in props as a parameter. Within the component, it uses these props to render different elements on the page.

Source:
Returns:

The CreateAccountPage component is being returned. It consists of a form for creating a new account with fields for username, password, reconfirm password, and email. The form includes event handlers for input changes and form submission. Upon submission, the form data is validated, a code is generated, an email is sent using EmailJS, and the user is redirected to a verification page with the

DisplayMapPage(props)

The DisplayMapPage function is a React component that displays a map page with authentication checks and conditional rendering based on the user's authentication status.

Parameters:
Name Type Description
props

In the DisplayMapPage function, the props parameter is used to pass data and functions to the component. It contains the properties that are passed to the component when it is rendered. These properties can be accessed using props.propertyName.

Source:
Returns:

The DisplayMapPage function is returning JSX elements that make up the main content of the page if the user is authenticated. This includes a header component with links, a parallax image with a title and subtitle, a main content section containing a map component with the current user's ID, and a footer component. If the user is not authenticated or the page is still loading, it returns an

ErrorPage(props)

The function LandingPage renders a 404 error page with a message and a button to go back to the starting page.

Parameters:
Name Type Description
props

The LandingPage component receives props as input, and it extracts the rest prop using object destructuring. The rest prop contains any additional props that are passed to the LandingPage component but are not explicitly destructured in the component.

Source:
Returns:

The LandingPage component is being returned, which consists of a header, a parallax section with a background image, a grid container with a title and message indicating a 404 error, a button to go back to the starting page, and a footer.

FeedbackMap(props)

The FeedbackMap function is a React component that displays a Google Map with the ability to capture user clicks and geolocation information.

Parameters:
Name Type Description
props

The FeedbackMap component accepts props as its parameter. In the code snippet you provided, the props are being destructured to extract specific properties:

Source:
Returns:

The FeedbackMap component is being returned. It is a functional component that renders a Google Map with certain functionalities related to user interaction and location tracking. The map displays a marker at a clicked location or the user's current geolocation when requested. The component also includes a control button to get the user's current location.

FoodHealthPage(props)

The function FoodHealthPage renders a webpage for food health with a header, parallax image, and sections for manual and camera content.

Parameters:
Name Type Description
props

The FoodHealthPage component takes in props as its parameter. Within the component, it uses these props to render different elements on the page. In this specific case, the props are being spread into the rest variable, which is then passed down to the Header component as additional

Source:
Returns:

The FoodHealthPage component is being returned. It includes a header, a parallax image, and a section with content related to food health. The content includes a manual content pill and camera content.

FoodInfo(props)

The FoodInfo function in JavaScript fetches and displays nutritional information about a food item based on the provided id parameter.

Parameters:
Name Type Description
props
  • props: An object containing the properties passed to the FoodInfo component. These properties can include any data or functions that are passed down from a parent component to FoodInfo. In the provided code snippet, the props object is destructured to extract any additional props that are
Source:
Returns:

The FoodInfo component is returning a JSX structure that includes a header, a parallax image, and nutritional information about a specific food item. The returned JSX structure consists of various components like Header, Parallax, GridContainer, GridItem, Card, CardHeader, CardBody, and more.

FoodSug()

The function FoodSug fetches food suggestions data and displays them in a card format, handling cases where there are no suggestions available.

Source:
Returns:

The FoodSug component is being returned. Inside the component, it checks if the foodSuggestions array is empty. If it is empty, it displays a message "-- No food suggestions currently --". If there are suggestions in the array, it maps over the foodSuggestions array and renders a FoodSugCard component for each suggestion inside a Card component.

FoodSug()

The FoodSug function fetches water suggestions and displays them in a card format on a webpage.

Source:
Returns:

The FoodSug function is being exported as the default export. It returns a JSX structure that conditionally renders either a message indicating no water suggestions are currently available or a Card component containing water suggestions fetched from the waterSuggestions state. Each water suggestion is rendered using the WaterSugCard component within a CardBody component.

FoodSugCard(props)

The FoodSugCard function displays information about a food point of interest (POI) and allows the user to either approve or reject it.

Parameters:
Name Type Description
props

The FoodSugCard function takes in props as a parameter.

Source:
Returns:

The FoodSugCard component is being returned. It displays information about a food point of interest (POI) including name, latitude, longitude, and description. It also provides buttons to reject or approve the POI. The component includes functionality to handle rejection and approval of the POI asynchronously.

GPXdownload(props)

The function GPXdownload generates a GPX file for downloading based on routeResponse data.

Parameters:
Name Type Description
props

The GPXdownload function is a React component that takes in props as its parameter. The props object contains the routeResponse property along with other properties.

Source:
Returns:

The GPXdownload function is returning a button component with a link that allows the user to download a GPX file. The GPX file is generated based on the routeResponse object provided as a prop. If routeResponse is null, the button will display "Download Not Avail". If routeResponse is not null, the function will extract coordinates from the `

LandingPage(props)

The function LandingPage renders a landing page with a header, parallax background image, product section, and footer.

Parameters:
Name Type Description
props

The LandingPage component is a functional component that takes in props as its parameter. Inside the component, it uses the useStyles hook to access CSS styles, spreads the props using object destructuring, and renders the following structure:

Source:
Returns:

The LandingPage component is being returned, which consists of a layout with a header, a parallax image section, a main content section with a product section, and a footer. The header includes a brand name "ThisIsNotFair" and navigation links. The parallax section displays an image "/img/landing-bg.jpg" with a title "Your journey to run starts with us

LocalStorageInput()

The LocalStorageInput function is a React component that allows users to browse and select images from their local storage.

Source:
Returns:

The LocalStorageInput component is being returned. It is a functional component that allows users to browse and select an image from their local storage. The component contains a button labeled "Browse Locally" that triggers the handleBrowseClick function when clicked. This function opens a file input dialog for the user to select an image file. Once an image is selected, it is displayed and passed to

LoginPage(props)

The LoginPage function handles user login functionality, including form submission, social media login options, and error handling.

Parameters:
Name Type Description
props

The LoginPage component you provided is a functional component that handles user login functionality.

Source:
Returns:

The LoginPage component is being returned. It includes a form for user login with options to log in using Facebook, Google, or GitHub accounts. The form allows users to enter their email and password for login. There are also links for password recovery and signing up for a new account. The component is styled using CSS classes and includes a background image.

The MainMenuPage function is a React component that displays a main menu page with different options based on the user's authentication status and role.

Parameters:
Name Type Description
props

The MainMenuPage component is a functional component that serves as the main page for the application's menu. It receives props as input, and it uses various hooks and states to manage the component's behavior.

Source:
Returns:

The MainMenuPage component is being returned. It consists of conditional rendering based on the authentication status and loading state. If the user is not authenticated or the page is still loading, a loading message is displayed. If the user is authenticated, the main content of the page is rendered, including a dialog for the user's first visit, a header component, a parallax image, and a grid

ManageSuggestionsPage(props)

The function ManageSuggestionsPage renders a page for managing different types of suggestions related to toilets, food, and water.

Parameters:
Name Type Description
props

The ManageSuggestionsPage component takes in props as a parameter. Within the component, it uses these props to render different elements on the page.

Source:
Returns:

The ManageSuggestionsPage component is being returned. It includes a header with links, a parallax image, and a section for managing different types of suggestions (Toilet, Food, Water) using tabs.

ManualContentPill()

The ManualContentPill function in JavaScript fetches and filters food data based on a search query, debounces the search input, and displays food information with toggleable serving options.

Source:
Returns:

The ManualContentPill component is returning a grid layout containing a search input field for food search, cards displaying food information such as calories, fats, carbs, and protein, along with a toggle switch to show the nutritional values per serving or per 100g. Each card also has a "More Info" button that links to a FoodInfo page for detailed information about the specific food item

Map(props)

The Map function handles mapping functionalities including waypoints, search, current location, markers for toilets, food points, and water points, as well as displaying routes and settings.

Parameters:
Name Type Description
props

The Map component you provided is a functional component that takes props as a parameter. The props object contains various properties that can be passed to the Map component when it is used in a parent component. These properties can be accessed within the Map component using object

Source:
Returns:

The Map component is being returned, which consists of various functionalities related to mapping, including search functionality, route planning, saved routes, settings toggles for different points of interest (toilets, food points, water points), and the actual map display with markers and directions based on selected waypoints. The component also includes handlers for adding, deleting, and swapping waypoints, as well as functions to

NewFeedbackPage(props)

The NewFeedbackPage function is a React component that allows users to create new feedback by providing details such as name, type of point of interest, location coordinates, and description, with authentication and form validation included.

Parameters:
Name Type Description
props

In the NewFeedbackPage component, the props parameter is used to pass down properties from a parent component to this component.

Source:
Returns:

The NewFeedbackPage component is being returned. It consists of JSX elements that make up the structure of the page for creating new feedback. The component includes a header, a parallax image, a form for submitting feedback, and a map component for selecting coordinates. The form submission is handled by the handleSubmit function, which validates input fields, constructs a data object, adds a new point

POIMarkers(props)

The function POIMarkers maps through an array of points of interest (POI) and renders markers on a map with specified properties and click functionality.

Parameters:
Name Type Description
props

The POIMarkers function takes in a props object as a parameter. The props object contains the following properties:

Source:
Returns:

The POIMarkers function returns a list of Marker components based on the allPOI array provided in the props. Each Marker component is positioned at the latitude and longitude coordinates specified in each waypoint object within the allPOI array. The title of each marker is set to a combination of the waypoint.Name and `p

PasswordRecoveryPage(props)

The ForgotPasswordPage function handles the form submission for resetting a password and displays alerts based on the outcome.

Parameters:
Name Type Description
props

The props parameter in the ForgotPasswordPage function represents the properties passed to the component. In this case, it includes any additional props that might be passed to the ForgotPasswordPage component when it is used in another part of the application. These props can be accessed within the

Source:
Returns:

The ForgotPasswordPage component is being returned. It consists of a form for resetting a password where the user can enter their email address. The form includes a header, input field for email, and a button to reset the password. The component also includes styling elements such as background images and card animations. Additionally, there are event handlers for email input change and form submission.

ProductSection()

The ProductSection function renders a section displaying information about routes, toilets, and food options for exercise activities in Singapore.

Source:
Returns:

The ProductSection function is returning a JSX element that represents a section of a product page. It includes a title, description, and three InfoArea components displaying information about routes, toilets, and food options.

ProfilePage(props)

The ProfilePage function is a React component that displays a user's profile information and allows them to change their profile picture.

Parameters:
Name Type Description
props

The ProfilePage function is a React component that takes props as a parameter.

Source:
Returns:

The ProfilePage component is being returned. It includes JSX elements for rendering a user profile page with profile picture, user information, account details, and navigation tabs for Body Mass Index, User Information, and Account Details. The component also handles authentication, profile picture change functionality, and redirects to the login page if the user is not logged in.

RouteCard(props)

The RouteCard function is a React component that displays information about a route, including name, distance, duration, and provides a delete button.

Parameters:
Name Type Description
props

The RouteCard component takes in the following props: name, distance = 0, duration = 0, index, deleteHandler.

Source:
Returns:

The RouteCard component is being returned. It is a functional component that renders a Card with information about a route. The component receives props such as name, distance, duration, index, deleteHandler, and other props. Inside the component, it uses Material-UI components like Card, GridContainer, GridItem, IconButton, and icons like CloseIcon. It displays

RoutePlannerPage(props)

The RoutePlannerPage function is a React component that handles route planning and display for authenticated users, including retrieving saved routes, deleting routes, and rendering route cards.

Parameters:
Name Type Description
props

The RoutePlannerPage component you provided is a functional component that serves as the main page for a route planning application. It includes authentication checks, fetching user-specific route data, and rendering route planning and viewing functionalities.

Source:
Returns:

The RoutePlannerPage component is being exported as the default export. It is a functional component that renders a page for route planning. The component includes authentication checks, retrieval of user routes, deletion of routes, and rendering of route cards. The component returns JSX elements that make up the layout of the route planner page, including a header, parallax image, route planning options, and a

SavedRoutesTab(props)

The SavedRoutesTab function in JavaScript manages saved routes, allowing users to save, retrieve, and download routes with associated details.

Parameters:
Name Type Description
props

The SavedRoutesTab component accepts the following props:

Source:
Returns:

The SavedRoutesTab component is being returned. It consists of various elements such as dropdowns for saved routes, buttons for saving routes, and input fields for entering route names. The component also includes functions for handling route name changes and retrieving saved routes for a specific user asynchronously.

ToggleMap(props)

The ToggleMap function is a React component that renders a switch toggle with customizable styling and label.

Parameters:
Name Type Description
props

The ToggleMap function takes in a props object as its parameter. The props object contains the following properties:

Source:
Returns:

The ToggleMap function is being returned. It is a functional component that renders a FormControlLabel component containing a Switch component. The ToggleMap component takes in props such as state, setState, toggleName, and other props, spreads the rest of the props, and uses Material-UI's styling classes to customize the appearance of the Switch component

ToiletSug()

The ToiletSug function fetches and displays toilet suggestions, rendering each suggestion's data in a card format.

Source:
Returns:

The ToiletSug function is being exported as the default export. It returns a JSX structure that conditionally renders either a message indicating no toilet suggestions are available or a Card component containing toilet suggestions fetched from the toiletpoint API endpoint. Each toilet suggestion is rendered using the ToiletSugCard component within a CardBody component.

ToiletSugCard(props)

The ToiletSugCard function displays information about a point of interest (POI) related to a toilet, allowing admin to approve or reject it.

Parameters:
Name Type Description
props

The ToiletSugCard component takes in props as a parameter.

Source:
Returns:

The ToiletSugCard component is being returned. It displays information about a point of interest (POI) related to a toilet, including its name, latitude, longitude, and description. It also provides buttons to reject or approve the POI. The component uses Material-UI's Grid and Button components for layout and interaction.

TravelModeSelection(props)

The TravelModeSelection function is a component that allows users to select a travel mode (bicycling or walking) with corresponding icons.

Parameters:
Name Type Description
props

The TravelModeSelection component takes in the following props:

Source:
Returns:

The TravelModeSelection component is being returned. It is a functional component that renders a CustomDropdown component with options for selecting different travel modes (BICYCLING and WALKING). The selected travel mode is updated using the setTravelMode function passed as a prop.

UserInfo()

The UserInfo function in JavaScript handles user information display and edit functionality with validation and error handling.

Source:
Returns:

The UserInfo component is returning a Card component containing user information such as location, athlete type, height, and weight. If the user has not entered their information, the fields will be empty. If the user has entered their information, the fields will be displayed. The user can edit their information by clicking the "Edit" button. The user can then save or cancel the changes. If the user saves the changes, the data is updated in the Firebase Realtime Database. If the user cancels the changes, the form is reset to the original values. If the user has not entered valid values for height and weight, an alert is shown. If the user has entered valid values, the data is updated in the Firebase Realtime Database. An alert is shown upon successful update, and the edit mode is disabled. The user can also cancel the changes, and the form is reset to the original values.

VerificationPage(props)

The VerificationPage function handles account verification by validating a verification code and creating a new account with error handling.

Parameters:
Name Type Description
props

The props parameter in the VerificationPage function represents the properties passed to the component.

Source:
Returns:

The VerificationPage component is being returned. It includes a form for verifying a user's account creation with a verification code input field and a "Verify" button. The component also handles form submission, validation of the verification code, and error handling. The layout includes a header, background image, and styling for the form elements.

WaterSugCard(props)

The WaterSugCard function is a React component that displays information about a water point of interest (POI) and provides buttons to reject or approve the POI.

Parameters:
Name Type Description
props

The WaterSugCard component is a functional component that receives props as input.

Source:
Returns:

The WaterSugCard component is being returned. It renders a card displaying information about a point of interest (POI) related to water, with options to reject or approve the POI. The card includes details such as Name, Latitude, Longitude, and Description of the POI. The component also contains buttons for rejecting and approving the POI, which trigger the handleReject

WaypointCard(props)

The WaypointCard function is a React component that displays information about a waypoint, including name, distance, duration, and options for deleting or swapping the waypoint.

Parameters:
Name Type Description
props

The WaypointCard component takes in the following props:

Source:
Returns:

The code snippet is a React functional component named WaypointCard that returns a Card component with various elements inside it. The component takes in props such as name, distance, duration, index, deleteHandler, length, swapHandler, and any other additional props using the spread operator.

acceptPOI(poiType, data)

The function acceptPOI accepts a point of interest (POI) suggestion of a specific type, adds it to the database, removes the suggestion entry, sends an email notification, and displays an alert message.

Parameters:
Name Type Description
poiType

poiType is a string that specifies the type of point of interest (POI) being accepted. It can have values of "toiletpoint", "foodpoint", or "waterpoint".

data

The data parameter in the acceptPOI function contains the following properties: Name, X, Y, and email.

Source:

acceptPOI(poiType, data)

The function acceptPOI accepts a point of interest (POI) suggestion of a specific type, adds it to the database, removes the suggestion entry, sends an email notification, and displays an alert message.

Parameters:
Name Type Description
poiType

poiType is a string that specifies the type of point of interest (POI) being accepted. It can have values of "toiletpoint", "foodpoint", or "waterpoint".

data

The data parameter in the acceptPOI function contains the following properties: Name, X, Y, and email.

Source:

addNewPOI(poiType, poiData)

The function addNewPOI adds a new point of interest (POI) to a database under a specific category and displays a success message or an error message accordingly.

Parameters:
Name Type Description
poiType

poiType is a string that represents the type of point of interest (POI) being added. It could be something like "restaurant", "park", "museum", etc.

poiData

The poiData parameter in the addNewPOI function represents the data of the Point of Interest (POI) being added. It could include information such as the name of the POI, its location coordinates, description, category, and any other relevant details that describe the PO

Source:

addNewPOI(poiType, poiData)

The function addNewPOI adds a new point of interest (POI) to a database under a specific category and displays a success message or an error message accordingly.

Parameters:
Name Type Description
poiType

poiType is a string that represents the type of point of interest (POI) being added. It could be something like "restaurant", "park", "museum", etc.

poiData

The poiData parameter in the addNewPOI function represents the data of the Point of Interest (POI) being added. It could include information such as the name of the POI, its location coordinates, description, category, and any other relevant details that describe the PO

Source:

deleteSavedRoutes(userID, postKey)

The function deleteSavedRoutes deletes a specific postKey under a user's userID in a database.

Parameters:
Name Type Description
userID

The userID parameter is the unique identifier of the user whose saved route is being deleted.

postKey

The postKey parameter is the key of the specific route that you want to delete from the saved routes of a user.

Source:

deleteSavedRoutes(userID, postKey)

The function deleteSavedRoutes deletes a specific postKey under a user's userID in a database.

Parameters:
Name Type Description
userID

The userID parameter is the unique identifier of the user whose saved route is being deleted.

postKey

The postKey parameter is the key of the specific route that you want to delete from the saved routes of a user.

Source:

fetchPoints(pointType)

The function fetches data of a specific type from a Firebase Realtime Database and returns it as an array of objects with IDs included.

Parameters:
Name Type Description
pointType

The pointType parameter in the fetchPoints function is used to specify the type of points you want to fetch from the database. It is used to construct the path to the data in the database by appending it to the base path newsuggestions/. This allows you to retrieve specific

Source:
Returns:

The fetchPoints function returns an array of objects with IDs included. If data is found at the specified path, it converts the object of objects to an array of objects with IDs included and returns that array. If no data is found at the path, it logs a message and returns an empty array. If an error occurs during the data retrieval process, it logs the error and propagates it

fetchPoints(pointType)

The function fetches data of a specific type from a Firebase Realtime Database and returns it as an array of objects with IDs included.

Parameters:
Name Type Description
pointType

The pointType parameter in the fetchPoints function is used to specify the type of points you want to fetch from the database. It is used to construct the path to the data in the database by appending it to the base path newsuggestions/. This allows you to retrieve specific

Source:
Returns:

The fetchPoints function returns an array of objects with IDs included. If data is found at the specified path, it converts the object of objects to an array of objects with IDs included and returns that array. If no data is found at the path, it logs a message and returns an empty array. If an error occurs during the data retrieval process, it logs the error and propagates it

generateCode(length)

The generateCode function generates a random code of a specified length.

Parameters:
Name Type Description
length

The length of the code to be generated.

Source:
Returns:

The function returns a randomly generated code of the specified length. The code consists of alphanumeric characters (uppercase and lowercase letters, and numbers). The code is generated by randomly selecting characters from the alphanumeric character set. The function iterates through the character set to create the code of the specified length. The generated code is then returned as the output of the function.

getAllFoodPoints()

The function getAllFoodPoints retrieves all food points data from a Firebase Realtime Database and returns it as an array of objects.

Source:
Returns:

The getAllFoodPoints function returns an array of objects representing food points data retrieved from the database. If no food points are found in the database, it returns null. If there is an error during the retrieval process, the function will log an error message and propagate the error to the caller.

getAllFoodPoints()

The function getAllFoodPoints retrieves all food points data from a Firebase Realtime Database and returns it as an array of objects.

Source:
Returns:

The getAllFoodPoints function returns an array of objects representing food points data retrieved from the database. If no food points are found in the database, it returns null. If there is an error during the retrieval process, the function will log an error message and propagate the error to the caller.

getAllToilets()

The function getAllToilets retrieves all toilet data from a Firebase Realtime Database and returns it as an array of objects.

Source:
Returns:

The getAllToilets function returns an array of toilet objects if toilets are found in the database. If no toilets are found, it logs a message saying "No toilets found in the database" and returns null. If there is an error retrieving the toilets from the database, it logs the error and throws it to propagate it to the caller.

getAllToilets()

The function getAllToilets retrieves all toilet data from a Firebase Realtime Database and returns it as an array of objects.

Source:
Returns:

The getAllToilets function returns an array of toilet objects if toilets are found in the database. If no toilets are found, it logs a message saying "No toilets found in the database" and returns null. If there is an error retrieving the toilets from the database, it logs the error and throws it to propagate it to the caller.

getAllWaterpoints()

The function getAllWaterpoints retrieves all water points from a database and returns them as an array of objects.

Source:
Returns:

The getAllWaterpoints function returns an array of waterpoints if they exist in the database. If no water points are found, it logs a message saying "No water points found in the database" and returns null. If there is an error retrieving the water points from the database, it logs the error and throws it to propagate it to the caller.

getAllWaterpoints()

The function getAllWaterpoints retrieves all water points from a database and returns them as an array of objects.

Source:
Returns:

The getAllWaterpoints function returns an array of waterpoints if they exist in the database. If no water points are found, it logs a message saying "No water points found in the database" and returns null. If there is an error retrieving the water points from the database, it logs the error and throws it to propagate it to the caller.

getFoodPoints()

The function getFoodPoints asynchronously retrieves all food points and returns them.

Source:
Returns:

The getFoodPoints function is returning the result of the getAllFoodPoints function after awaiting its completion.

getSavedRoutes(userID)

The function getSavedRoutes retrieves saved routes data for a specific user from a database using asynchronous JavaScript.

Parameters:
Name Type Description
userID

The userID parameter in the getSavedRoutes function is used to identify the user for whom we want to retrieve saved routes. It is typically a unique identifier associated with a specific user in the system.

Source:
Returns:

The function getSavedRoutes(userID) returns the routes data for the specified userID if it exists in the database. If no routes are found for the user, it returns null. If an error occurs during the retrieval process, the function will log the error and then propagate the error to the caller.

getSavedRoutes(userID)

The function getSavedRoutes retrieves saved routes data for a specific user from a database using asynchronous JavaScript.

Parameters:
Name Type Description
userID

The userID parameter in the getSavedRoutes function is used to identify the user for whom we want to retrieve saved routes. It is typically a unique identifier associated with a specific user in the system.

Source:
Returns:

The function getSavedRoutes(userID) returns the routes data for the specified userID if it exists in the database. If no routes are found for the user, it returns null. If an error occurs during the retrieval process, the function will log the error and then propagate the error to the caller.

getSavedRoutesWithKeys(userID)

The function getSavedRoutesWithKeys retrieves saved routes data for a specific user from a database using their userID. This is meant for deletion/updating purposes. Please use getSavedRoutes if only the values are required.

Parameters:
Name Type Description
userID

The userID parameter in the getSavedRoutesWithKeys function is used to specify the user for whom we want to retrieve saved routes.

Source:
Returns:

The getSavedRoutesWithKeys function is returning the routesData object if the snapshot exists, which contains the saved routes data for the specified userID. If no routes are found for the user, it returns null.

getSavedRoutesWithKeys(userID)

The function getSavedRoutesWithKeys retrieves saved routes data for a specific user from a database using their userID. This is meant for deletion/updating purposes. Please use getSavedRoutes if only the values are required.

Parameters:
Name Type Description
userID

The userID parameter in the getSavedRoutesWithKeys function is used to specify the user for whom we want to retrieve saved routes.

Source:
Returns:

The getSavedRoutesWithKeys function is returning the routesData object if the snapshot exists, which contains the saved routes data for the specified userID. If no routes are found for the user, it returns null.

getToilets()

The function getToilets asynchronously retrieves all toilets and returns them.

Source:
Returns:

The getToilets function is returning the result of the getAllToilets function after awaiting its completion.

getUserRoutes()

The function getUserRoutes asynchronously retrieves saved routes for the current user.

Source:
Returns:

The getUserRoutes function is returning the result of the getSavedRoutes(currentUser.uid) function after awaiting its completion.

getUserRoutes()

The function getUserRoutes asynchronously retrieves saved routes for a specific user.

Source:
Returns:

The function getUserRoutes is returning the routes that are fetched asynchronously using getSavedRoutes function for the specified userID.

getUserRoutesKeys()

The function getUserRoutesKeys asynchronously retrieves saved routes with keys for the current user.

Source:
Returns:

The function getUserRoutesKeys is returning the result of the getSavedRoutesWithKeys(currentUser.uid) function after awaiting its completion.

getWaterPoint()

The function getWaterPoint asynchronously retrieves all water points and returns them.

Source:
Returns:

The getWaterPoint function is returning the result of the getAllWaterpoints function after awaiting its completion.

httpGet(theUrl)

The function httpGet is an asynchronous function that performs an HTTP GET request to a specified URL and returns the JSON response.

Parameters:
Name Type Description
theUrl

The theUrl parameter in the httpGet function is the URL of the resource you want to make a GET request to. This function uses the fetch API to make an asynchronous HTTP GET request to the specified URL and returns the parsed JSON response.

Source:
Returns:

The httpGet function is returning the results of the HTTP GET request made to the specified URL. The results are obtained by parsing the response body as JSON data.

httpGet(theUrl)

The function httpGet is an asynchronous function that performs an HTTP GET request to a specified URL and returns the JSON response.

Parameters:
Name Type Description
theUrl

The theUrl parameter in the httpGet function is the URL of the resource you want to make a GET request to. This function uses the fetch API to make an asynchronous HTTP GET request to the specified URL and returns the parsed JSON response.

Source:
Returns:

The httpGet function is returning the results of the HTTP GET request made to the specified URL. The results are obtained by parsing the response body as JSON data.

rejectPOI(poiType, poiId)

The function rejectPOI removes a Point of Interest (POI) entry from the database based on its type and ID, displaying success or error alerts accordingly.

Parameters:
Name Type Description
poiType

poiType is a string that represents the type of point of interest (POI) being rejected and deleted from the database.

poiId

The poiId parameter represents the unique identifier of the Point of Interest (POI) that you want to reject and delete from the database.

Source:

rejectPOI(poiType, poiId)

The function rejectPOI removes a Point of Interest (POI) entry from the database based on its type and ID, displaying success or error alerts accordingly.

Parameters:
Name Type Description
poiType

poiType is a string that represents the type of point of interest (POI) being rejected and deleted from the database.

poiId

The poiId parameter represents the unique identifier of the Point of Interest (POI) that you want to reject and delete from the database.

Source:

uploadSavedRoutes(userID, postData)

The function uploadSavedRoutes uploads saved routes data for a specific user to a database using Firebase Realtime Database.

Parameters:
Name Type Description
userID

The userID parameter is the unique identifier of the user for whom the saved routes are being uploaded.

postData

The postData parameter likely contains the data of a saved route that the user wants to upload. This data could include information such as the route name, starting point, destination, waypoints, distance, duration, and any other relevant details about the route.

Source:
Returns:

The uploadSavedRoutes function is returning the result of the update function called with routesRef and updates as arguments.

uploadSavedRoutes(userID, postData)

The function uploadSavedRoutes uploads saved routes data for a specific user to a database using Firebase Realtime Database.

Parameters:
Name Type Description
userID

The userID parameter is the unique identifier of the user for whom the saved routes are being uploaded.

postData

The postData parameter likely contains the data of a saved route that the user wants to upload. This data could include information such as the route name, starting point, destination, waypoints, distance, duration, and any other relevant details about the route.

Source:
Returns:

The uploadSavedRoutes function is returning the result of the update function called with routesRef and updates as arguments.

validateCredentials(username, password, reconfirmPassword, email)

The validateCredentials function in JavaScript validates the user's credentials when signing up for an account.

Parameters:
Name Type Description
username

The username entered by the user.

password

The password entered by the user.

reconfirmPassword

The re-entered password for confirmation.

email

The email entered by the user.

Source:
Returns:

The function returns an error message if the credentials are invalid. If the credentials are valid, the function returns null. The function checks the following conditions:

  • Username must be at least 8 characters long and must not contain special characters.
  • Password must be at least 8 characters long and must contain at least one uppercase letter, one lowercase letter, one number, and one special character.
  • The re-entered password must match the original password.
  • Email must be in a valid email format.

validatePassword(password, reconfirmPassword)

This function validates the password and reconfirm password fields

Parameters:
Name Type Description
password string

The password entered by the user.

reconfirmPassword string

The re-entered password for confirmation.

Source:
Returns:

If the password does not meet the specified criteria, the function returns an error message. If the passwords do not match, the function returns an error message. If the password meets the criteria and the passwords match, the function returns null. The function checks the following conditions:

  • Password must be at least 8 characters long and must contain at least one special character, one number, one uppercase letter, and one lowercase letter.
  • The re-entered password must match the original password. If the password and reconfirmPassword match and meet the criteria, the function returns null. If the password does not meet the criteria, the function returns an error message. If the passwords do not match, the function returns an error message. If the password and reconfirmPassword match and meet the criteria, the function returns null.