diff --git a/compass/components/Table/Index.tsx b/compass/components/Table/Index.tsx index f07a20f..5ac2af0 100644 --- a/compass/components/Table/Index.tsx +++ b/compass/components/Table/Index.tsx @@ -95,7 +95,7 @@ export const Table = () => { }), columnHelper.accessor("username", { header: () => <> Username, - cell: (info) => , + cell: PrimaryTableCell, }), columnHelper.accessor("role", { header: () => <> Role, diff --git a/compass/components/Table/PrimaryTableCell.tsx b/compass/components/Table/PrimaryTableCell.tsx index a6e265f..ae1839a 100644 --- a/compass/components/Table/PrimaryTableCell.tsx +++ b/compass/components/Table/PrimaryTableCell.tsx @@ -7,15 +7,17 @@ import { SetStateAction, useState } from "react"; export const PrimaryTableCell = ({ getValue, row, column, table }) => { const [pageContent, setPageContent] = useState("") - const handleDrawerContentChange = (newContent: SetStateAction) => { + const handleDrawerContentChange = (newContent: SetStateAction) =>{ setPageContent(newContent); }; + console.debug(row); + return (
- {pageContent} + {pageContent}
); diff --git a/compass/components/page/Drawer.tsx b/compass/components/page/Drawer.tsx index d9d99ab..3363d8e 100644 --- a/compass/components/page/Drawer.tsx +++ b/compass/components/page/Drawer.tsx @@ -4,6 +4,7 @@ import { ChevronDoubleLeftIcon } from '@heroicons/react/24/solid'; import { BookmarkIcon, XMarkIcon, StarIcon as SolidStarIcon, EnvelopeIcon, UserIcon } from "@heroicons/react/24/solid"; import { ArrowsPointingOutIcon, ArrowsPointingInIcon, StarIcon as OutlineStarIcon, ListBulletIcon } from '@heroicons/react/24/outline'; import Card from '@/components/page/Card' +import { Row } from '@tanstack/react-table'; @@ -15,8 +16,8 @@ type DrawerProps = { disabled?: boolean; editableContent?: any; onSave?: (content: any) => void; - rowContent?: any; - onRowUpdate?: (content: any) => void; + row: Row; + // onRowUpdate?: (content: any) => void; }; interface EditContent { @@ -25,32 +26,32 @@ interface EditContent { } -const Drawer: FunctionComponent = ({ title, children, onSave, editableContent, rowContent, onRowUpdate }) => { +const Drawer: FunctionComponent = ({ title, children, onSave, editableContent, row }) => { const [isOpen, setIsOpen] = useState(false); const [isFull, setIsFull] = useState(false); const [currentCardIcon, setCurrentCardIcon] = useState(''); const [isFavorite, setIsFavorite] = useState(false); - const [tempRowContent, setTempRowContent] = useState(rowContent); + // const [tempRowContent, setTempRowContent] = useState(rowContent); - const handleTempRowContentChange = (e) => { - const { name, value } = e.target; - console.log(name); - console.log(value); - setTempRowContent((prevContent) => ({ - ...prevContent, - [name]: value, - })); - }; + // const handleTempRowContentChange = (e) => { + // const { name, value } = e.target; + // console.log(name); + // console.log(value); + // setTempRowContent((prevContent) => ({ + // ...prevContent, + // [name]: value, + // })); + // }; - const handleEnterPress = (e) => { - if (e.key === 'Enter') { - e.preventDefault(); - // Update the rowContent with the temporaryRowContent - if(onRowUpdate) { - onRowUpdate(tempRowContent); - } - } - }; + // const handleEnterPress = (e) => { + // if (e.key === 'Enter') { + // e.preventDefault(); + // // Update the rowContent with the temporaryRowContent + // if (onRowUpdate) { + // onRowUpdate(tempRowContent); + // } + // } + // }; const toggleDrawer = () => { setIsOpen(!isOpen); @@ -63,10 +64,9 @@ const Drawer: FunctionComponent = ({ title, children, onSave, edita const toggleFavorite = () => setIsFavorite(!isFavorite); - const drawerClassName = `fixed top-0 right-0 w-1/2 h-full bg-white transform ease-in-out duration-300 z-20 ${ - isOpen ? "translate-x-0 shadow-xl" : "translate-x-full" + const drawerClassName = `fixed top-0 right-0 w-1/2 h-full bg-white transform ease-in-out duration-300 z-20 ${isOpen ? "translate-x-0 shadow-xl" : "translate-x-full" - } ${isFull ? "w-full" : "w-1/2"}`; + } ${isFull ? "w-full" : "w-1/2"}`; const iconComponent = isFull ? : ; @@ -81,7 +81,7 @@ const Drawer: FunctionComponent = ({ title, children, onSave, edita
{currentCardIcon} -

{rowContent.username}

+

{row.getValue("username")}