upd: dokumen
Deskripsi: - copy file No Issues
This commit is contained in:
@@ -9,12 +9,14 @@ import { funCopyDocument, funMoveDocument } from "../lib/api_document";
|
||||
import { useHookstate } from "@hookstate/core";
|
||||
import { globalRefreshDocument } from "../lib/val_document";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useShallowEffect } from "@mantine/hooks";
|
||||
|
||||
export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
||||
const [isCut, setIsCut] = useState(false)
|
||||
const [isCopy, setIsCopy] = useState(false)
|
||||
const refresh = useHookstate(globalRefreshDocument)
|
||||
const param = useParams<{ id: string }>()
|
||||
const [forbidCopy, setForbidCopy] = useState(true)
|
||||
|
||||
|
||||
async function onMoveItem(path: string) {
|
||||
@@ -51,6 +53,16 @@ export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
||||
}
|
||||
|
||||
|
||||
function cekFileSelected() {
|
||||
const cek = data.some((i: any) => i.category == "FOLDER")
|
||||
setForbidCopy(cek)
|
||||
}
|
||||
|
||||
useShallowEffect(() => {
|
||||
cekFileSelected()
|
||||
}, [data])
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<Box>
|
||||
@@ -66,14 +78,17 @@ export default function DrawerMore({ data }: { data: IDataDocument[] }) {
|
||||
<Text c={WARNA.biruTua}>Pindah</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
<Flex onClick={() => setIsCopy(true)} justify={'center'} align={'center'} direction={'column'} >
|
||||
<Box>
|
||||
<LuFolders size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua}>Salin</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
{
|
||||
(!forbidCopy) &&
|
||||
<Flex onClick={() => setIsCopy(true)} justify={'center'} align={'center'} direction={'column'} >
|
||||
<Box>
|
||||
<LuFolders size={30} color={WARNA.biruTua} />
|
||||
</Box>
|
||||
<Box>
|
||||
<Text c={WARNA.biruTua}>Salin</Text>
|
||||
</Box>
|
||||
</Flex>
|
||||
}
|
||||
</SimpleGrid>
|
||||
</Stack>
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ export default function NavbarDocumentDivision() {
|
||||
const [selectedFiles, setSelectedFiles] = useState<any>([])
|
||||
const [selectAll, setSelectAll] = useState(false)
|
||||
const [dariSelectAll, setDariSelectAll] = useState(false)
|
||||
const isMobile = useMediaQuery('(max-width: 369px)');
|
||||
const isMobile = useMediaQuery('(max-width: 369px)');
|
||||
const [bodyRename, setBodyRename] = useState({
|
||||
id: '',
|
||||
name: '',
|
||||
@@ -69,6 +69,7 @@ export default function NavbarDocumentDivision() {
|
||||
extension: dataDocument[index].extension,
|
||||
category: dataDocument[index].category,
|
||||
share: dataDocument[index].share,
|
||||
idStorage: dataDocument[index].idStorage
|
||||
}
|
||||
])
|
||||
}
|
||||
@@ -102,6 +103,7 @@ export default function NavbarDocumentDivision() {
|
||||
extension: dataDocument[index].extension,
|
||||
category: dataDocument[index].category,
|
||||
share: dataDocument[index].share,
|
||||
idStorage: dataDocument[index].idStorage
|
||||
}
|
||||
setSelectedFiles((selectedFiles: any) => [...selectedFiles, newArr])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user