Skip to content

Commit

Permalink
* fix deps to make app functional
Browse files Browse the repository at this point in the history
* minor fixes and comments
  • Loading branch information
dlustre committed Sep 29, 2024
1 parent 80da93a commit a622246
Show file tree
Hide file tree
Showing 14 changed files with 2,108 additions and 1,830 deletions.
12 changes: 6 additions & 6 deletions apps/expo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
"@react-navigation/drawer": "catalog:",
"@rehookify/datepicker": "catalog:",
"@shopify/flash-list": "catalog:",
"@tamagui/babel-plugin": "catalog:",
"@tamagui/config": "catalog:",
"@tamagui/lucide-icons": "catalog:",
"@tamagui/toast": "catalog:",
"@tamagui/babel-plugin": "catalog:tamagui1",
"@tamagui/config": "catalog:tamagui1",
"@tamagui/lucide-icons": "catalog:tamagui1",
"@tamagui/toast": "catalog:tamagui1",
"@tanstack/react-query": "catalog:",
"@trpc/client": "catalog:",
"@trpc/react-query": "catalog:",
Expand All @@ -55,7 +55,7 @@
"react-native-screens": "catalog:",
"react-native-svg": "catalog:",
"superjson": "catalog:",
"tamagui": "catalog:",
"tamagui": "catalog:tamagui1",
"zod": "catalog:",
"zustand": "catalog:"
},
Expand Down Expand Up @@ -90,4 +90,4 @@
]
},
"prettier": "@zotmeal/prettier-config"
}
}
2 changes: 1 addition & 1 deletion apps/expo/src/app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { createTamagui, TamaguiProvider, Theme } from "tamagui";
import { HamburgerMenu } from "~/components/navigation";
import { DevInfo, Logo } from "~/components/ui";
import { TRPCProvider, useZotmealColorScheme } from "~/utils";
import { env } from "~/utils/env";
import { tokenCache } from "~/utils/tokenCache";
import { env } from "../utils/env";

const tamaguiConfig = createTamagui(config);

Expand Down
3 changes: 1 addition & 2 deletions apps/expo/src/app/events/event/[title].tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Redirect, Stack, useGlobalSearchParams } from "expo-router";
import {
CalendarClock,
Expand Down Expand Up @@ -37,7 +36,7 @@ export default function Event() {
const event = events?.find((event) => event.title === title);

// TODO: Log error if event is not found
if (!event) return <Redirect href="/events/" />;
if (!event) return <Redirect href="/events" />;

return (
<>
Expand Down
8 changes: 4 additions & 4 deletions apps/expo/src/app/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import {
} from "tamagui";

import { RestaurantTabs } from "~/components/navigation";
import { EventToast } from "~/components/ui/EventToast";
import { PeriodPicker } from "~/components/ui/PeriodPicker";
import { StationTabs } from "~/components/ui/StationTabs";
import { UniversalDatePicker } from "~/components/ui/UniversalDatePicker";
import { useZotmealQuery, useZotmealStore, ZotmealData } from "~/utils";
import { EventToast } from "../components/ui/EventToast";
import { PeriodPicker } from "../components/ui/PeriodPicker";
import { StationTabs } from "../components/ui/StationTabs";
import { UniversalDatePicker } from "../components/ui/UniversalDatePicker";

export default function Home() {
const theme = useTheme();
Expand Down
12 changes: 6 additions & 6 deletions apps/expo/src/components/navigation/HamburgerMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,31 @@ const screens = [
},
{
title: "Events",
href: "/events/",
href: "/events",
subTitle: "Upcoming events",
icon: CalendarDays,
},
{
title: "Settings",
href: "/settings/",
href: "/settings",
subTitle: "Adjust your settings",
icon: Settings,
},
{
title: "About",
href: "/about/",
href: "/about",
subTitle: "Learn about ZotMeal",
icon: Info,
},
{
title: "Privacy Policy",
href: "/privacy-policy/",
href: "/privacy-policy",
subTitle: "About your privacy",
icon: Siren,
},
{
title: "Your Account",
href: "/auth/",
href: "/auth",
subTitle: "Sign in to your account",
icon: LogIn,
},
Expand Down Expand Up @@ -122,7 +122,7 @@ export function HamburgerMenu() {
size="$5"
onPress={() => router.push(href)}
pressTheme
disabled={href.replaceAll("/", "") === currentSegment}
disabled={href.replace("/", "") === currentSegment}
iconAfter={ChevronRight}
/>
{/* <Popover.Close
Expand Down
4 changes: 2 additions & 2 deletions apps/expo/src/components/ui/DevInfo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import { useState } from "react";
import { Platform } from "react-native";
import { Info } from "@tamagui/lucide-icons";
import { Button, Text, View } from "tamagui";
Expand All @@ -8,7 +8,7 @@ import { env } from "~/utils/env";

/** Utility component to show dev info in the bottom right corner. */
export function DevInfo() {
const [open, setOpen] = React.useState(false);
const [open, setOpen] = useState(false);

return (
<View
Expand Down
2 changes: 1 addition & 1 deletion apps/expo/src/components/ui/EventToast.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function EventToast() {
borderRadius="$20"
>
<Toast.Action altText="See Events" asChild>
<Link href="/events/" asChild replace>
<Link href="/events" asChild replace>
<Button
backgroundColor={0}
size="$4"
Expand Down
1 change: 0 additions & 1 deletion apps/expo/src/components/ui/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from "react";
import { Link } from "expo-router";
import { H3, Image, View } from "tamagui";

Expand Down
3 changes: 3 additions & 0 deletions apps/expo/src/utils/useSettingsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@ interface SettingsState {
) => void;
}

/** Store for global settings. */
export const useSettingsStore = create<SettingsState>((set) => ({
colorSchemePreference: "system" as const,
setColorSchemePreference: (colorSchemePreference) =>
set({ colorSchemePreference }),
}));

/** Hook for accessing global {@link colorSchemePreference}. */
export const useZotmealColorScheme = () => {
const { colorSchemePreference } = useSettingsStore();
const systemScheme = useColorScheme();

return colorSchemePreference === "system"
? systemScheme
: colorSchemePreference;
Expand Down
2 changes: 2 additions & 0 deletions packages/api/src/server/daily/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import type { CampusDishMenu } from "@zotmeal/validators";
import { getRestaurantId } from "@zotmeal/db";
import { CampusDishMenuSchema } from "@zotmeal/validators";

/** Fetch the CampusDish menu for a given date. */
export async function getCampusDishMenu(
date: Date,
restaurantName: RestaurantName,
Expand All @@ -30,6 +31,7 @@ export async function getCampusDishMenu(
return CampusDishMenuSchema.parse(res.data);
}

/** Upsert menus for a given date. */
export async function upsertMenusForDate(
db: Drizzle,
date: Date,
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/server/scrapeEvents/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import { EventSchema, getRestaurantId } from "@zotmeal/db";

/**
* @example
* dateStr => "APRIL 22 11:00 AM"
* output would be => new Date("APRIL 22, <current year> 11:00 AM")
* parseEventDate("APRIL 22 11:00 AM")
* // output: new Date("APRIL 22, <current year> 11:00 AM")
*/
export const parseEventDate = (dateStr: string) =>
setYear(new Date(dateStr), new Date().getFullYear());
Expand Down
2 changes: 1 addition & 1 deletion packages/db/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ export default defineConfig({
out: "./migrations",
schema: "./src/schema",
dbCredentials: { url: process.env.DATABASE_URL, ssl: false },
verbose: true,
verbose: !process.env.CI,
});
Loading

0 comments on commit a622246

Please sign in to comment.