aboutsummaryrefslogtreecommitdiffstats
path: root/packages/mobile/app/dashboard/(tabs)
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-03-13 21:43:44 +0000
committerMohamed Bassem <me@mbassem.com>2024-03-14 16:40:45 +0000
commit04572a8e5081b1e4871e273cde9dbaaa44c52fe0 (patch)
tree8e993acb732a50d1306d4d6953df96c165c57f57 /packages/mobile/app/dashboard/(tabs)
parent2df08ed08c065e8b91bc8df0266bd4bcbb062be4 (diff)
downloadkarakeep-04572a8e5081b1e4871e273cde9dbaaa44c52fe0.tar.zst
structure: Create apps dir and copy tooling dir from t3-turbo repo
Diffstat (limited to 'packages/mobile/app/dashboard/(tabs)')
-rw-r--r--packages/mobile/app/dashboard/(tabs)/_layout.tsx38
-rw-r--r--packages/mobile/app/dashboard/(tabs)/index.tsx31
-rw-r--r--packages/mobile/app/dashboard/(tabs)/lists.tsx67
-rw-r--r--packages/mobile/app/dashboard/(tabs)/search.tsx35
-rw-r--r--packages/mobile/app/dashboard/(tabs)/settings.tsx41
5 files changed, 0 insertions, 212 deletions
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 (
- <Tabs screenOptions={{ tabBarActiveTintColor: "blue" }}>
- <Tabs.Screen
- name="index"
- options={{
- title: "Home",
- tabBarIcon: ({ color }) => <Home color={color} />,
- }}
- />
- <Tabs.Screen
- name="search"
- options={{
- title: "Search",
- tabBarIcon: ({ color }) => <Search color={color} />,
- }}
- />
- <Tabs.Screen
- name="lists"
- options={{
- title: "Lists",
- tabBarIcon: ({ color }) => <ClipboardList color={color} />,
- }}
- />
- <Tabs.Screen
- name="settings"
- options={{
- title: "Settings",
- tabBarIcon: ({ color }) => <Settings color={color} />,
- }}
- />
- </Tabs>
- );
-}
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 (
- <View className="flex flex-row">
- <Link href="dashboard/add-link" className="mt-2 px-2">
- <LinkIcon />
- </Link>
- <Link href="dashboard/add-note" className="mt-2 px-2">
- <SquarePen />
- </Link>
- </View>
- );
-}
-
-export default function Home() {
- return (
- <>
- <Stack.Screen
- options={{
- headerRight: () => <HeaderRight />,
- }}
- />
- <BookmarkList archived={false} />
- </>
- );
-}
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 <View />;
- }
-
- 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 (
- <FlatList
- contentContainerStyle={{
- gap: 10,
- marginTop: 10,
- }}
- renderItem={(l) => (
- <View className="mx-2 block rounded-xl border border-gray-100 bg-white px-4 py-2">
- <Link key={l.item.id} href={l.item.href} className="text-lg">
- {l.item.logo} {l.item.name}
- </Link>
- </View>
- )}
- 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 (
- <View>
- <Input
- placeholder="Search"
- className="mx-4 mt-4 bg-white"
- value={search}
- onChangeText={setSearch}
- autoFocus
- autoCapitalize="none"
- />
- <Divider orientation="horizontal" className="mb-1 mt-4 w-full" />
- {data && <BookmarkList ids={data.bookmarks.map((b) => b.id)} />}
- </View>
- );
-}
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 (
- <View className="flex h-full w-full items-center gap-4 p-4">
- <Logo />
- <View className="w-full rounded-lg bg-white px-4 py-2">
- <Text className="text-lg">
- {isLoading ? "Loading ..." : data?.email}
- </Text>
- </View>
-
- <Button className="w-full" label="Log Out" onPress={logout} />
- </View>
- );
-}