diff --git a/next-env.d.ts b/next-env.d.ts index fd36f949..4f11a03d 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,5 @@ /// /// -/// // NOTE: This file should not be edited // see https://nextjs.org/docs/basic-features/typescript for more information. diff --git a/src/components/AddFile.tsx b/src/components/AddFile.tsx deleted file mode 100644 index d1e8124b..00000000 --- a/src/components/AddFile.tsx +++ /dev/null @@ -1,158 +0,0 @@ -import React, { Dispatch, SetStateAction, useState } from "react"; -import FilterDropdown from "@components/FilterDropdown"; -import Tag, { TagProps, tagList } from "@components/Tag"; - -type AddFileProps = { - showAddFilePopUp: boolean; - setShowAddFilePopUp: Dispatch>; - seniorId: string; - folder: string; -}; - -const TagSelector = ({ - selectedTags, - setSelectedTags, -}: { - selectedTags: TagProps[]; - setSelectedTags: React.Dispatch>; -}) => { - return ( -
-
Tags
- - items={tagList} - filterMatch={(tag, text) => tag.name.indexOf(text) != -1} - display={(tag) => } - selectedItems={selectedTags} - setSelectedItems={setSelectedTags} - /> -
- ); -}; - -const AddFile = ({ - showAddFilePopUp, - setShowAddFilePopUp, - seniorId, - folder, -}: AddFileProps) => { - const [fileName, setFilename] = useState(""); - const [description, setDescription] = useState(""); - const [confirm, setConfirm] = useState(false); - const [error, setError] = useState(false); - const [selectedTags, setSelectedTags] = useState([]); - - const handleCancel = () => { - setShowAddFilePopUp(!showAddFilePopUp); - }; - - const callAddFile = async () => { - // POST file in drive - const addFileRes = await fetch("/api/drive/addfile", { - method: "POST", - body: JSON.stringify({ - fileName: fileName, - description: description, - fileType: "Google Document", - seniorId: seniorId, - tags: selectedTags.map((tagProp) => tagProp.name), - folder: folder, - }), - }); - - if (addFileRes.status === 200) { - setConfirm(true); - } else { - setError(true); - } - }; - - return ( - <> - {showAddFilePopUp && ( -
- {!confirm && !error ? ( -
-
-
Create New File
-
- File name -
- ) => - setFilename(e.target.value) - } - /> -
- Description -
-