From dafe934d991c1c7f1e8b9eed31c1beb76cb83788 Mon Sep 17 00:00:00 2001 From: SujalXplores Date: Mon, 25 Nov 2024 20:43:56 +0530 Subject: [PATCH 1/3] fix: sidebar scroll always showing up --- app/components/sidebar/Menu.client.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/components/sidebar/Menu.client.tsx b/app/components/sidebar/Menu.client.tsx index 5becf82..d753d24 100644 --- a/app/components/sidebar/Menu.client.tsx +++ b/app/components/sidebar/Menu.client.tsx @@ -129,7 +129,7 @@ export function Menu() {
Your Chats
-
+
{list.length === 0 &&
No previous conversations
} {binDates(list).map(({ category, items }) => ( From b8b25baf5c645afd8e0fd93f5fa649059c2759a8 Mon Sep 17 00:00:00 2001 From: SujalXplores Date: Mon, 25 Nov 2024 20:46:17 +0530 Subject: [PATCH 2/3] refactor: improve history item hover states and interactions --- app/components/sidebar/HistoryItem.tsx | 99 +++++++++----------------- 1 file changed, 33 insertions(+), 66 deletions(-) diff --git a/app/components/sidebar/HistoryItem.tsx b/app/components/sidebar/HistoryItem.tsx index 3f58735..4c28435 100644 --- a/app/components/sidebar/HistoryItem.tsx +++ b/app/components/sidebar/HistoryItem.tsx @@ -1,5 +1,4 @@ import * as Dialog from '@radix-ui/react-dialog'; -import { useEffect, useRef, useState } from 'react'; import { type ChatHistoryItem } from '~/lib/persistence'; import WithTooltip from '~/components/ui/Tooltip'; @@ -11,78 +10,46 @@ interface HistoryItemProps { } export function HistoryItem({ item, onDelete, onDuplicate, exportChat }: HistoryItemProps) { - const [hovering, setHovering] = useState(false); - const hoverRef = useRef(null); - - useEffect(() => { - let timeout: NodeJS.Timeout | undefined; - - function mouseEnter() { - setHovering(true); - - if (timeout) { - clearTimeout(timeout); - } - } - - function mouseLeave() { - setHovering(false); - } - - hoverRef.current?.addEventListener('mouseenter', mouseEnter); - hoverRef.current?.addEventListener('mouseleave', mouseLeave); - - return () => { - hoverRef.current?.removeEventListener('mouseenter', mouseEnter); - hoverRef.current?.removeEventListener('mouseleave', mouseLeave); - }; - }, []); - return ( -
+ From 0ebd4a6a3870923faed67d035b71eca0bcf92f50 Mon Sep 17 00:00:00 2001 From: SujalXplores Date: Mon, 25 Nov 2024 20:46:49 +0530 Subject: [PATCH 3/3] fix: tooltip UI --- app/components/ui/Tooltip.tsx | 58 +++++++++++++++++++++++++++-------- 1 file changed, 46 insertions(+), 12 deletions(-) diff --git a/app/components/ui/Tooltip.tsx b/app/components/ui/Tooltip.tsx index 73ababb..4e22f54 100644 --- a/app/components/ui/Tooltip.tsx +++ b/app/components/ui/Tooltip.tsx @@ -1,14 +1,15 @@ -import React from 'react'; import * as Tooltip from '@radix-ui/react-tooltip'; -import type { ReactNode } from 'react'; -interface ToolTipProps { - tooltip: string; - children: ReactNode | ReactNode[]; +interface TooltipProps { + tooltip: React.ReactNode; + children: React.ReactNode; sideOffset?: number; className?: string; arrowClassName?: string; - tooltipStyle?: any; //TODO better type + tooltipStyle?: React.CSSProperties; + position?: 'top' | 'bottom' | 'left' | 'right'; + maxWidth?: number; + delay?: number; } const WithTooltip = ({ @@ -18,18 +19,51 @@ const WithTooltip = ({ className = '', arrowClassName = '', tooltipStyle = {}, -}: ToolTipProps) => { + position = 'top', + maxWidth = 250, + delay = 0, +}: TooltipProps) => { return ( - + {children} - {tooltip} - +
{tooltip}
+