diff --git a/compass/components/page/Drawer.tsx b/compass/components/page/Drawer.tsx index 5697235..ffa4304 100644 --- a/compass/components/page/Drawer.tsx +++ b/compass/components/page/Drawer.tsx @@ -28,11 +28,7 @@ interface EditContent { const Drawer: FunctionComponent = ({ title, children, onSave, editableContent, rowContent, onRowUpdate }) => { const [isOpen, setIsOpen] = useState(false); const [isFull, setIsFull] = useState(false); - const [isEditing, setIsEditing] = useState(false); - const [editContents, setEditContents] = useState(editableContent || [{ content: '', isEditing: true }]); - const [currentCardText, setCurrentCardText] = useState(""); const [currentCardIcon, setCurrentCardIcon] = useState(''); - const [error, setError] = useState(null); const [isFavorite, setIsFavorite] = useState(false); const [tempRowContent, setTempRowContent] = useState(rowContent); @@ -66,55 +62,12 @@ const Drawer: FunctionComponent = ({ title, children, onSave, edita const toggleDrawerFullScreen = () => setIsFull(!isFull); const toggleFavorite = () => setIsFavorite(!isFavorite); - - const handleCardClick = (text: string, icon: ReactElement) => { - console.log('click') - toggleDrawer(); - setCurrentCardText(text); - setCurrentCardIcon(icon)}; - const toggleEditing = () => setIsEditing(!isEditing); - const handleInputChange = (index: number) => (event: React.ChangeEvent) => { - const newContents = editContents.map((item, idx) => idx === index ? { ...item, content: event.target.value } : item); - setEditContents(newContents); - }; const drawerClassName = `fixed top-0 right-0 h-full bg-white transform ease-in-out duration-300 ${ isOpen ? "translate-x-0 shadow-xl" : "translate-x-full" } ${isFull ? "w-full" : "w-1/2"}`; - const addInput = () => { - setEditContents([...editContents, { content: '', isEditing: true }]); - }; - - const saveIndividualChange = (index: number) => { - const content = editContents[index].content.trim(); - if (!content) { - setError("Input cannot be empty."); - return; - } - - setError(null); // Clear error state if input passes validation - - const updatedContents = editContents.map((item, idx) => idx === index ? { ...item, isEditing: false } : item); - setEditContents(updatedContents); - - if (onSave) { - onSave(updatedContents); - } - }; - - const toggleEdit = (index: number) => { - const newContents = editContents.map((item, idx) => idx === index ? { ...item, isEditing: !item.isEditing } : item); - setEditContents(newContents); - }; - - const deleteInput = (index: number) => { - // Filter out the input at the given index - const filteredContents = editContents.filter((_, idx) => idx !== index); - setEditContents(filteredContents); - }; - const iconComponent = isFull ? : ; const favoriteIcon = isFavorite ? : @@ -128,7 +81,7 @@ const Drawer: FunctionComponent = ({ title, children, onSave, edita
{currentCardIcon} -

{rowContent.username}

+

{rowContent.username}

- - - - - + +
+
+ + + - - - - + +
+
+ + + - - - - +
+
+ + + - - - - + +
+
+ + +
Username +
Username
Role{rowContent.role}
Role + {rowContent.role} +
Email +
Email
Type of Program{rowContent.program}
Type of Program + {rowContent.program} +