From 03e0b48ea1a729d5e3a80dca4b83eb778f597c97 Mon Sep 17 00:00:00 2001 From: godetremy Date: Wed, 3 Jun 2026 23:54:18 +0200 Subject: [PATCH 01/17] feat: add restaurant service to service selection --- app/(onboarding)/serviceSelection.tsx | 183 ++++++++++++++++++++------ locales/en.json | 1 + 2 files changed, 146 insertions(+), 38 deletions(-) diff --git a/app/(onboarding)/serviceSelection.tsx b/app/(onboarding)/serviceSelection.tsx index f51eb024..943bdac9 100644 --- a/app/(onboarding)/serviceSelection.tsx +++ b/app/(onboarding)/serviceSelection.tsx @@ -17,7 +17,10 @@ import Typography from "@/ui/new/Typography"; import { PapillonZoomIn, PapillonZoomOut } from "@/ui/utils/Transition"; import adjust from "@/utils/adjustColor"; -import { GetSupportedServices } from './utils/constants'; +import { + GetSupportedRestaurants, + GetSupportedServices, +} from "./utils/constants"; export default function ServiceSelection() { const headerHeight = useHeaderHeight(); @@ -32,36 +35,57 @@ export default function ServiceSelection() { const [selectedService, setSelectedService] = useState(null); - const services = GetSupportedServices((path: { pathname: string, options?: UnknownInputParams }) => { - router.push({ - pathname: path.pathname as unknown as RelativePathString, - params: path.options ?? {} as unknown as UnknownInputParams - }); - }); + const services = GetSupportedServices( + (path: { pathname: string; options?: UnknownInputParams }) => { + router.push({ + pathname: path.pathname as unknown as RelativePathString, + params: path.options ?? ({} as unknown as UnknownInputParams), + }); + } + ); + + const restaurantServices = GetSupportedRestaurants( + (path: { pathname: string; options?: UnknownInputParams }) => { + router.push({ + pathname: path.pathname as unknown as RelativePathString, + params: path.options ?? ({} as unknown as UnknownInputParams), + }); + } + ); const filteredServices = useMemo(() => { - return services.filter((service) => service.type.includes(type)); + return services.filter(service => service.type.includes(type)); }, [services, type]); const titleString = useMemo(() => { switch (type) { - case "univ": - return t("ONBOARDING_SERVICE_SELECTION_TITLE_UNIV"); - default: - return t("ONBOARDING_SERVICE_SELECTION_TITLE_SCHOOL"); + case "univ": + return t("ONBOARDING_SERVICE_SELECTION_TITLE_UNIV"); + default: + return t("ONBOARDING_SERVICE_SELECTION_TITLE_SCHOOL"); } }, [type, t]); - - const hasServiceRoute = services.find(service => service.name === selectedService)?.route || services.find(service => service.name === selectedService)?.onPress; + const hasServiceRoute = + services.find(service => service.name === selectedService)?.route || + services.find(service => service.name === selectedService)?.onPress || + restaurantServices.find(service => service.name === selectedService)?.onPress; const loginToService = (serviceName: string) => { - const serviceRoute = services.find(service => service.name === serviceName)?.route; - if(!serviceRoute) { + const service = services.find(service => service.name === serviceName); + + if (!service) { + const restaurantService = restaurantServices.find(service => service.name === serviceName); + + restaurantService?.onPress(); + return; + } + + if (!service?.route) { services.find(service => service.name === serviceName)?.onPress(); return; } - const newRoute = './services/' + serviceRoute; + const newRoute = "./services/" + service?.route; router.push(newRoute); }; @@ -73,21 +97,21 @@ export default function ServiceSelection() { flexGrow: 1, gap: 10, paddingTop: headerHeight + 32, - paddingBottom: insets.bottom + 20 + paddingBottom: insets.bottom + 20, }} > - + - {t("ONBOARDING_UNSUPPORTED_TITLE")} - {t("ONBOARDING_UNSUPPORTED_DESCRIPTION")} + + {t("ONBOARDING_UNSUPPORTED_TITLE")} + + + {t("ONBOARDING_UNSUPPORTED_DESCRIPTION")} +