diff --git a/compass/app/auth/login/page.tsx b/compass/app/auth/login/page.tsx index fa945c9..9dab449 100644 --- a/compass/app/auth/login/page.tsx +++ b/compass/app/auth/login/page.tsx @@ -77,6 +77,8 @@ export default function Page() { alt="Compass Center logo." width={100} height={91} + style={{ height: "auto", width: "auto" }} + priority />

Login

diff --git a/compass/app/test/page.tsx b/compass/app/test/page.tsx index 37271df..9ae938e 100644 --- a/compass/app/test/page.tsx +++ b/compass/app/test/page.tsx @@ -76,6 +76,8 @@ export default function Page() { alt="Compass Center logo." width={100} height={91} + style={{ height: "auto", width: "auto" }} + priority />

Login

diff --git a/compass/components/Drawer/Drawer.tsx b/compass/components/Drawer/Drawer.tsx index da6fd8c..2b69f3c 100644 --- a/compass/components/Drawer/Drawer.tsx +++ b/compass/components/Drawer/Drawer.tsx @@ -14,61 +14,56 @@ import { } from "@heroicons/react/24/outline"; import TagsInput from "../TagsInput/Index"; -type DrawerProps = { - title: string; - children: ReactNode; - onClick?: (event: React.MouseEvent) => void; - type?: "button" | "submit" | "reset"; // specify possible values for type - disabled?: boolean; - editableContent?: any; - onSave?: (content: any) => void; - rowContent?: any; - setData: Dispatch>; -}; +type InputType = + | "text" + | "email" + | "textarea" + | "select-one" + | "select-multiple"; -interface EditContent { - content: string; - isEditing: boolean; +export interface Details { + key: string; + label: string; + inputType: InputType; + icon: ReactNode; + presetOptionsValues?: string[]; + presetOptionsSetter?: Dispatch>; } +type DrawerProps = { + titleKey: string; + details: Details[]; + rowContent?: any; + setRowContent?: Dispatch>; +}; + const Drawer: FunctionComponent = ({ - title, - children, - onSave, - editableContent, + titleKey, + details, rowContent, - setData, -}) => { + setRowContent, +}: DrawerProps) => { const [isOpen, setIsOpen] = useState(false); const [isFull, setIsFull] = useState(false); const [isFavorite, setIsFavorite] = useState(false); const [tempRowContent, setTempRowContent] = useState(rowContent); - const onRowUpdate = (updatedRow: any) => { - setData((prevData: any) => - prevData.map((row: any) => - row.id === updatedRow.id ? updatedRow : row - ) - ); - }; + const onRowUpdate = (updatedRow: any) => {}; - const handleTempRowContentChange = (e) => { + const handleTempRowContentChange = ( + e: React.ChangeEvent + ) => { const { name, value } = e.target; - console.log(name); - console.log(value); - setTempRowContent((prevContent) => ({ - ...prevContent, + setTempRowContent((prev: any) => ({ + ...prev, [name]: value, })); }; - const handleEnterPress = (e) => { + const handleEnterPress = ( + e: React.KeyboardEvent + ) => { if (e.key === "Enter") { - e.preventDefault(); - // Update the rowContent with the temporaryRowContent - if (onRowUpdate) { - onRowUpdate(tempRowContent); - } } }; @@ -99,34 +94,6 @@ const Drawer: FunctionComponent = ({ ); - const [presetOptions, setPresetOptions] = useState([ - "administrator", - "volunteer", - "employee", - ]); - const [rolePresetOptions, setRolePresetOptions] = useState([ - "domestic", - "community", - "economic", - ]); - const [tagColors, setTagColors] = useState(new Map()); - - const getTagColor = (tag: string) => { - if (!tagColors.has(tag)) { - const colors = [ - "bg-cyan-100", - "bg-blue-100", - "bg-green-100", - "bg-yellow-100", - "bg-purple-100", - ]; - const randomColor = - colors[Math.floor(Math.random() * colors.length)]; - setTagColors(new Map(tagColors).set(tag, randomColor)); - } - return tagColors.get(tag); - }; - return (
-
@@ -145,7 +111,7 @@ const Drawer: FunctionComponent = ({

- {rowContent.username} + {rowContent[titleKey]}

@@ -170,81 +136,116 @@ const Drawer: FunctionComponent = ({
- - - -
-
- +
+ {details.map((detail, index) => { + const value = tempRowContent[detail.key]; + let valueToRender = <>; + + switch (detail.inputType) { + case "select-one": + case "select-multiple": + valueToRender = ( +
+
+ {}) + } + /> +
+
+ ); + break; + case "textarea": + valueToRender = ( +
+
+
- - Username