minor cleanup
This commit is contained in:
parent
24e0bcbf92
commit
5f4da5d13f
@ -4,7 +4,6 @@ import genDownloadLink from "../functions/genDownloadLink"
|
||||
import { FileOpenerProps } from "../types/FileOpenerProps"
|
||||
|
||||
const AudioOpener: React.FC<FileOpenerProps> = (props) => {
|
||||
|
||||
const audio = React.createRef<HTMLAudioElement>()
|
||||
|
||||
useEffect(()=>{
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { ReactComponent as BreadcrumImage } from "./../assets/breadcrum.svg"
|
||||
|
||||
interface Props{
|
||||
@ -19,6 +18,7 @@ const Breadcrum: React.FC<Props> = (props) => {
|
||||
Root
|
||||
</a>
|
||||
</li>
|
||||
|
||||
{parts.map((e,i,arr)=>{
|
||||
const last = i == arr.length - 1
|
||||
return <div key={e} className="inline-flex items-center cursor-pointer">
|
||||
@ -39,9 +39,4 @@ const Breadcrum: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
Breadcrum.propTypes = {
|
||||
path: PropTypes.string.isRequired,
|
||||
onDirClick: PropTypes.func
|
||||
}
|
||||
|
||||
export default Breadcrum
|
||||
|
@ -8,7 +8,6 @@ interface Props {
|
||||
}
|
||||
|
||||
const CreateDirButton: React.FC<Props> = (props) => {
|
||||
|
||||
const [name,setName] = useState("")
|
||||
const [show,setShow] = useState(false)
|
||||
const input = useRef<HTMLInputElement>(null)
|
||||
@ -37,6 +36,7 @@ const CreateDirButton: React.FC<Props> = (props) => {
|
||||
setName("")
|
||||
setShow(false)
|
||||
}}>
|
||||
|
||||
<input
|
||||
className="bg-transparent dark:text-gray-300 outline-none mx-1 border-b"
|
||||
type="text"
|
||||
@ -48,15 +48,6 @@ const CreateDirButton: React.FC<Props> = (props) => {
|
||||
setName("")
|
||||
}}
|
||||
/>
|
||||
{/* <button
|
||||
onClick={()=>{
|
||||
props.onPressed?.(name)
|
||||
setName("")
|
||||
setShow(false)
|
||||
}}
|
||||
>
|
||||
Create
|
||||
</button> */}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { Directory } from "../generated/graphql"
|
||||
import { MdFolderOpen } from "react-icons/md"
|
||||
|
||||
@ -21,8 +20,4 @@ const DirectoryElement: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
DirectoryElement.propTypes = {
|
||||
dir: PropTypes.any.isRequired // TODO: maybe you can use the interface
|
||||
}
|
||||
|
||||
export default DirectoryElement
|
||||
export default DirectoryElement
|
||||
|
@ -45,7 +45,6 @@ const DragAndDrop: React.FC<Props> = (props) => {
|
||||
props.onDrop?.()
|
||||
if (event.dataTransfer?.files && event.dataTransfer.files.length > 0) {
|
||||
props.handleDrop?.(event.dataTransfer.files)
|
||||
// event.dataTransfer.clearData()
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,4 +76,4 @@ const DragAndDrop: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default DragAndDrop
|
||||
export default DragAndDrop
|
||||
|
@ -20,7 +20,6 @@ interface Props {
|
||||
}
|
||||
|
||||
const FileBrowserContextMenu: React.FC<Props> = (props) => {
|
||||
|
||||
function onClick({ props: itemProps, data }: ItemParams<{id:string}, Action>) {
|
||||
if (itemProps?.id && data != null){
|
||||
props.onSelect?.(data,itemProps.id)
|
||||
|
@ -1,12 +1,11 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { Directory, File } from "../generated/graphql"
|
||||
import DirectoryComponent from "./DirectoryElement"
|
||||
import FileElement from "./FileElement"
|
||||
|
||||
interface Props {
|
||||
file?: File | null
|
||||
dir?: Directory | null
|
||||
file?: File
|
||||
dir?: Directory
|
||||
onClick?: (event: React.MouseEvent ,data: File | Directory) => void
|
||||
onContextMenu?: (e:React.MouseEvent) => void
|
||||
}
|
||||
@ -31,10 +30,4 @@ const FileBrowserElement: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
FileBrowserElement.propTypes = {
|
||||
dir: PropTypes.any,
|
||||
file: PropTypes.any,
|
||||
onClick: PropTypes.func
|
||||
}
|
||||
|
||||
export default FileBrowserElement
|
||||
export default FileBrowserElement
|
||||
|
@ -23,7 +23,7 @@ const FileBrowserList: React.FC<Props> = (props) => {
|
||||
</thead>
|
||||
<tbody className="divide-y dark:divide-gray-900">
|
||||
{ props.directorys.map(v => (<FileBrowserElement
|
||||
key={v?.id}
|
||||
key={v.id}
|
||||
dir={v}
|
||||
onClick={(e,dir)=>{
|
||||
props.onDirClick?.(e,dir.id)
|
||||
@ -34,7 +34,7 @@ const FileBrowserList: React.FC<Props> = (props) => {
|
||||
/>))}
|
||||
|
||||
{ props.files.map(v => (<FileBrowserElement
|
||||
key={v?.id}
|
||||
key={v.id}
|
||||
file={v}
|
||||
onClick={(e,file)=>{
|
||||
props.onFileClick?.(e,file.id)
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { File } from "../generated/graphql"
|
||||
import sizeToReadable from "../functions/sizeToReadable"
|
||||
import dateFormat from "../functions/dateFomat"
|
||||
@ -26,8 +25,4 @@ const FileElement: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
FileElement.propTypes = {
|
||||
file: PropTypes.any.isRequired
|
||||
}
|
||||
|
||||
export default FileElement
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { useGetFileQuery } from "../generated/graphql"
|
||||
import ImageOpener from "./ImageOpener"
|
||||
import TextOpener from "./TextOpener"
|
||||
@ -13,7 +12,6 @@ interface Props {
|
||||
}
|
||||
|
||||
const FileOpen: React.FC<Props> = (props) => {
|
||||
|
||||
if (!props.id) {
|
||||
return <></>
|
||||
}
|
||||
@ -66,10 +64,4 @@ const FileOpen: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
FileOpen.propTypes = {
|
||||
id: PropTypes.string.isRequired,
|
||||
show: PropTypes.bool.isRequired,
|
||||
onCloseClick: PropTypes.func
|
||||
}
|
||||
|
||||
export default FileOpen
|
||||
|
@ -7,7 +7,6 @@ interface Props {
|
||||
}
|
||||
|
||||
const FileUploadButton: React.FC<Props> = (props) => {
|
||||
|
||||
const inputRef = useRef<HTMLInputElement>(null)
|
||||
|
||||
return (
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import genDownloadLink from "../functions/genDownloadLink"
|
||||
import { FileOpenerProps } from "../types/FileOpenerProps"
|
||||
|
||||
@ -9,8 +8,4 @@ const ImageOpener: React.FC<FileOpenerProps> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
ImageOpener.propTypes = {
|
||||
file: PropTypes.any.isRequired
|
||||
}
|
||||
|
||||
export default ImageOpener
|
||||
|
@ -23,4 +23,4 @@ const Modal: React.FC<Props> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
export default Modal
|
||||
export default Modal
|
||||
|
@ -1,5 +1,4 @@
|
||||
import React from "react"
|
||||
import PropTypes from "prop-types"
|
||||
import { FileOpenerProps } from "../types/FileOpenerProps"
|
||||
import { useEffect } from "react"
|
||||
import { useState } from "react"
|
||||
@ -23,8 +22,4 @@ const TextOpener: React.FC<FileOpenerProps> = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
TextOpener.propTypes = {
|
||||
file: PropTypes.any.isRequired,
|
||||
}
|
||||
|
||||
export default TextOpener
|
||||
|
Loading…
Reference in New Issue
Block a user