diff --git a/.gitignore b/.gitignore
index 82adee2e0a..5b682232da 100644
--- a/.gitignore
+++ b/.gitignore
@@ -88,6 +88,7 @@ web_modules/
.env
.env.test
+.expo/
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
diff --git a/client/.gitignore b/client/.gitignore
index 0767da9258..7c3ecb2735 100644
--- a/client/.gitignore
+++ b/client/.gitignore
@@ -1,6 +1,6 @@
# For users to edit
app.json
-
+.env
.expo/
dist/
diff --git a/client/_layout.js b/client/_layout.js
index f29df93fc4..56eb197a85 100644
--- a/client/_layout.js
+++ b/client/_layout.js
@@ -8,7 +8,10 @@ import { QueryClientProvider } from "@tanstack/react-query";
import { queryClient } from "../constants/queryClient";
import { NativeBaseProvider } from "native-base";
import store from "../store/store";
-import NavigationMobile from "../screens/NavigationMobile";
+import NavigationMobile from "./screens/NavigationMobile";
+import 'mapbox-gl/dist/mapbox-gl.css';
+import 'mapbox://mapbox.mapbox-streets-v7'
+
import { ProviderAuth } from "../auth/provider";
diff --git a/client/api/getGeoCode.js b/client/api/getGeoCode.js
index 42dac03bff..8aeae226c7 100644
--- a/client/api/getGeoCode.js
+++ b/client/api/getGeoCode.js
@@ -1,26 +1,8 @@
-// import { Geoapify_Key } from "../constants/api";
-import { GEOAPIFY_KEY } from "@env";
+import { api } from "../constants/api";
-export const getGeoCode = async (addressArray = "Virginia") => {
- const transform = addressArray.split(", ").join("%20").split(" ").join("%20");
-
- const root = "https://api.geoapify.com/v1/geocode/search";
-
- let params = `?`;
-
- // let addressParams = addressArray.join("%20").replace(/\s/g, "%20");
-
- if (addressArray) params += `text=${transform}`;
-
- const api_key = `&apiKey=${GEOAPIFY_KEY}`;
-
- params += api_key;
-
- const url = root + params;
-
- let resultReturn;
-
- await fetch(url)
+export const getGeoCode = async (addressArray) => {
+ let resultReturn
+ await fetch(`${api}/geocode?addressArray=${addressArray}`)
.then((response) => response.json())
.then((result) => {
resultReturn = result;
diff --git a/client/api/getParks.js b/client/api/getParks.js
index f657971d43..e645c9e244 100644
--- a/client/api/getParks.js
+++ b/client/api/getParks.js
@@ -1,34 +1,18 @@
-// import { NPS_API } from "../constants/api";
-import { NPS_API, X_RAPIDAPI_KEY } from "@env";
+import { api } from "../constants/api";
import abbrRegion from "../constants/convertStateToAbbr";
export const getParksRapid = async (state) => {
let parksArray = [];
-
- const host = `https://jonahtaylor-national-park-service-v1.p.rapidapi.com/parks?stateCode=${
- abbrRegion(state, "abbr") ?? ""
- }`;
-
- const options = {
- method: "GET",
- headers: {
- "X-Api-Key": `${NPS_API}`,
- "X-RapidAPI-Key": `${X_RAPIDAPI_KEY}`,
- "X-RapidAPI-Host": "jonahtaylor-national-park-service-v1.p.rapidapi.com",
- "User-Agent": "PackRat",
- },
- };
-
- await fetch(host, options)
- .then((res) => res.json())
- .then((json) => {
- // console.log("json.data:", json.data);
- json.data.forEach((item) => {
- parksArray.push(item);
- });
- })
- .catch((err) => console.error("error:" + err));
-
+ const abbrState = abbrRegion(state, "abbr") ?? "";
+ if (abbrState) {
+ await fetch(`${api}/getparks?abbrState=${abbrState}`)
+ .then((res) => res.json())
+ .then((json) => {
+ json.data.forEach((item) => {
+ parksArray.push(item);
+ });
+ }).catch((err) => console.error("error:" + err));
+ }
if (parksArray.length > 0) {
parksArray = parksArray.map((park) => park.name);
} else {
diff --git a/client/api/getTrails.js b/client/api/getTrails.js
index 283e394241..e78803de81 100644
--- a/client/api/getTrails.js
+++ b/client/api/getTrails.js
@@ -1,65 +1,16 @@
-import { X_RAPIDAPI_KEY } from "@env";
+import { api } from "../constants/api";
export const getTrailsRapid = async (locationObject, latParams, lonParams) => {
let trailsArray = [];
- let radiusParams = 25;
- let activityParams = true;
-
- const {
- administrative_area_level_1: state,
- country,
- locality: city,
- } = locationObject;
-
- let paramsConditional = "";
-
- const root = "https://trailapi-trailapi.p.rapidapi.com/trails/explore/?";
-
- if (latParams) paramsConditional += `lat=${latParams}`;
- if (lonParams) paramsConditional += `&lon=${lonParams}`;
-
- if (city) paramsConditional += `&q-city_cont=${city.replace(/\s/g, "")}`;
-
- if (radiusParams) paramsConditional += `&radius=${radiusParams}`;
- if (activityParams)
- paramsConditional += `&q-activities_activity_type_name_eq=hiking`;
-
- // const limitParams = `limit=${limit}`
-
- // const latParams = `lat=34.1`
-
- // const lonParams = `lon=-105.2`
-
- // const cityParams = `q-city_cont=${city}`
-
- // const radiusParams = `radius=50`
-
- // const activityParams = 'q-activities_activity_type_name_eq=hiking'
-
- // const params = `?${limitParams}&${latParams}&${lonParams}&${city ? cityParams : ''}&${radiusParams}&${activityParams}`
-
- // const params = `?${limitParams}&${latParams}&${lonParams}&${cityParams}&${radiusParams}&${activityParams}`
-
- const url1 = root + paramsConditional;
-
- // https://trailapi-trailapi.p.rapidapi.com/activity/?&lat=34.1&lon=-105.2&q-city_cont=Charlottesville&radius=50&q-activities_activity_type_name_eq=hiking
- const url =
- "https://trailapi-trailapi.p.rapidapi.com/activity/?lat=34.1&lon=-105.2&q-city_cont=Denver&radius=25&q-activities_activity_type_name_eq=hiking";
- // const url = 'https://trailapi-trailapi.p.rapidapi.com/activity?lat=34.1&limit=25&lon=-105.2&q-city_cont=Denver&q-country_cont=Australia&q-state_cont=California&radius=25&q-activities_activity_type_name_eq=hiking'
- // const url = root + `${cityParams}&${activityParams}`
- // const url = root + `?${activityParams}&${limitParams}`
-
- const options = {
- method: "GET",
+ await fetch(api + "/gettrails", {
+ method: 'POST',
headers: {
- "X-RapidAPI-Key": `${X_RAPIDAPI_KEY}`,
- "X-RapidAPI-Host": "trailapi-trailapi.p.rapidapi.com",
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
},
- };
-
- await fetch(url1, options)
- .then((res) => res.json())
+ body: JSON.stringify({ ...locationObject, latitude: latParams, longitude: lonParams })
+ }).then((res) => res.json())
.then((json) => {
Object.values(json).forEach((item) => {
trailsArray.push(item);
diff --git a/client/api/getWeather.js b/client/api/getWeather.js
index f9ef3419af..d51ddf2f04 100644
--- a/client/api/getWeather.js
+++ b/client/api/getWeather.js
@@ -1,36 +1,19 @@
-// import { OpenWeather_Key } from "../constants/api";
-import { OPENWEATHER_KEY } from "@env";
+import { api } from "../constants/api";
export const getWeather = async (lat, lon, state) => {
let weatherObject = {};
- const root = "https://api.openweathermap.org/data/2.5/weather";
-
let params = `?`;
- const latParams = lat;
- const lonParams = lon;
- const unitParams = "imperial";
- const apiParams = true;
-
- if (latParams) params += `lat=${latParams}`;
- if (lonParams) params += `&lon=${lonParams}`;
- if (unitParams) params += `&units=${unitParams}`;
- if (apiParams) params += `&appid=${OPENWEATHER_KEY}`;
+ if (lat) params += `lat=${lat}`;
+ if (lon) params += `&lon=${lon}`;
- const url = root + params;
+ const url = api + "/weather" + params;
await fetch(url)
.then((res) => res.json())
.then((json) => {
weatherObject = json;
- // for (const key of Object.keys(json)) {
- // const {weatherObject[key]} = json[key]
- // }
-
- // Object.values(json).forEach(item => {
- // weatherArray.push(item)
- // })
})
.catch((err) => {
console.error("error:" + err);
diff --git a/client/api/getWeatherWeek.js b/client/api/getWeatherWeek.js
index 2f5a63cc0c..625a88ba34 100644
--- a/client/api/getWeatherWeek.js
+++ b/client/api/getWeatherWeek.js
@@ -1,25 +1,17 @@
-// import { OpenWeather_Key } from "../constants/api";
-import { OPENWEATHER_KEY } from "@env";
+import { api } from "../constants/api";
export const getWeatherWeek = async (lat, lon) => {
let weatherObject = {};
- const root = "https://api.openweathermap.org/data/2.5/forecast";
-
let params = `?`;
const latParams = lat;
const lonParams = lon;
- const unitParams = "imperial";
-
- const apiParams = true;
if (latParams) params += `lat=${latParams}`;
if (lonParams) params += `&lon=${lonParams}`;
- if (unitParams) params += `&units=${unitParams}`;
- if (apiParams) params += `&appid=${OPENWEATHER_KEY}`;
- const url = root + params;
+ const url = api + "/weather/week" + params;
await fetch(url)
.then((res) => res.json())
diff --git a/client/app.example.json b/client/app.example.json
new file mode 100644
index 0000000000..42542e0cbc
--- /dev/null
+++ b/client/app.example.json
@@ -0,0 +1,44 @@
+{
+ "expo": {
+ "name": "packrat-front",
+ "slug": "packrat-front",
+ "version": "1.0.0",
+ "orientation": "portrait",
+ "icon": "./assets/icon.png",
+ "userInterfaceStyle": "light",
+ "scheme": "./app/index.js",
+ "splash": {
+ "image": "./assets/splash.png",
+ "resizeMode": "contain",
+ "backgroundColor": "#ffffff",
+ "scheme": "myapp"
+ },
+ "assetBundlePatterns": [
+ "**/*"
+ ],
+ "ios": {
+ "supportsTablet": true,
+ "bundleIdentifier": "com.andrewbierman.packratfront"
+ },
+ "android": {
+ "adaptiveIcon": {
+ "foregroundImage": "./assets/adaptive-icon.png",
+ "backgroundColor": "#ffffff"
+ },
+ "package": "com.andrewbierman.packratfront"
+ },
+ "web": {
+ "favicon": "./assets/favicon.png",
+ "bundler": "metro"
+ },
+ "plugins": [
+ [
+ "@rnmapbox/maps",
+ {
+ "RNMapboxMapsImpl": "mapbox",
+ "RNMapboxMapsDownloadToken": "sk..."
+ }
+ ]
+ ]
+ }
+}
\ No newline at end of file
diff --git a/client/app/index.js b/client/app/index.js
index e617cf13f8..16f661c2cd 100644
--- a/client/app/index.js
+++ b/client/app/index.js
@@ -137,7 +137,7 @@ export default function Index() {
/>
-
+
diff --git a/client/babel.config.js b/client/babel.config.js
index fea838a288..3267bc02ff 100644
--- a/client/babel.config.js
+++ b/client/babel.config.js
@@ -11,6 +11,6 @@ module.exports = function (api) {
safe: false,
allowUndefined: true,
}]
- ],
+ ]
};
};
diff --git a/client/components/Card.js b/client/components/Card.js
index d7ef1adbf0..a190659d8f 100644
--- a/client/components/Card.js
+++ b/client/components/Card.js
@@ -22,10 +22,10 @@ export default function Card({ title, Icon, isMap, data, isSearch, isTrail }) {
isSearch
? styles.searchContainer
: isMap
- ? styles.mapCard
- : styles.containerMobile
- ? styles.containerMobile
- : styles.mutualStyles
+ ? styles.mapCard
+ : styles.containerMobile
+ ? styles.containerMobile
+ : styles.mutualStyles
}
>
{isMap ? null : isSearch ? (
+ // Search
) : (
{
const [isLoadingMobile, setIsLoadingMobile] = useState(false);
const dispatch = useDispatch();
-
const lat = geoCode?.features[0]?.geometry?.coordinates[1];
const lon = geoCode?.features[0]?.geometry?.coordinates[0];
const state = geoCode?.features[0]?.properties.state;
@@ -79,7 +78,7 @@ export const SearchInput = () => {
{
+ setError(null)
+ Axios.post(`${api}/user/checkcode`, { email: email, code: code }).then((res) => {
+ if (res.data.message == "success") {
+ setStatus("confirm")
+ } else {
+ setError(res.data.message)
+ }
+ }).catch(() => {
+ setError("Error on your browser")
+ })
+ }
+ const emailExists = () => {
+ setError(null)
+ Axios.post(`${api}/user/emailexists`, { email: email }).then((res) => {
+ if (res.data.message == "success") {
+ setStatus("verification")
+ } else {
+ setError(res.data.message)
+ }
+ }).catch(() => {
+ setError("Error on your browser")
+ })
+ }
+ const updatePassword = () => {
+ setError(null)
+ Axios.post(`${api}/user/updatepassword`, { email: email, password: password }).then((res) => {
+ if (res.data.message == "success") {
+ setStatus("login")
+ } else {
+ setError(res.data.message)
+ }
+ }).catch(() => {
+ setError("Error on your browser")
+ })
+ }
+
return (
-
-
- Welcome
-
-
- Sign in to continue!
-
-
-
-
- Email ID
- setEmail(text)} />
-
-
- Password
- setPassword(text)}
- type="password"
- />
-
-
-
+ Welcome
+
+
+ Sign in to continue!
+
+
+
+
+ Email ID
+ setEmail(text)} />
+
+
+ Password
+ setPassword(text)}
+ type="password"
+ />
+
{ setStatus("email") }}
>
- I'm a new user.
+ forgot password
-
+
+
- Sign Up
+ I'm a new user.
-
-
+
+
+ Sign Up
+
+
+
+ {/* Google Login starts*/}
+
+
+ Or
+
+
+
+
+
+ {/* Google Login */}
+
+
+ }
+ < Box safeArea p="2" py="8" w="90%" maxW="290">
+
+ {status == "email" &&
+
+ {error}
+
+ Enter Email ID
+ setEmail(text)} />
+
+
+
+ }
+ {status == "verification" &&
+
+ {error}
+
+ Enter Verification code
+ setCode(text)} />
+
+
+ }
+ {status == "confirm" &&
+
+ {error}
+
+ Enter new password
+ setPassword(text)} />
+
+
+
+ }
{loginUser.isSuccess && router.push("/")}
-
+
);
+
}
diff --git a/client/screens/RegisterScreen.js b/client/screens/RegisterScreen.js
index 8198aba3ce..8413adc079 100644
--- a/client/screens/RegisterScreen.js
+++ b/client/screens/RegisterScreen.js
@@ -8,11 +8,14 @@ import {
Center,
HStack,
Text,
+ View
} from "native-base";
-import { useState } from "react";
+
+import { useState, useEffect } from "react";
import useRegister from "../hooks/useRegister";
import { useRouter } from "expo-router";
import { Link } from "expo-router";
+import { signInWithGoogle } from "./firebase";
export default function Register() {
const [name, setName] = useState("");
@@ -64,7 +67,7 @@ export default function Register() {
/>