From 2909c3da2b06c7ad7aa72bdac1e2f210b464e5ab Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Wed, 17 Apr 2024 19:42:03 -0600 Subject: [PATCH 1/3] =?UTF-8?q?Reparaci=C3=B3n=20del=20enrutamiento=20de?= =?UTF-8?q?=20la=20aplicaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/app/state/[id]/activity.tsx | 19 ------- mobile/app/state/[id]/town.tsx | 18 ------ mobile/app/state/[stateId]/index.tsx | 12 ++++ .../[townId]/activity/[activityId]/index.tsx | 13 +++++ .../[townId]/activity/[activityId]/travel.tsx | 9 +++ .../town/[townId]/activity/_layout.tsx | 13 +++++ .../state/[stateId]/town/[townId]/index.tsx | 13 +++++ mobile/app/state/[stateId]/town/_layout.tsx | 23 ++++++++ mobile/app/state/_layout.tsx | 55 +++++++++---------- mobile/app/state/index.tsx | 18 ------ 10 files changed, 108 insertions(+), 85 deletions(-) delete mode 100644 mobile/app/state/[id]/activity.tsx delete mode 100644 mobile/app/state/[id]/town.tsx create mode 100644 mobile/app/state/[stateId]/index.tsx create mode 100644 mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/index.tsx create mode 100644 mobile/app/state/[stateId]/town/[townId]/activity/[activityId]/travel.tsx create mode 100644 mobile/app/state/[stateId]/town/[townId]/activity/_layout.tsx create mode 100644 mobile/app/state/[stateId]/town/[townId]/index.tsx create mode 100644 mobile/app/state/[stateId]/town/_layout.tsx delete mode 100644 mobile/app/state/index.tsx diff --git a/mobile/app/state/[id]/activity.tsx b/mobile/app/state/[id]/activity.tsx deleted file mode 100644 index 9840959f..00000000 --- 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 76702402..00000000 --- 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 00000000..61456b99 --- /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 00000000..40d153ab --- /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 00000000..b5c9f272 --- /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 00000000..02fde054 --- /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 00000000..49bcbfa4 --- /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 00000000..b7875621 --- /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 c7d8879b..4394434c 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 fca09375..00000000 --- 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 -- GitLab From 9586aed71178e40c626a8a9837b932e2c8ceff47 Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Wed, 17 Apr 2024 20:44:49 -0600 Subject: [PATCH 2/3] =?UTF-8?q?Se=20modific=C3=B3=20la=20l=C3=B3gica=20de?= =?UTF-8?q?=20la=20lectura=20de=20los=20c=C3=B3digos=20qr=20para=20que=20r?= =?UTF-8?q?edirijan=20a=20una=20p=C3=A1gina=20de=20actividad?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/hooks/useQRScanner.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mobile/src/hooks/useQRScanner.ts b/mobile/src/hooks/useQRScanner.ts index ab550480..bddddd31 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) { -- GitLab From 5b82940af202f3989bc5d07421b4423e4a4e55dd Mon Sep 17 00:00:00 2001 From: Lorenzo Trujillo Date: Wed, 17 Apr 2024 20:45:08 -0600 Subject: [PATCH 3/3] =?UTF-8?q?Se=20actualizaron=20las=20rutas=20en=20la?= =?UTF-8?q?=20aplicaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/screens/state_selection/state_selection_page.tsx | 2 +- mobile/src/screens/town_activities/town_activities_page.tsx | 2 +- mobile/src/screens/town_selection/town_selection_page.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile/src/screens/state_selection/state_selection_page.tsx b/mobile/src/screens/state_selection/state_selection_page.tsx index 0e7bca16..76683663 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 ff96af23..06956ca3 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 aea752ee..0be19146 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 ( -- GitLab