diff --git a/src/frontend/components/chat-bottom-bar.tsx b/src/frontend/components/chat-bottom-bar.tsx index e2bdd0a..d944fd5 100644 --- a/src/frontend/components/chat-bottom-bar.tsx +++ b/src/frontend/components/chat-bottom-bar.tsx @@ -26,12 +26,25 @@ const ChatBottomBar = ({ onSend }: Props) => { id: '-1' } ); + const [buttonClass, setButtonClass] = useState( + 'rounded-full flex-shrink-0 transition-opacity duration-200 opacity-50' + ); const { isMobile } = useWindowSize(); useEffect(() => { setIsMounted(true); }, [isMounted]); + useEffect(() => { + setButtonClass( + `rounded-full flex-shrink-0 transition-opacity duration-200 ${ + message.content.trim() + ? 'opacity-100' + : 'opacity-50' + }` + ); + }, [message.content]); + if (!isMounted) { return null; } @@ -111,9 +124,10 @@ const ChatBottomBar = ({ onSend }: Props) => { diff --git a/src/frontend/components/history-data.ts b/src/frontend/components/history-data.ts new file mode 100644 index 0000000..8b0850a --- /dev/null +++ b/src/frontend/components/history-data.ts @@ -0,0 +1,22 @@ +export const historyData = [ + { + id: 1, + title: 'What is hyperledger fabric' + }, + { + id: 2, + title: 'How to install hyperledger fabric' + }, + { + id: 3, + title: 'How to deploy hyperledger fabric' + }, + { + id: 4, + title: 'How to run hyperledger fabric' + }, + { + id: 5, + title: 'How to ensure data privacy' + } +]; diff --git a/src/frontend/components/sidebar-history.tsx b/src/frontend/components/sidebar-history.tsx new file mode 100644 index 0000000..3604066 --- /dev/null +++ b/src/frontend/components/sidebar-history.tsx @@ -0,0 +1,105 @@ +'use client'; +import React, { + useEffect, + useState +} from 'react'; +import { + DropdownMenuCheckboxItemProps, + DropdownMenuItem +} from '@radix-ui/react-dropdown-menu'; +import { Button } from '@/components/ui/button'; +import { + DropdownMenu, + DropdownMenuCheckboxItem, + DropdownMenuContent, + DropdownMenuSeparator, + DropdownMenuTrigger +} from '@/components/ui/dropdown-menu'; +import { + EllipsisVertical, + Pencil, + Pin, + Trash2 +} from 'lucide-react'; + +// Import the mock data +import { historyData as mockHistoryData } from './history-data'; + +type Props = {}; +type Checked = + DropdownMenuCheckboxItemProps['checked']; + +const SidebarHistory = (props: Props) => { + const [checkedItems, setCheckedItems] = + useState>({}); + const [historyData, setHistoryData] = useState< + { id: number; title: string }[] + >([]); + + useEffect(() => { + setHistoryData(mockHistoryData); + }, []); + + const handleCheckedChange = (id: number) => { + setCheckedItems((prevCheckedItems) => ({ + ...prevCheckedItems, + [id]: !prevCheckedItems[id] + })); + }; + + return ( +
+ {historyData.map((item) => ( +
+ + {item.title} + + + + + + + + handleCheckedChange(item.id) + } + > + Pin + + + + + + + +
+ ))} +
+ ); +}; + +export default SidebarHistory; diff --git a/src/frontend/components/sidebar.tsx b/src/frontend/components/sidebar.tsx index 663f802..163e26e 100644 --- a/src/frontend/components/sidebar.tsx +++ b/src/frontend/components/sidebar.tsx @@ -16,6 +16,7 @@ import { SheetTitle, SheetTrigger } from '@/components/ui/sheet'; +import SidebarHistory from './sidebar-history'; type Props = {}; @@ -93,6 +94,7 @@ const Sidebar = (props: Props) => { + @@ -118,6 +120,7 @@ const Sidebar = (props: Props) => { isOpen={sidebarOpen} toggleSidebar={handleViewSidebar} /> + )} diff --git a/src/frontend/tailwind.config.ts b/src/frontend/tailwind.config.ts index b6c1c74..56fafcf 100644 --- a/src/frontend/tailwind.config.ts +++ b/src/frontend/tailwind.config.ts @@ -24,6 +24,7 @@ const config = { extend: { colors: { border: 'hsl(var(--border))', + 'hover-blue': '#f1f5f9', input: 'hsl(var(--input))', ring: 'hsl(var(--ring))', background: 'hsl(var(--background))',