From b5a1ff37ea45dcf1b74248270c25a0bc576f6b65 Mon Sep 17 00:00:00 2001 From: MK-codes365 Date: Sat, 24 Jan 2026 22:59:25 +0530 Subject: [PATCH] prod: configure production backend and emulator setup --- frontend/app.config.ts | 27 ++++------ frontend/package-lock.json | 22 ++++++-- frontend/src/apiConfig.ts | 7 +++ frontend/src/screens/HomeScreen.tsx | 24 +++++---- frontend/src/screens/MapScreen.tsx | 36 ++++++------- frontend/src/screens/MyUploadsScreen.tsx | 54 +++++++------------ frontend/src/screens/ProfileScreen.tsx | 4 +- frontend/src/screens/RegisterUserScreen.tsx | 17 +++--- .../src/screens/UploadConfirmationScreen.tsx | 14 ++--- 9 files changed, 99 insertions(+), 106 deletions(-) create mode 100644 frontend/src/apiConfig.ts diff --git a/frontend/app.config.ts b/frontend/app.config.ts index c0ff863..fea8f9e 100644 --- a/frontend/app.config.ts +++ b/frontend/app.config.ts @@ -1,8 +1,3 @@ -import getLocalIPAddress from "./getLocalIPAddress.ts"; -import { API_BASE_URL } from "./src/screens/RegisterUserScreen.tsx"; - -const ip = getLocalIPAddress(); - export default { name: "Snap Map", slug: "snap-map", @@ -18,8 +13,9 @@ export default { bundleIdentifier: "com.snapmap.app", infoPlist: { NSCameraUsageDescription: "Allow Snap Map to access your camera.", - NSLocationWhenInUseUsageDescription: "Allow Snap Map to access your location while using the app." - } + NSLocationWhenInUseUsageDescription: + "Allow Snap Map to access your location while using the app.", + }, }, android: { @@ -30,8 +26,8 @@ export default { foregroundImage: "./src/assets/images/icon.png", backgroundColor: "#E6F4FE", backgroundImage: "./src/assets/images/android-icon-background.png", - monochromeImage: "./src/assets/images/android-icon-monochrome.png" - } + monochromeImage: "./src/assets/images/android-icon-monochrome.png", + }, }, plugins: [ @@ -42,17 +38,16 @@ export default { imageWidth: 200, resizeMode: "contain", backgroundColor: "#ffffff", - dark: { backgroundColor: "#000000" } - } - ] + dark: { backgroundColor: "#000000" }, + }, + ], ], experiments: { - reactCompiler: true + reactCompiler: true, }, extra: { - // API_BASE_URL: `https://snapmap.onrender.com` - API_BASE_URL: `http://${ip}:5000` - } + API_BASE_URL: "https://snapmap.onrender.com" + }, }; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0b0b47e..766c271 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -87,6 +87,7 @@ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.28.5.tgz", "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -1379,7 +1380,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.27.1.tgz", "integrity": "sha512-fBJKiV7F2DxZUkg5EtHKXQdbsbURW3DZKQUWphDum0uRP6eHGGa/He9mc0mypL680pb+e/lDIthRohlv8NCHkg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.27.1" }, @@ -2933,6 +2933,7 @@ "resolved": "https://registry.npmjs.org/@react-navigation/native/-/native-7.1.26.tgz", "integrity": "sha512-RhKmeD0E2ejzKS6z8elAfdfwShpcdkYY8zJzvHYLq+wv183BBcElTeyMLcIX6wIn7QutXeI92Yi21t7aUWfqNQ==", "license": "MIT", + "peer": true, "dependencies": { "@react-navigation/core": "^7.13.7", "escape-string-regexp": "^4.0.0", @@ -3104,6 +3105,7 @@ "integrity": "sha512-Qec1E3mhALmaspIrhWt9jkQMNdw6bReVu64mjvhbhq2NFPftLPVr+l1SZgmw/66WwBNpDh7ao5AT6gF5v41PFA==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "csstype": "^3.0.2" } @@ -3729,6 +3731,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -4559,6 +4562,7 @@ "resolved": "https://registry.npmjs.org/expo/-/expo-54.0.31.tgz", "integrity": "sha512-kQ3RDqA/a59I7y+oqQGyrPbbYlgPMUdKBOgvFLpoHbD2bCM+F75i4N0mUijy7dG5F/CUCu2qHmGGUCXBbMDkCg==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.20.0", "@expo/cli": "54.0.21", @@ -4626,6 +4630,7 @@ "resolved": "https://registry.npmjs.org/expo-auth-session/-/expo-auth-session-7.0.10.tgz", "integrity": "sha512-XDnKkudvhHSKkZfJ+KkodM+anQcrxB71i+h0kKabdLa5YDXTQ81aC38KRc3TMqmnBDHAu0NpfbzEVd9WDFY3Qg==", "license": "MIT", + "peer": true, "dependencies": { "expo-application": "~7.0.8", "expo-constants": "~18.0.11", @@ -4720,6 +4725,7 @@ "resolved": "https://registry.npmjs.org/expo-font/-/expo-font-14.0.10.tgz", "integrity": "sha512-UqyNaaLKRpj4pKAP4HZSLnuDQqueaO5tB1c/NWu5vh1/LF9ulItyyg2kF/IpeOp0DeOLk0GY0HrIXaKUMrwB+Q==", "license": "MIT", + "peer": true, "dependencies": { "fontfaceobserver": "^2.1.0" }, @@ -4902,6 +4908,7 @@ "resolved": "https://registry.npmjs.org/expo-web-browser/-/expo-web-browser-15.0.10.tgz", "integrity": "sha512-fvDhW4bhmXAeWFNFiInmsGCK83PAqAcQaFyp/3pE/jbdKmFKoRCWr46uZGIfN4msLK/OODhaQ/+US7GSJNDHJg==", "license": "MIT", + "peer": true, "peerDependencies": { "expo": "*", "react-native": "*" @@ -7563,6 +7570,7 @@ "resolved": "https://registry.npmjs.org/react/-/react-19.1.0.tgz", "integrity": "sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -7582,6 +7590,7 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.0.tgz", "integrity": "sha512-Xs1hdnE+DyKgeHJeJznQmYMIBG3TKIHJJT95Q58nHLSrElKlGQqDTR2HQ9fx5CN/Gk6Vh/kupBTDLU11/nDk/g==", "license": "MIT", + "peer": true, "dependencies": { "scheduler": "^0.26.0" }, @@ -7612,6 +7621,7 @@ "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.81.5.tgz", "integrity": "sha512-1w+/oSjEXZjMqsIvmkCRsOc8UBYv163bTWKTI8+1mxztvQPhCRYGTvZ/PL1w16xXHneIj/SLGfxWg2GWN2uexw==", "license": "MIT", + "peer": true, "dependencies": { "@jest/create-cache-key-function": "^29.7.0", "@react-native/assets-registry": "0.81.5", @@ -7730,6 +7740,7 @@ "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-4.1.6.tgz", "integrity": "sha512-F+ZJBYiok/6Jzp1re75F/9aLzkgoQCOh4yxrnwATa8392RvM3kx+fiXXFvwcgE59v48lMwd9q0nzF1oJLXpfxQ==", "license": "MIT", + "peer": true, "dependencies": { "react-native-is-edge-to-edge": "^1.2.1", "semver": "7.7.2" @@ -7758,6 +7769,7 @@ "resolved": "https://registry.npmjs.org/react-native-safe-area-context/-/react-native-safe-area-context-5.6.2.tgz", "integrity": "sha512-4XGqMNj5qjUTYywJqpdWZ9IG8jgkS3h06sfVjfw5yZQZfWnRFXczi0GnYyFyCc2EBps/qFmoCH8fez//WumdVg==", "license": "MIT", + "peer": true, "peerDependencies": { "react": "*", "react-native": "*" @@ -7768,6 +7780,7 @@ "resolved": "https://registry.npmjs.org/react-native-screens/-/react-native-screens-4.16.0.tgz", "integrity": "sha512-yIAyh7F/9uWkOzCi1/2FqvNvK6Wb9Y1+Kzn16SuGfN9YFJDTbwlzGRvePCNTOX0recpLQF3kc2FmvMUhyTCH1Q==", "license": "MIT", + "peer": true, "dependencies": { "react-freeze": "^1.0.0", "react-native-is-edge-to-edge": "^1.2.1", @@ -7798,6 +7811,7 @@ "resolved": "https://registry.npmjs.org/react-native-web/-/react-native-web-0.21.2.tgz", "integrity": "sha512-SO2t9/17zM4iEnFvlu2DA9jqNbzNhoUP+AItkoCOyFmDMOhUnBBznBDCYN92fGdfAkfQlWzPoez6+zLxFNsZEg==", "license": "MIT", + "peer": true, "dependencies": { "@babel/runtime": "^7.18.6", "@react-native/normalize-colors": "^0.74.1", @@ -7830,7 +7844,6 @@ "resolved": "https://registry.npmjs.org/react-native-worklets/-/react-native-worklets-0.7.1.tgz", "integrity": "sha512-KNsvR48ULg73QhTlmwPbdJLPsWcyBotrGPsrDRDswb5FYpQaJEThUKc2ncXE4UM5dn/ewLoQHjSjLaKUVPxPhA==", "license": "MIT", - "peer": true, "dependencies": { "@babel/plugin-transform-arrow-functions": "7.27.1", "@babel/plugin-transform-class-properties": "7.27.1", @@ -7855,7 +7868,6 @@ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-optional-chaining/-/plugin-transform-optional-chaining-7.27.1.tgz", "integrity": "sha512-BQmKPPIuc8EkZgNKsv0X4bPmOoayeu4F1YCwx2/CfmDSXDbp7GnzlUH+/ul5VGfRg1AoFPsrIThlEBj2xb4CAg==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-skip-transparent-expression-wrappers": "^7.27.1" @@ -7872,7 +7884,6 @@ "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.27.1.tgz", "integrity": "sha512-l7WfQfX0WK4M0v2RudjuQK4u99BS6yLHYEmdtVPP7lKV013zr9DygFuWNlnbvQ9LR+LS0Egz/XAvGx5U9MX0fQ==", "license": "MIT", - "peer": true, "dependencies": { "@babel/helper-plugin-utils": "^7.27.1", "@babel/helper-validator-option": "^7.27.1", @@ -7892,7 +7903,6 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", "license": "ISC", - "peer": true, "bin": { "semver": "bin/semver.js" }, @@ -8001,6 +8011,7 @@ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.14.2.tgz", "integrity": "sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA==", "license": "MIT", + "peer": true, "engines": { "node": ">=0.10.0" } @@ -8945,6 +8956,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, diff --git a/frontend/src/apiConfig.ts b/frontend/src/apiConfig.ts new file mode 100644 index 0000000..1e0c6bf --- /dev/null +++ b/frontend/src/apiConfig.ts @@ -0,0 +1,7 @@ +import Constants from "expo-constants"; + +export const API_BASE_URL = Constants.expoConfig?.extra?.API_BASE_URL; + +if (!API_BASE_URL) { + console.warn("API_BASE_URL is not defined in the Expo configuration."); +} diff --git a/frontend/src/screens/HomeScreen.tsx b/frontend/src/screens/HomeScreen.tsx index c8c0151..66ae772 100644 --- a/frontend/src/screens/HomeScreen.tsx +++ b/frontend/src/screens/HomeScreen.tsx @@ -8,7 +8,10 @@ import { StatusBar, Image, } from "react-native"; -import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context"; +import { + SafeAreaView, + useSafeAreaInsets, +} from "react-native-safe-area-context"; import { Dimensions } from "react-native"; import { Ionicons, MaterialCommunityIcons } from "@expo/vector-icons"; import MapView, { Marker, PROVIDER_GOOGLE } from "react-native-maps"; @@ -18,12 +21,11 @@ import { useUser } from "@clerk/clerk-expo"; import HomeStyle from "../styles/HomeStyle"; import BottomNavigation from "../navigation/BottomNavigation"; import Constants from "expo-constants"; +import { API_BASE_URL } from "../apiConfig"; import { useProfile } from "../context/ProfileContext"; const styles = HomeStyle; -const API_BASE_URL = - Constants.expoConfig?.extra?.API_BASE_URL ?? "http://localhost:5000"; const DEFAULT_RADIUS_METERS = 300; type Coordinates = { @@ -58,7 +60,7 @@ const HomeScreen = ({ navigation }: ScreenProps<"HomeScreen">) => { headers: { "Content-Type": "application/json", }, - } + }, ); if (!response.ok) { @@ -101,7 +103,7 @@ const HomeScreen = ({ navigation }: ScreenProps<"HomeScreen">) => { }; } else { console.warn( - "Location permission not granted, using default location for nearby photos" + "Location permission not granted, using default location for nearby photos", ); } } catch (error) { @@ -153,7 +155,11 @@ const HomeScreen = ({ navigation }: ScreenProps<"HomeScreen">) => { style={styles.profileImage} /> ) : ( - + )} @@ -225,11 +231,7 @@ const HomeScreen = ({ navigation }: ScreenProps<"HomeScreen">) => { onPress={() => navigation.navigate("MapScreen")} > - + Tap to explore diff --git a/frontend/src/screens/MapScreen.tsx b/frontend/src/screens/MapScreen.tsx index 3996908..3851533 100644 --- a/frontend/src/screens/MapScreen.tsx +++ b/frontend/src/screens/MapScreen.tsx @@ -15,14 +15,13 @@ import { SafeAreaView } from "react-native-safe-area-context"; import MapStyle from "../styles/MapStyle"; import BottomNavigation from "../navigation/BottomNavigation"; import Constants from "expo-constants"; +import { API_BASE_URL } from "../apiConfig"; import { useProfile } from "../context/ProfileContext"; import { useUser } from "@clerk/clerk-expo"; import SnapScreen from "./SnapScreen"; const styles = MapStyle; -const API_BASE_URL = - Constants.expoConfig?.extra?.API_BASE_URL ?? "http://localhost:5000"; const DEFAULT_RADIUS_METERS = 300; type Coordinates = { @@ -73,7 +72,7 @@ const MapScreen = ({ navigation }: ScreenProps<"MapScreen">) => { headers: { "Content-Type": "application/json", }, - } + }, ); if (!response.ok) { @@ -144,25 +143,24 @@ const MapScreen = ({ navigation }: ScreenProps<"MapScreen">) => { showsMyLocationButton > {photos.map((photo, idx) => ( - + navigation.navigate("SnapScreen", { - imageURL: photo.imageURL, - caption: photo.caption, - latitude: photo.latitude, - longitude: photo.longitude, - })} - + key={photo.id} + coordinate={{ + latitude: photo.latitude, + longitude: photo.longitude, + }} + image={photo.imageURL.length === 1 ? singlePhoto : multiPhoto} + onPress={() => + navigation.navigate("SnapScreen", { + imageURL: photo.imageURL, + caption: photo.caption, + latitude: photo.latitude, + longitude: photo.longitude, + }) + } /> - ))} diff --git a/frontend/src/screens/MyUploadsScreen.tsx b/frontend/src/screens/MyUploadsScreen.tsx index db77cc1..47820b5 100644 --- a/frontend/src/screens/MyUploadsScreen.tsx +++ b/frontend/src/screens/MyUploadsScreen.tsx @@ -12,6 +12,7 @@ import { import { useNavigation } from "@react-navigation/native"; import { Ionicons } from "@expo/vector-icons"; import Constants from "expo-constants"; +import { API_BASE_URL } from "../apiConfig"; import { useUser, useAuth } from "@clerk/clerk-expo"; import { myUploadsStyles } from "../styles/MyUploadsStyle"; import { useProfile } from "../context/ProfileContext"; @@ -22,9 +23,6 @@ import { } from "../utils/photoHelpers"; import Toast from "../components/Toast"; -const API_BASE_URL = - Constants.expoConfig?.extra?.API_BASE_URL ?? "http://localhost:5000"; - type FilterKey = "All" | "Events" | "Places" | "Recent"; const filterOptions: { key: FilterKey; label: string }[] = [ { key: "All", label: "All" }, @@ -55,7 +53,6 @@ const MyUploadsScreen: React.FC = () => { success: true, }); - useEffect(() => { if (user?.id) { fetchUploads(user.id); @@ -66,7 +63,7 @@ const MyUploadsScreen: React.FC = () => { setIsLoading(true); try { const response = await fetch( - `${API_BASE_URL}/api/v1/photos/get-user-photos/${clerkId}` + `${API_BASE_URL}/api/v1/photos/get-user-photos/${clerkId}`, ); const rawData = await response.json(); const normalized = normalizeUserUploads(rawData); @@ -129,13 +126,10 @@ const MyUploadsScreen: React.FC = () => { } }; - const filteredUploads = useMemo(() => { let list = uploads; if (selectedFilter === "Events") { - list = uploads.filter( - (u) => u.badge === "live" || u.badge === "ended" - ); + list = uploads.filter((u) => u.badge === "live" || u.badge === "ended"); } else if (selectedFilter === "Recent") { list = [...uploads].sort((a, b) => { const ta = a.timestamp ? new Date(a.timestamp).getTime() : 0; @@ -147,19 +141,22 @@ const MyUploadsScreen: React.FC = () => { }, [uploads, selectedFilter]); const groupedUploads = useMemo(() => { - return filteredUploads.reduce((acc, upload) => { - const section = - upload.badge === "live" || upload.badge === "ended" - ? "THIS WEEK" - : "RECENT"; - if (!acc[section]) acc[section] = []; - acc[section].push(upload); - return acc; - }, {} as Record); + return filteredUploads.reduce( + (acc, upload) => { + const section = + upload.badge === "live" || upload.badge === "ended" + ? "THIS WEEK" + : "RECENT"; + if (!acc[section]) acc[section] = []; + acc[section].push(upload); + return acc; + }, + {} as Record, + ); }, [filteredUploads]); const eventsJoined = uploads.filter( - (upload) => upload.badge === "live" || upload.badge === "ended" + (upload) => upload.badge === "live" || upload.badge === "ended", ).length; // ---------------- SLIDER ---------------- @@ -175,7 +172,7 @@ const MyUploadsScreen: React.FC = () => { const goPrev = () => { if (filteredUploads.length <= 1) return; setActiveIndex((prev) => - prev === 0 ? filteredUploads.length - 1 : prev - 1 + prev === 0 ? filteredUploads.length - 1 : prev - 1, ); }; @@ -184,7 +181,6 @@ const MyUploadsScreen: React.FC = () => { setActiveIndex((prev) => (prev + 1) % filteredUploads.length); }; - const currentUpload = filteredUploads[activeIndex] || filteredUploads[0]; const sliderCaption = currentUpload?.caption || currentUpload?.location || "Shared snap"; @@ -195,11 +191,7 @@ const MyUploadsScreen: React.FC = () => { const label = badge === "live" ? "LIVE" : badge === "ended" ? "ENDED" : "FEATURED"; const background = - badge === "live" - ? "#FFEDEE" - : badge === "ended" - ? "#1A1A1A" - : "#FFF7E0"; + badge === "live" ? "#FFEDEE" : badge === "ended" ? "#1A1A1A" : "#FFF7E0"; const color = badge === "ended" ? "#fff" : badge === "live" ? "#FF4D6D" : "#A87D2D"; @@ -318,11 +310,7 @@ const MyUploadsScreen: React.FC = () => { {formatTimestamp(upload.timestamp)} - + { - - {sliderCaption} - + {sliderCaption} {sliderTimestamp} diff --git a/frontend/src/screens/ProfileScreen.tsx b/frontend/src/screens/ProfileScreen.tsx index 6670b89..1e10bc3 100644 --- a/frontend/src/screens/ProfileScreen.tsx +++ b/frontend/src/screens/ProfileScreen.tsx @@ -16,14 +16,12 @@ import { Ionicons } from "@expo/vector-icons"; import * as ImagePicker from "expo-image-picker"; import { useAuth, useUser } from "@clerk/clerk-expo"; import Constants from "expo-constants"; +import { API_BASE_URL } from "../apiConfig"; import type { ScreenProps } from "../types"; import ProfileStyle from "../styles/ProfileStyle"; import { useProfile } from "../context/ProfileContext"; import Toast from "../components/Toast"; -const API_BASE_URL = - Constants.expoConfig?.extra?.API_BASE_URL ?? "http://localhost:5000"; - const styles = ProfileStyle; const YEAR_OPTIONS = ["1st", "2nd", "3rd", "4th", "5th", "Graduate", "Other"]; diff --git a/frontend/src/screens/RegisterUserScreen.tsx b/frontend/src/screens/RegisterUserScreen.tsx index c2361cb..f44a8b4 100644 --- a/frontend/src/screens/RegisterUserScreen.tsx +++ b/frontend/src/screens/RegisterUserScreen.tsx @@ -14,6 +14,7 @@ import { useUser, useAuth } from "@clerk/clerk-expo"; import { Ionicons } from "@expo/vector-icons"; import { ScreenProps } from "../types"; import Constants from "expo-constants"; +import { API_BASE_URL } from "../apiConfig"; import LocationIcon from "../assets/icons/LocationIcon"; import PersonIcon from "../assets/icons/PersonIcon"; import Toast from "../components/Toast"; @@ -24,13 +25,11 @@ const GENDER_OPTIONS = ["male", "female", "others"]; // Year options - frontend enum const YEAR_OPTIONS = ["1st", "2nd", "3rd", "4th", "5th", "Graduate", "Other"]; -// Use API base URL from environment variable -export const API_BASE_URL = - Constants.expoConfig?.extra?.API_BASE_URL ?? "http://localhost:5000"; - const styles = RegisterUserStyle; -const RegisterUserScreen = ({ navigation }: ScreenProps<"RegisterUserScreen">) => { +const RegisterUserScreen = ({ + navigation, +}: ScreenProps<"RegisterUserScreen">) => { const { user } = useUser(); const { getToken } = useAuth(); @@ -76,7 +75,7 @@ const RegisterUserScreen = ({ navigation }: ScreenProps<"RegisterUserScreen">) = if (!validateForm()) { Alert.alert( "Validation Error", - "Please fill in all required fields correctly" + "Please fill in all required fields correctly", ); return; } @@ -103,7 +102,7 @@ const RegisterUserScreen = ({ navigation }: ScreenProps<"RegisterUserScreen">) = if (!token) { Alert.alert( "Error", - "Authentication token not available. Please sign in again." + "Authentication token not available. Please sign in again.", ); setIsSubmitting(false); return; @@ -166,7 +165,8 @@ const RegisterUserScreen = ({ navigation }: ScreenProps<"RegisterUserScreen">) = Join SnapMap - Connect with your campus{"\n"}community and see what's{"\n"}trending nearby + Connect with your campus{"\n"}community and see what's{"\n"}trending + nearby @@ -253,7 +253,6 @@ const RegisterUserScreen = ({ navigation }: ScreenProps<"RegisterUserScreen">) = success={false} onHide={() => setShowErrorToast(false)} /> - ); }; diff --git a/frontend/src/screens/UploadConfirmationScreen.tsx b/frontend/src/screens/UploadConfirmationScreen.tsx index ee6ce4d..34fec63 100644 --- a/frontend/src/screens/UploadConfirmationScreen.tsx +++ b/frontend/src/screens/UploadConfirmationScreen.tsx @@ -10,6 +10,7 @@ import { Dimensions, } from "react-native"; import Constants from "expo-constants"; +import { API_BASE_URL } from "../apiConfig"; import { useAuth } from "@clerk/clerk-expo"; import type { ScreenProps } from "../types"; import UploadConfirmationStyle from "../styles/UploadConfirmationStyle"; @@ -18,9 +19,6 @@ import Toast from "../components/Toast"; const styles = UploadConfirmationStyle; const { width } = Dimensions.get("window"); -const API_BASE_URL = - Constants.expoConfig?.extra?.API_BASE_URL ?? "http://localhost:5000"; - const UploadConfirmationScreen = ({ navigation, route, @@ -122,9 +120,7 @@ const UploadConfirmationScreen = ({ navigation.goBack()}> - - New Post ({photosToUpload.length}) - + New Post ({photosToUpload.length}) @@ -154,7 +150,6 @@ const UploadConfirmationScreen = ({ ))} - @@ -176,8 +171,9 @@ const UploadConfirmationScreen = ({ {isUploading ? "Uploading..." - : `Post ${photosToUpload.length} Photo${photosToUpload.length > 1 ? "s" : "" - } >`} + : `Post ${photosToUpload.length} Photo${ + photosToUpload.length > 1 ? "s" : "" + } >`}