From fbb264457d0d2737db33510303c3b3950e1e021e Mon Sep 17 00:00:00 2001 From: MohamedBassem Date: Sat, 23 Nov 2024 22:08:14 +0000 Subject: feat(mobile): Allow editing titles and a cleaner info page --- .../mobile/app/dashboard/bookmarks/[slug]/info.tsx | 87 ++++++++++++++++++---- 1 file changed, 73 insertions(+), 14 deletions(-) (limited to 'apps/mobile') diff --git a/apps/mobile/app/dashboard/bookmarks/[slug]/info.tsx b/apps/mobile/app/dashboard/bookmarks/[slug]/info.tsx index 5d15ab6b..e0d87a09 100644 --- a/apps/mobile/app/dashboard/bookmarks/[slug]/info.tsx +++ b/apps/mobile/app/dashboard/bookmarks/[slug]/info.tsx @@ -1,6 +1,13 @@ import React from "react"; -import { Text, View } from "react-native"; -import { Stack, useLocalSearchParams } from "expo-router"; +import { + Keyboard, + Pressable, + Text, + TouchableWithoutFeedback, + View, +} from "react-native"; +import { ScrollView } from "react-native-gesture-handler"; +import { router, Stack, useLocalSearchParams } from "expo-router"; import TagPill from "@/components/bookmarks/TagPill"; import FullPageError from "@/components/FullPageError"; import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView"; @@ -8,6 +15,7 @@ import FullPageSpinner from "@/components/ui/FullPageSpinner"; import { Input } from "@/components/ui/Input"; import { Skeleton } from "@/components/ui/Skeleton"; import { api } from "@/lib/trpc"; +import { ChevronRight } from "lucide-react-native"; import { useUpdateBookmark } from "@hoarder/shared-react/hooks/bookmarks"; import { isBookmarkStillTagging } from "@hoarder/shared-react/utils/bookmarkUtils"; @@ -15,15 +23,15 @@ import { BookmarkTypes, ZBookmark } from "@hoarder/shared/types/bookmarks"; function TagList({ bookmark }: { bookmark: ZBookmark }) { return ( - - Tags + + Tags {isBookmarkStillTagging(bookmark) ? ( <> ) : bookmark.tags.length > 0 ? ( - + {bookmark.tags.map((t) => ( ))} @@ -35,14 +43,61 @@ function TagList({ bookmark }: { bookmark: ZBookmark }) { ); } +function ManageLists({ bookmark }: { bookmark: ZBookmark }) { + return ( + + Lists + + router.push(`/dashboard/bookmarks/${bookmark.id}/manage_lists`) + } + className="flex w-full flex-row justify-between gap-3 rounded-lg bg-white px-4 py-2 dark:bg-accent" + > + Manage Lists + + + + ); +} + +function TitleEditor({ + bookmarkId, + title, +}: { + bookmarkId: string; + title: string; +}) { + const { mutate, isPending } = useUpdateBookmark(); + return ( + + Title + + + mutate({ + bookmarkId, + title: ev.nativeEvent.text ? ev.nativeEvent.text : null, + }) + } + defaultValue={title ?? ""} + /> + + ); +} + function NotesEditor({ bookmark }: { bookmark: ZBookmark }) { const { mutate, isPending } = useUpdateBookmark(); return ( - - Notes + + Notes { headerTitle: title ?? "Untitled", }} /> - - - - - - + + + + + + + + + + ); }; -- cgit v1.2.3-70-g09d2