From 04572a8e5081b1e4871e273cde9dbaaa44c52fe0 Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Wed, 13 Mar 2024 21:43:44 +0000 Subject: structure: Create apps dir and copy tooling dir from t3-turbo repo --- packages/mobile/app/+not-found.tsx | 6 -- packages/mobile/app/_layout.tsx | 53 ------------ packages/mobile/app/dashboard/(tabs)/_layout.tsx | 38 -------- packages/mobile/app/dashboard/(tabs)/index.tsx | 31 ------- packages/mobile/app/dashboard/(tabs)/lists.tsx | 67 -------------- packages/mobile/app/dashboard/(tabs)/search.tsx | 35 -------- packages/mobile/app/dashboard/(tabs)/settings.tsx | 41 --------- packages/mobile/app/dashboard/_layout.tsx | 38 -------- packages/mobile/app/dashboard/add-link.tsx | 57 ------------ packages/mobile/app/dashboard/add-note.tsx | 53 ------------ packages/mobile/app/dashboard/archive.tsx | 11 --- packages/mobile/app/dashboard/favourites.tsx | 11 --- packages/mobile/app/dashboard/lists/[slug].tsx | 31 ------- packages/mobile/app/error.tsx | 9 -- packages/mobile/app/index.tsx | 20 ----- packages/mobile/app/sharing.tsx | 99 --------------------- packages/mobile/app/signin.tsx | 101 ---------------------- 17 files changed, 701 deletions(-) delete mode 100644 packages/mobile/app/+not-found.tsx delete mode 100644 packages/mobile/app/_layout.tsx delete mode 100644 packages/mobile/app/dashboard/(tabs)/_layout.tsx delete mode 100644 packages/mobile/app/dashboard/(tabs)/index.tsx delete mode 100644 packages/mobile/app/dashboard/(tabs)/lists.tsx delete mode 100644 packages/mobile/app/dashboard/(tabs)/search.tsx delete mode 100644 packages/mobile/app/dashboard/(tabs)/settings.tsx delete mode 100644 packages/mobile/app/dashboard/_layout.tsx delete mode 100644 packages/mobile/app/dashboard/add-link.tsx delete mode 100644 packages/mobile/app/dashboard/add-note.tsx delete mode 100644 packages/mobile/app/dashboard/archive.tsx delete mode 100644 packages/mobile/app/dashboard/favourites.tsx delete mode 100644 packages/mobile/app/dashboard/lists/[slug].tsx delete mode 100644 packages/mobile/app/error.tsx delete mode 100644 packages/mobile/app/index.tsx delete mode 100644 packages/mobile/app/sharing.tsx delete mode 100644 packages/mobile/app/signin.tsx (limited to 'packages/mobile/app') diff --git a/packages/mobile/app/+not-found.tsx b/packages/mobile/app/+not-found.tsx deleted file mode 100644 index 466505b6..00000000 --- a/packages/mobile/app/+not-found.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { View } from "react-native"; - -// This is kinda important given that the sharing modal always resolve to an unknown route -export default function NotFound() { - return ; -} diff --git a/packages/mobile/app/_layout.tsx b/packages/mobile/app/_layout.tsx deleted file mode 100644 index 6304ced5..00000000 --- a/packages/mobile/app/_layout.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import "@/globals.css"; -import "expo-dev-client"; - -import { useRouter } from "expo-router"; -import { Stack } from "expo-router/stack"; -import { useShareIntent } from "expo-share-intent"; -import { StatusBar } from "expo-status-bar"; -import { useEffect } from "react"; -import { View } from "react-native"; - -import { useLastSharedIntent } from "@/lib/last-shared-intent"; -import { Providers } from "@/lib/providers"; - -export default function RootLayout() { - const router = useRouter(); - const { hasShareIntent, shareIntent, resetShareIntent } = useShareIntent(); - - const lastSharedIntent = useLastSharedIntent(); - - useEffect(() => { - const intentJson = JSON.stringify(shareIntent); - if (hasShareIntent && !lastSharedIntent.isPreviouslyShared(intentJson)) { - // TODO: Remove once https://github.com/achorein/expo-share-intent/issues/14 is fixed - lastSharedIntent.setIntent(intentJson); - router.replace({ - pathname: "sharing", - params: { shareIntent: intentJson }, - }); - resetShareIntent(); - } - }, [hasShareIntent]); - - return ( - - - - - - - - - - ); -} diff --git a/packages/mobile/app/dashboard/(tabs)/_layout.tsx b/packages/mobile/app/dashboard/(tabs)/_layout.tsx deleted file mode 100644 index 5b2d810a..00000000 --- a/packages/mobile/app/dashboard/(tabs)/_layout.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Tabs } from "expo-router"; -import { ClipboardList, Home, Search, Settings } from "lucide-react-native"; -import React from "react"; - -export default function TabLayout() { - return ( - - , - }} - /> - , - }} - /> - , - }} - /> - , - }} - /> - - ); -} diff --git a/packages/mobile/app/dashboard/(tabs)/index.tsx b/packages/mobile/app/dashboard/(tabs)/index.tsx deleted file mode 100644 index b2349525..00000000 --- a/packages/mobile/app/dashboard/(tabs)/index.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Link, Stack } from "expo-router"; -import { SquarePen, Link as LinkIcon } from "lucide-react-native"; -import { View } from "react-native"; - -import BookmarkList from "@/components/bookmarks/BookmarkList"; - -function HeaderRight() { - return ( - - - - - - - - - ); -} - -export default function Home() { - return ( - <> - , - }} - /> - - - ); -} diff --git a/packages/mobile/app/dashboard/(tabs)/lists.tsx b/packages/mobile/app/dashboard/(tabs)/lists.tsx deleted file mode 100644 index b534ddda..00000000 --- a/packages/mobile/app/dashboard/(tabs)/lists.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Link } from "expo-router"; -import { useEffect, useState } from "react"; -import { FlatList, View } from "react-native"; - -import { api } from "@/lib/trpc"; - -export default function Lists() { - const [refreshing, setRefreshing] = useState(false); - const { data: lists, isPending } = api.lists.list.useQuery(); - const apiUtils = api.useUtils(); - - useEffect(() => { - setRefreshing(isPending); - }, [isPending]); - - if (!lists) { - // Add spinner - return ; - } - - const onRefresh = () => { - apiUtils.lists.list.invalidate(); - }; - - const links = [ - { - id: "fav", - logo: "⭐️", - name: "Favourites", - href: "/dashboard/favourites", - }, - { - id: "arch", - logo: "🗄️", - name: "Archive", - href: "/dashboard/archive", - }, - ]; - - links.push( - ...lists.lists.map((l) => ({ - id: l.id, - logo: l.icon, - name: l.name, - href: `/dashboard/lists/${l.id}`, - })), - ); - - return ( - ( - - - {l.item.logo} {l.item.name} - - - )} - data={links} - refreshing={refreshing} - onRefresh={onRefresh} - /> - ); -} diff --git a/packages/mobile/app/dashboard/(tabs)/search.tsx b/packages/mobile/app/dashboard/(tabs)/search.tsx deleted file mode 100644 index 980cab36..00000000 --- a/packages/mobile/app/dashboard/(tabs)/search.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { keepPreviousData } from "@tanstack/react-query"; -import { useState } from "react"; -import { View } from "react-native"; -import { useDebounce } from "use-debounce"; - -import BookmarkList from "@/components/bookmarks/BookmarkList"; -import { Divider } from "@/components/ui/Divider"; -import { Input } from "@/components/ui/Input"; -import { api } from "@/lib/trpc"; - -export default function Search() { - const [search, setSearch] = useState(""); - - const [query] = useDebounce(search, 200); - - const { data } = api.bookmarks.searchBookmarks.useQuery( - { text: query }, - { placeholderData: keepPreviousData }, - ); - - return ( - - - - {data && b.id)} />} - - ); -} diff --git a/packages/mobile/app/dashboard/(tabs)/settings.tsx b/packages/mobile/app/dashboard/(tabs)/settings.tsx deleted file mode 100644 index 9f86d5ec..00000000 --- a/packages/mobile/app/dashboard/(tabs)/settings.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { useRouter } from "expo-router"; -import { useEffect } from "react"; -import { Text, View } from "react-native"; - -import Logo from "@/components/Logo"; -import { Button } from "@/components/ui/Button"; -import { useSession } from "@/lib/session"; -import { api } from "@/lib/trpc"; - -export default function Dashboard() { - const router = useRouter(); - - const { isLoggedIn, logout } = useSession(); - - useEffect(() => { - if (isLoggedIn !== undefined && !isLoggedIn) { - router.replace("signin"); - } - }, [isLoggedIn]); - - const { data, error, isLoading } = api.users.whoami.useQuery(); - - useEffect(() => { - if (error?.data?.code === "UNAUTHORIZED") { - logout(); - } - }, [error]); - - return ( - - - - - {isLoading ? "Loading ..." : data?.email} - - - -