From 26c8af6f77a9f757f6ef054653419c8384106eba Mon Sep 17 00:00:00 2001 From: Andrew Ho Date: Mon, 20 May 2024 21:39:48 -0700 Subject: [PATCH 1/2] add missing properties --- apps/expo/src/app/home/example_menus.ts | 48 +++++++++++++++++++++++++ apps/expo/src/app/home/index.tsx | 2 -- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/apps/expo/src/app/home/example_menus.ts b/apps/expo/src/app/home/example_menus.ts index e9d6595a..63648759 100644 --- a/apps/expo/src/app/home/example_menus.ts +++ b/apps/expo/src/app/home/example_menus.ts @@ -69,6 +69,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Breakfast Muffin", @@ -120,6 +122,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 1", @@ -171,6 +175,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 2", @@ -222,6 +228,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, ], }, @@ -282,6 +290,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Breakfast Muffin", @@ -333,6 +343,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 1", @@ -384,6 +396,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 2", @@ -435,6 +449,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, ], }, @@ -495,6 +511,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Breakfast Muffin", @@ -546,6 +564,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 1", @@ -597,6 +617,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 2", @@ -648,6 +670,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, ], }, @@ -708,6 +732,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Breakfast Muffin", @@ -759,6 +785,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 1", @@ -810,6 +838,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 2", @@ -861,6 +891,8 @@ export const brandywineData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, ], }, @@ -936,6 +968,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Breakfast Muffin", @@ -987,6 +1021,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 1", @@ -1038,6 +1074,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 2", @@ -1089,6 +1127,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, ], }, @@ -1149,6 +1189,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Breakfast Muffin", @@ -1200,6 +1242,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 1", @@ -1251,6 +1295,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, { name: "Side 2", @@ -1302,6 +1348,8 @@ export const anteateryData = { servingUnit: "g", caloriesFromFat: "2", }, + menuId: '', + stationId: '' }, ], }, diff --git a/apps/expo/src/app/home/index.tsx b/apps/expo/src/app/home/index.tsx index ddb6730b..525fd151 100644 --- a/apps/expo/src/app/home/index.tsx +++ b/apps/expo/src/app/home/index.tsx @@ -24,12 +24,10 @@ import { LinearGradient } from "tamagui/linear-gradient"; import type { MenuWithRelations } from "@zotmeal/db"; import type { PeriodName } from "@zotmeal/utils"; -import { restaurantIdEnum } from "@zotmeal/db"; import { getCurrentPeriodName, getRestaurantNameById, PeriodEnum, - restaurantIds, restaurantNames, } from "@zotmeal/utils"; From f4c81d0fcb82b3f52714ff234c58138b2bb34996 Mon Sep 17 00:00:00 2001 From: Andrew Ho Date: Tue, 21 May 2024 00:14:58 -0700 Subject: [PATCH 2/2] docker-compose and refactor home screen --- apps/expo/.env.development | 3 + apps/expo/app.config.ts | 1 + apps/expo/package.json | 2 + apps/expo/src/app/_layout.tsx | 56 ++- apps/expo/src/app/auth/index.tsx | 5 + .../src/app/home/_components/dish-card.tsx | 80 +++ .../src/app/home/_components/event-toast.tsx | 52 ++ .../app/home/_components/period-picker.tsx | 37 ++ .../src/app/home/_components/station-tabs.tsx | 91 ++++ apps/expo/src/app/home/index.tsx | 262 +--------- apps/expo/src/utils/api.tsx | 14 +- apps/expo/src/utils/env.js | 12 + docker-compose.yml | 19 + packages/api/.env.development | 0 packages/api/package.json | 2 - packages/api/src/index.ts | 1 - .../{services => schedules}/getWeekInfo.ts | 0 packages/api/src/schedules/index.ts | 4 +- .../src/schedules/procedures/getSchedule.ts | 4 +- .../schedules/{services => }/schedule.test.ts | 0 .../src/schedules/{services => }/schedule.ts | 0 .../{services => schedules}/updateDaily.ts | 4 +- packages/api/src/services/index.ts | 2 - pnpm-lock.yaml | 456 ++++++++++++++++++ 24 files changed, 812 insertions(+), 295 deletions(-) create mode 100644 apps/expo/.env.development create mode 100644 apps/expo/src/app/auth/index.tsx create mode 100644 apps/expo/src/app/home/_components/dish-card.tsx create mode 100644 apps/expo/src/app/home/_components/event-toast.tsx create mode 100644 apps/expo/src/app/home/_components/period-picker.tsx create mode 100644 apps/expo/src/app/home/_components/station-tabs.tsx create mode 100644 apps/expo/src/utils/env.js create mode 100644 docker-compose.yml create mode 100644 packages/api/.env.development rename packages/api/src/{services => schedules}/getWeekInfo.ts (100%) rename packages/api/src/schedules/{services => }/schedule.test.ts (100%) rename packages/api/src/schedules/{services => }/schedule.ts (100%) rename packages/api/src/{services => schedules}/updateDaily.ts (92%) delete mode 100644 packages/api/src/services/index.ts diff --git a/apps/expo/.env.development b/apps/expo/.env.development new file mode 100644 index 00000000..af475f13 --- /dev/null +++ b/apps/expo/.env.development @@ -0,0 +1,3 @@ + +EXPO_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_ZXRoaWNhbC1zbmFwcGVyLTk0LmNsZXJrLmFjY291bnRzLmRldiQ +EXPO_PUBLIC_API_URL="localhost:3000" \ No newline at end of file diff --git a/apps/expo/app.config.ts b/apps/expo/app.config.ts index e1b5f479..8b0a9244 100644 --- a/apps/expo/app.config.ts +++ b/apps/expo/app.config.ts @@ -32,6 +32,7 @@ const defineConfig = (): ExpoConfig => ({ eas: { projectId: "e5b5d2cd-098b-4fe4-85ed-ac05e395552d", // dennis' project id for now }, + clerkPublishableKey: process.env.CLERK_PUBLISHABLE_KEY, }, experiments: { tsconfigPaths: true, diff --git a/apps/expo/package.json b/apps/expo/package.json index 6704c97f..332cf55a 100644 --- a/apps/expo/package.json +++ b/apps/expo/package.json @@ -15,6 +15,7 @@ "typecheck": "tsc --noEmit" }, "dependencies": { + "@clerk/clerk-expo": "^1.1.4", "@expo/metro-config": "^0.17.6", "@react-native-async-storage/async-storage": "1.21.0", "@react-native-community/datetimepicker": "7.6.1", @@ -52,6 +53,7 @@ "react-native-svg": "^15.1.0", "superjson": "2.2.1", "tamagui": "^1.94.4", + "zod": "^3.22.4", "zustand": "^4.5.2" }, "devDependencies": { diff --git a/apps/expo/src/app/_layout.tsx b/apps/expo/src/app/_layout.tsx index 70b4a634..e9ebb11a 100644 --- a/apps/expo/src/app/_layout.tsx +++ b/apps/expo/src/app/_layout.tsx @@ -8,6 +8,7 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"; import { useFonts } from "expo-font"; import { Stack } from "expo-router"; import { StatusBar } from "expo-status-bar"; +import { ClerkProvider } from "@clerk/clerk-expo"; import InterBold from "@tamagui/font-inter/otf/Inter-Bold.otf"; import Inter from "@tamagui/font-inter/otf/Inter-Medium.otf"; import { ToastProvider, ToastViewport } from "@tamagui/toast"; @@ -15,6 +16,7 @@ import { createTamagui, TamaguiProvider, Theme } from "tamagui"; import { HamburgerMenu, Logo } from "~/components"; import { TRPCProvider } from "~/utils"; +import { env } from "../utils/env"; // Main layout of the app // It wraps your pages with the providers they need @@ -37,37 +39,39 @@ export default function RootLayout() { return ( - - - , - headerRight: () => , - headerStyle: { - backgroundColor: "#1A1B1D", - }, - contentStyle: { - backgroundColor: - colorScheme === "dark" ? "#1A1B1D" : "#FFFFFF", - }, - }} - > - {/* + + + , + headerRight: () => , + headerStyle: { + backgroundColor: "#1A1B1D", + }, + contentStyle: { + backgroundColor: + colorScheme === "dark" ? "#1A1B1D" : "#FFFFFF", + }, + }} + > + {/* */} - - - - - + + + + + + ); diff --git a/apps/expo/src/app/auth/index.tsx b/apps/expo/src/app/auth/index.tsx new file mode 100644 index 00000000..8debec41 --- /dev/null +++ b/apps/expo/src/app/auth/index.tsx @@ -0,0 +1,5 @@ +import { Text } from "tamagui"; + +export default function Auth() { + return Auth; +} diff --git a/apps/expo/src/app/home/_components/dish-card.tsx b/apps/expo/src/app/home/_components/dish-card.tsx new file mode 100644 index 00000000..89052ac5 --- /dev/null +++ b/apps/expo/src/app/home/_components/dish-card.tsx @@ -0,0 +1,80 @@ +import { Link } from "expo-router"; +import { StarFull } from "@tamagui/lucide-icons"; +import { Image, ListItem, Text, XStack, YGroup, YStack } from "tamagui"; + +import type { MenuWithRelations } from "@zotmeal/db"; + +import { PinButton } from "~/components"; + +type Station = MenuWithRelations["stations"][0]; +type Dish = MenuWithRelations["stations"][0]["dishes"][0]; + +export const DishCard = ({ + dish, + stationId, +}: Readonly<{ + dish: Dish; + stationId: Station["id"]; +}>) => ( + + + + + + + + + {dish.name} + + + {dish.nutritionInfo.calories} cal + + + + + + + + 5.0 + {" "} + (10,000 reviews) + + + + + + + + + +); diff --git a/apps/expo/src/app/home/_components/event-toast.tsx b/apps/expo/src/app/home/_components/event-toast.tsx new file mode 100644 index 00000000..d0be58e8 --- /dev/null +++ b/apps/expo/src/app/home/_components/event-toast.tsx @@ -0,0 +1,52 @@ +import { Link } from "expo-router"; +import { ArrowRight, CalendarDays } from "@tamagui/lucide-icons"; +import { Toast, useToastState } from "@tamagui/toast"; +import { Button } from "tamagui"; +import { LinearGradient } from "tamagui/linear-gradient"; + + + +export function EventToast() { + const currentToast = useToastState(); + if (!currentToast || currentToast.isHandledNatively) return null; + return ( + + + {currentToast.title} + + + +