diff --git a/client/bun.lockb b/client/bun.lockb index 5f5d186..2878ccd 100755 Binary files a/client/bun.lockb and b/client/bun.lockb differ diff --git a/client/src/components/ThreadDrawer/AgentsButton.tsx b/client/src/components/ThreadDrawer/AgentsButton.tsx index b50e627..7a215a5 100644 --- a/client/src/components/ThreadDrawer/AgentsButton.tsx +++ b/client/src/components/ThreadDrawer/AgentsButton.tsx @@ -8,13 +8,8 @@ export function AgentsButton() { const path = usePathname(); return ( - - + + Agents diff --git a/client/src/components/ThreadDrawer/LinkButton.tsx b/client/src/components/ThreadDrawer/LinkButton.tsx index ff2d0ce..4df7041 100644 --- a/client/src/components/ThreadDrawer/LinkButton.tsx +++ b/client/src/components/ThreadDrawer/LinkButton.tsx @@ -1,8 +1,9 @@ -import { Link, type Href } from "expo-router"; +import { Link, useRouter, type Href } from "expo-router"; import { Pressable } from "react-native"; import { cn } from "@/lib/utils"; import { TextClassContext } from "../ui/Text"; +import { useHoverHelper } from "@/hooks/useHoverHelper"; type PathNameProps = { pathname: string }; @@ -19,21 +20,31 @@ export default function LinkButton({ className, active, }: LinkButtonProps) { + const router = useRouter(); + const { isHover, ...helpers } = useHoverHelper(); return ( - - - + router.push(href)} + role="tab" + aria-selected={active} + className={cn( + "flex flex-row items-center justify-between w-full gap-2 p-2 transition-colors rounded group web:ring-offset-background aria-selected:bg-primary web:focus-visible:outline-none web:focus-visible:ring-2 web:focus-visible:ring-ring web:focus-visible:ring-offset-2 active:opacity-90 web:justify-start", + isHover + ? "bg-secondary-foreground/10 dark:bg-secondary-foreground/50" + : "bg-secondary", + className + )} + > + {children} - - - + + + ); } diff --git a/client/src/components/ThreadDrawer/SettingsButton.tsx b/client/src/components/ThreadDrawer/SettingsButton.tsx index a635a32..3839142 100644 --- a/client/src/components/ThreadDrawer/SettingsButton.tsx +++ b/client/src/components/ThreadDrawer/SettingsButton.tsx @@ -8,12 +8,7 @@ export function SettingsButton() { const path = usePathname(); return ( - + Settings ); diff --git a/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.tsx b/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.tsx index f35059c..b695f62 100644 --- a/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.tsx +++ b/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.tsx @@ -1,13 +1,17 @@ -import { ContextMenuView, type MenuConfig } from "react-native-ios-context-menu"; -import { Pressable, View } from "react-native"; +import { + ContextMenuView, + OnPressMenuItemEvent, + type MenuConfig, +} from "react-native-ios-context-menu"; +import { View } from "react-native"; import { useRouter } from "expo-router"; import type { Thread } from "@/types"; import { Text } from "@/components/ui/Text"; import ChatHistory from "@/components/ChatHistory"; -import { useHoverHelper } from "@/hooks/useHoverHelper"; -import { cn } from "@/lib/utils"; import { useDeleteActiveThread } from "@/hooks/actions"; +import LinkButton from "../LinkButton"; +import { useConfigStore } from "@/hooks/stores/configStore"; const menuConfig: MenuConfig = { menuTitle: "", @@ -20,15 +24,14 @@ const menuConfig: MenuConfig = { }; export function ThreadButton({ thread }: { thread: Thread }) { - const { isHover, ...helpers } = useHoverHelper(); + const threadId = useConfigStore.use.threadId(); const deleteThread = useDeleteActiveThread(); const router = useRouter(); - const goToThread = () => - router.push({ pathname: `/(app)/`, params: { c: thread.id } }); + const href = { pathname: `/(app)/`, params: { c: thread.id } } as const; - const onMenuAction = (actionKey: string) => { - switch (actionKey) { + const onPressMenuItem: OnPressMenuItemEvent = ({ nativeEvent }) => { + switch (nativeEvent.actionKey) { case "delete": deleteThread.action(thread.id); break; @@ -36,22 +39,11 @@ export function ThreadButton({ thread }: { thread: Thread }) { }; return ( - null} - delayLongPress={125} - > + onMenuAction(nativeEvent.actionKey)} - onPressMenuPreview={goToThread} + onPressMenuItem={onPressMenuItem} + onPressMenuPreview={() => router.push(href)} previewConfig={{ previewType: "CUSTOM" }} renderPreview={() => } > @@ -59,7 +51,7 @@ export function ThreadButton({ thread }: { thread: Thread }) { {thread.title || "New chat"} - + ); } diff --git a/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.web.tsx b/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.web.tsx index 98eb1ea..fbfe74e 100644 --- a/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.web.tsx +++ b/client/src/components/ThreadDrawer/ThreadButton/ThreadButton.web.tsx @@ -11,10 +11,10 @@ import { useConfigStore } from "@/hooks/stores/configStore"; export function ThreadButton({ thread }: { thread: Thread }) { const threadId = useConfigStore.use.threadId(); return ( - + diff --git a/client/src/components/ThreadDrawer/ThreadButton/ThreadButtonPopover.tsx b/client/src/components/ThreadDrawer/ThreadButton/ThreadButtonPopover.tsx index ad281a5..d2262de 100644 --- a/client/src/components/ThreadDrawer/ThreadButton/ThreadButtonPopover.tsx +++ b/client/src/components/ThreadDrawer/ThreadButton/ThreadButtonPopover.tsx @@ -34,7 +34,7 @@ export function ThreadButtonPopover({ thread }: { thread: Thread }) { ]; return ( - + ( -