diff --git a/mobile/app/state/[id]/activity.tsx b/mobile/app/state/[id]/activity.tsx deleted file mode 100644 index 9840959f65c3decafa7bbb7efe9385be7d38bee3..0000000000000000000000000000000000000000 --- a/mobile/app/state/[id]/activity.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { useLocalSearchParams } from "expo-router"; -import { View, Text } from "react-native"; -import { ActivityDescriptionPage } from "../../../src/screens/activity_description/activity_description_page"; - -export default function ActivityScreen() { - const { id, townId, activityId } = useLocalSearchParams<{ id: string, townId: string, activityId: string }>(); - - if (!townId || !id || !activityId) { - return ( - - Invalid activity id - - ); - } - - return ( - - ); -} \ No newline at end of file diff --git a/mobile/app/state/[id]/town.tsx b/mobile/app/state/[id]/town.tsx deleted file mode 100644 index 7670240241e4221ef87cfbf25703f438b16d6931..0000000000000000000000000000000000000000 --- a/mobile/app/state/[id]/town.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { useLocalSearchParams } from "expo-router"; -import { View, Text } from "react-native"; -import { TownActivitiesPage } from "../../../src/screens/town_activities/town_activities_page"; - -export default function TownScreen() { - const { id, townId } = useLocalSearchParams<{ id: string, townId: string }>(); - console.log(id, townId); - if (!townId || !id) { - return ( - - Invalid town id - - ); - } - return ( - - ); -} \ No newline at end of file diff --git a/mobile/app/state/[stateId]/index.tsx b/mobile/app/state/[stateId]/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..61456b9916f58f1fce4fbcd52791935c4db3204d --- /dev/null +++ b/mobile/app/state/[stateId]/index.tsx @@ -0,0 +1,12 @@ +import { useLocalSearchParams } from "expo-router"; +import { TownSelectionPage } from "../../../src/screens/town_selection/town_selection_page"; + +export default function Index() { + const { stateId } = useLocalSearchParams<{stateId: string}>(); + if (!stateId) { + throw new Error("stateId is required"); + } + return ( + + ); +} \ No newline at end of file diff --git a/mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/index.tsx b/mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..40d153ab1766e47fb06125fe80d4fcb873b00fcc --- /dev/null +++ b/mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/index.tsx @@ -0,0 +1,13 @@ +import { useLocalSearchParams } from "expo-router"; +import { ActivityDescriptionPage } from "../../../../../../../src/screens/activity_description/activity_description_page"; + +export default function ActivitySelectionScreen() { + const { activityId, stateId, townId } = useLocalSearchParams<{activityId: string, stateId: string, townId: string}>(); + if (!activityId || !stateId || !townId) { + throw new Error("activityId, stateId and townId are required"); + } + + return ( + + ); +} \ No newline at end of file diff --git a/mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/travel.tsx b/mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/travel.tsx new file mode 100644 index 0000000000000000000000000000000000000000..b5c9f27212b4bb504ea98296d52e328237efcd79 --- /dev/null +++ b/mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/travel.tsx @@ -0,0 +1,9 @@ +import { View, Text } from "react-native"; + +export default function Travel() { + return ( + + Travel + + ); +} \ No newline at end of file diff --git a/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx b/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx new file mode 100644 index 0000000000000000000000000000000000000000..02fde054082c18137b8722d15cf47b1958c531c7 --- /dev/null +++ b/mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx @@ -0,0 +1,13 @@ +import { Stack } from "expo-router"; + +export default function ActivitySelectionScreen() { + return ( + + + + ); +} \ No newline at end of file diff --git a/mobile/app/state/[stateId]/town/[townId]/index.tsx b/mobile/app/state/[stateId]/town/[townId]/index.tsx new file mode 100644 index 0000000000000000000000000000000000000000..49bcbfa41c29b783374a48e137a9a4ffbf429801 --- /dev/null +++ b/mobile/app/state/[stateId]/town/[townId]/index.tsx @@ -0,0 +1,13 @@ +import { useLocalSearchParams } from "expo-router"; +import { TownSelectionPage } from "../../../../../src/screens/town_selection/town_selection_page"; +import { TownActivitiesPage } from "../../../../../src/screens/town_activities/town_activities_page"; + +export default function TownSelectionScreen() { + const { stateId, townId } = useLocalSearchParams<{stateId: string, townId: string}>(); + if (!stateId || !townId) { + throw new Error("stateId and townId are required"); + } + return ( + + ); +} \ No newline at end of file diff --git a/mobile/app/state/[stateId]/town/_layout.tsx b/mobile/app/state/[stateId]/town/_layout.tsx new file mode 100644 index 0000000000000000000000000000000000000000..b787562191df6f89094a0b9b2638e8d52f557353 --- /dev/null +++ b/mobile/app/state/[stateId]/town/_layout.tsx @@ -0,0 +1,23 @@ +import { Stack } from "expo-router"; +import { LIGTHT_THEME } from "../../../../src/constants/theme"; + +export default function Layout() { + return ( + + + + + ); +} \ No newline at end of file diff --git a/mobile/app/state/_layout.tsx b/mobile/app/state/_layout.tsx index c7d8879b0cee1c68036c501cca550d843a9c485c..4394434c4ad3e397526f5a4ec10ad6338260e6d7 100644 --- a/mobile/app/state/_layout.tsx +++ b/mobile/app/state/_layout.tsx @@ -1,34 +1,29 @@ import { Stack } from "expo-router"; -import { View } from "react-native"; import { LIGTHT_THEME } from "../../src/constants/theme"; - export default function Layout() { - return ( - - - - - {/* */} - - ); -} \ No newline at end of file + return ( + + + + + ); +} diff --git a/mobile/app/state/index.tsx b/mobile/app/state/index.tsx deleted file mode 100644 index fca093757f569f60c3e8840602251c9ee49327ee..0000000000000000000000000000000000000000 --- a/mobile/app/state/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { View, Text } from "react-native"; -import { TownSelectionPage } from "../../src/screens/town_selection/town_selection_page"; -import { useLocalSearchParams } from "expo-router"; -import { FullPageLoader } from "../../src/components/full_page_loader/full_page_loader"; - -export default function Main () { - const { id } = useLocalSearchParams<{ id: string }>(); - console.log(id); - if (!id) { - return ( - - ); - } - console.log(id); - return ( - - ); -} \ No newline at end of file diff --git a/mobile/src/hooks/useQRScanner.ts b/mobile/src/hooks/useQRScanner.ts index ab550480ca2546488464b47ccddc1e9bc3dae227..bddddd319393dd4911e91c67d93bc76a2d13b49c 100644 --- a/mobile/src/hooks/useQRScanner.ts +++ b/mobile/src/hooks/useQRScanner.ts @@ -2,6 +2,7 @@ import { useEffect, useState } from "react"; import * as SecureStore from "expo-secure-store"; import { Camera, PermissionResponse } from "expo-camera"; import { BarCodeScannerResult } from "expo-barcode-scanner"; +import { router } from "expo-router"; export const useQRScanner = () => { const [status, requestPermission] = Camera.useCameraPermissions(); @@ -19,6 +20,7 @@ export const useQRScanner = () => { console.log(data.data); setQRData(data.data); setScanning(false); + router.replace(data.data); }; useEffect(() => { if (status?.granted) { diff --git a/mobile/src/screens/state_selection/state_selection_page.tsx b/mobile/src/screens/state_selection/state_selection_page.tsx index 0e7bca163c1e422938a23be44aba436b7dae16e7..766836635766a6ce8f48f835de192470a944ae5c 100644 --- a/mobile/src/screens/state_selection/state_selection_page.tsx +++ b/mobile/src/screens/state_selection/state_selection_page.tsx @@ -21,7 +21,7 @@ export const StateSelectionPage = () => { } const handleOnPress = (id: number) => { - router.push(`/state?id=${id}`); + router.push(`/state/${id}`); }; return ( diff --git a/mobile/src/screens/town_activities/town_activities_page.tsx b/mobile/src/screens/town_activities/town_activities_page.tsx index ff96af23ede2bdff1fe1635dcc7b694db05dd757..06956ca365d2d8d35aa4ae2becfa63d372637a44 100644 --- a/mobile/src/screens/town_activities/town_activities_page.tsx +++ b/mobile/src/screens/town_activities/town_activities_page.tsx @@ -27,7 +27,7 @@ export const TownActivitiesPage = ({ townId, stateId }: TownActivitiesPageProps) } const handleViewActivity = (activityId: number) =>{ - router.push(`/state/${stateId}/activity?townId=${townId}&activityId=${activityId}`); + router.push(`/state/${stateId}/town/${townId}/activity/${activityId}/`); } return ( diff --git a/mobile/src/screens/town_selection/town_selection_page.tsx b/mobile/src/screens/town_selection/town_selection_page.tsx index aea752eebe98f79ac9563ed8615df5487696bd2a..0be191467572cb4a73975574bee9480f535d1159 100644 --- a/mobile/src/screens/town_selection/town_selection_page.tsx +++ b/mobile/src/screens/town_selection/town_selection_page.tsx @@ -38,7 +38,7 @@ export const TownSelectionPage = ({ stateId }: TownSelectionPageProps) => { } const handleTownSelection = (townId: number) => { - router.push(`/state/${stateId}/town?townId=${townId}`); + router.push(`/state/${stateId}/town/${townId}`); }; return (