import Styles from "@/constants/Styles"
import { MaterialCommunityIcons, MaterialIcons } from "@expo/vector-icons"
import { useState } from "react"
import { ToastAndroid, View } from "react-native"
import ButtonMenuHeader from "../buttonMenuHeader"
import DrawerBottom from "../drawerBottom"
import { InputForm } from "../inputForm"
import MenuItemRow from "../menuItemRow"
import ModalFloat from "../modalFloat"

type Props = {
   id: string | string[] | undefined | null
}

export default function HeaderRightDocument({ id }: Props) {
   const [isVisible, setVisible] = useState(false)
   const [newFolder, setNewFolder] = useState(false)

   return (
      <>
         <ButtonMenuHeader onPress={() => { setVisible(true) }} />
         <DrawerBottom animation="slide" isVisible={isVisible} setVisible={setVisible} title="Menu">
            <View style={Styles.rowItemsCenter}>
               <MenuItemRow
                  icon={<MaterialCommunityIcons name="folder-open" color="black" size={25} />}
                  title="Tambah Dokumen"
                  onPress={() => {
                     setVisible(false)
                     setNewFolder(true)
                  }}
               />

               <MenuItemRow
                  icon={<MaterialIcons name="upload-file" color="black" size={25} />}
                  title="Upload File"
                  onPress={() => {
                     setVisible(false)
                  }}
               />
            </View>
         </DrawerBottom>
         <ModalFloat title="Buat Folder Baru" isVisible={newFolder} setVisible={setNewFolder}
            onSubmit={() => {
               setNewFolder(false)
               ToastAndroid.show('Berhasil membuat folder baru', ToastAndroid.SHORT)
            }}>
            <View>
               <InputForm type="default" placeholder="Nama Folder" required label="Nama Folder" />
            </View>
         </ModalFloat>
      </>
   )

}