diff --git a/apps/expo/app/[...route].tsx b/apps/expo/app/[...route].tsx index 7a3d2dc..f8e89dc 100644 --- a/apps/expo/app/[...route].tsx +++ b/apps/expo/app/[...route].tsx @@ -1,5 +1,4 @@ import { useLocalSearchParams } from "expo-router"; -import { Text } from "react-native"; import { App, type Route } from "@money/ui"; import { useEffect, useState } from "react"; import { authClient } from "@/lib/auth-client"; diff --git a/apps/expo/components/Header.tsx b/apps/expo/components/Header.tsx deleted file mode 100644 index 4dbd89e..0000000 --- a/apps/expo/components/Header.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { authClient } from "@/lib/auth-client"; -import { queries } from "@money/shared"; -import { useQuery } from "@rocicorp/zero/react"; -import { Link, usePathname, useRouter, type LinkProps } from "expo-router"; -import { useEffect } from "react"; -import { View, Text, Platform } from "react-native"; - -type Page = { name: string, href: LinkProps['href'] }; -const PAGES: Page[] = [ - { - name: "Home", - href: "/", - }, - { - name: "Settings", - href: "/settings", - }, -]; - - -export default function Header() { - const router = useRouter(); - const { data: session } = authClient.useSession(); - const [user] = useQuery(queries.me(session)); - - useEffect(() => { - if (Platform.OS != 'web') return; - const handleKeyDown = (event: KeyboardEvent) => { - if (event.key === "1" && event.ctrlKey) { - router.push(PAGES.at(0)!.href); - } else if (event.key === "2" && event.ctrlKey) { - router.push(PAGES.at(1)!.href); - } - }; - - window.addEventListener("keydown", handleKeyDown); - - return () => { - window.removeEventListener("keydown", handleKeyDown); - }; - }, []); - - - return ( - - - {PAGES.map(page => )} - - - - {user?.name} - - - ); -} - -function Page({ name, href }: Page) { - const path = usePathname(); - - return ( - - {path == href ? `[ ${name} ]` : ` ${name} `} - - ) - -} diff --git a/apps/tui/lib/auth-client.ts b/apps/tui/lib/auth-client.ts index 5050398..e458489 100644 --- a/apps/tui/lib/auth-client.ts +++ b/apps/tui/lib/auth-client.ts @@ -1,8 +1,9 @@ +import { config } from "@/src/config"; import { createAuthClient } from "better-auth/client"; import { deviceAuthorizationClient } from "better-auth/client/plugins"; export const authClient = createAuthClient({ - baseURL: "http://laptop:3000", + baseURL: config.apiUrl, plugins: [ deviceAuthorizationClient(), ] diff --git a/apps/tui/src/config.ts b/apps/tui/src/config.ts index 73474c3..c6c3ce8 100644 --- a/apps/tui/src/config.ts +++ b/apps/tui/src/config.ts @@ -8,4 +8,5 @@ export const config = { dir: PATH, authPath: AUTH_PATH, zeroUrl: "http://laptop:4848", + apiUrl: "http://laptop:3000" };