aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/app
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-08-26 18:00:00 +0300
committerMohamedBassem <me@mbassem.com>2024-08-26 18:00:42 +0300
commit140554021e83ca375845584f8d7e5e476434f1c0 (patch)
tree2dfd49ebd1718e2508b50a4c6828c5d8dce72a23 /apps/mobile/app
parent410b0e78962566d9eb97710e834bf0a477b8cef2 (diff)
downloadkarakeep-140554021e83ca375845584f8d7e5e476434f1c0.tar.zst
feature(mobile): Add ability to create basic lists from the app
Diffstat (limited to 'apps/mobile/app')
-rw-r--r--apps/mobile/app/dashboard/(tabs)/lists.tsx32
1 files changed, 29 insertions, 3 deletions
diff --git a/apps/mobile/app/dashboard/(tabs)/lists.tsx b/apps/mobile/app/dashboard/(tabs)/lists.tsx
index 9e4b0929..c7e3a874 100644
--- a/apps/mobile/app/dashboard/(tabs)/lists.tsx
+++ b/apps/mobile/app/dashboard/(tabs)/lists.tsx
@@ -1,15 +1,32 @@
-import { useEffect, useState } from "react";
+import { useEffect, useRef, useState } from "react";
import { FlatList, Pressable, Text, View } from "react-native";
+import * as Haptics from "expo-haptics";
import { Link } from "expo-router";
+import NewListModal from "@/components/lists/NewListModal";
import { TailwindResolver } from "@/components/TailwindResolver";
import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
import PageTitle from "@/components/ui/PageTitle";
import { api } from "@/lib/trpc";
-import { ChevronRight } from "lucide-react-native";
+import { BottomSheetModal } from "@gorhom/bottom-sheet";
+import { ChevronRight, Plus } from "lucide-react-native";
import { useBookmarkLists } from "@hoarder/shared-react/hooks/lists";
import { ZBookmarkListTreeNode } from "@hoarder/shared/utils/listUtils";
+function HeaderRight({ openNewListModal }: { openNewListModal: () => void }) {
+ return (
+ <Pressable
+ className="my-auto px-4"
+ onPress={() => {
+ Haptics.selectionAsync();
+ openNewListModal();
+ }}
+ >
+ <Plus color="rgb(0, 122, 255)" />
+ </Pressable>
+ );
+}
+
interface ListLink {
id: string;
logo: string;
@@ -53,6 +70,7 @@ export default function Lists() {
{},
);
const apiUtils = api.useUtils();
+ const newListModal = useRef<BottomSheetModal>(null);
useEffect(() => {
setRefreshing(isPending);
@@ -94,9 +112,17 @@ export default function Lists() {
return (
<CustomSafeAreaView>
+ <NewListModal ref={newListModal} snapPoints={["90%"]} />
<FlatList
className="h-full"
- ListHeaderComponent={<PageTitle title="Lists" />}
+ ListHeaderComponent={
+ <View className="flex flex-row justify-between">
+ <PageTitle title="Lists" />
+ <HeaderRight
+ openNewListModal={() => newListModal.current?.present()}
+ />
+ </View>
+ }
contentContainerStyle={{
gap: 5,
}}