minor cleanup

This commit is contained in:
Niklas 2021-08-28 17:39:09 +02:00
parent 24e0bcbf92
commit 5f4da5d13f
14 changed files with 10 additions and 63 deletions

View File

@ -4,7 +4,6 @@ import genDownloadLink from "../functions/genDownloadLink"
import { FileOpenerProps } from "../types/FileOpenerProps" import { FileOpenerProps } from "../types/FileOpenerProps"
const AudioOpener: React.FC<FileOpenerProps> = (props) => { const AudioOpener: React.FC<FileOpenerProps> = (props) => {
const audio = React.createRef<HTMLAudioElement>() const audio = React.createRef<HTMLAudioElement>()
useEffect(()=>{ useEffect(()=>{

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import { ReactComponent as BreadcrumImage } from "./../assets/breadcrum.svg" import { ReactComponent as BreadcrumImage } from "./../assets/breadcrum.svg"
interface Props{ interface Props{
@ -19,6 +18,7 @@ const Breadcrum: React.FC<Props> = (props) => {
Root Root
</a> </a>
</li> </li>
{parts.map((e,i,arr)=>{ {parts.map((e,i,arr)=>{
const last = i == arr.length - 1 const last = i == arr.length - 1
return <div key={e} className="inline-flex items-center cursor-pointer"> 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 export default Breadcrum

View File

@ -8,7 +8,6 @@ interface Props {
} }
const CreateDirButton: React.FC<Props> = (props) => { const CreateDirButton: React.FC<Props> = (props) => {
const [name,setName] = useState("") const [name,setName] = useState("")
const [show,setShow] = useState(false) const [show,setShow] = useState(false)
const input = useRef<HTMLInputElement>(null) const input = useRef<HTMLInputElement>(null)
@ -37,6 +36,7 @@ const CreateDirButton: React.FC<Props> = (props) => {
setName("") setName("")
setShow(false) setShow(false)
}}> }}>
<input <input
className="bg-transparent dark:text-gray-300 outline-none mx-1 border-b" className="bg-transparent dark:text-gray-300 outline-none mx-1 border-b"
type="text" type="text"
@ -48,15 +48,6 @@ const CreateDirButton: React.FC<Props> = (props) => {
setName("") setName("")
}} }}
/> />
{/* <button
onClick={()=>{
props.onPressed?.(name)
setName("")
setShow(false)
}}
>
Create
</button> */}
</form> </form>
</div> </div>
</div> </div>

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import { Directory } from "../generated/graphql" import { Directory } from "../generated/graphql"
import { MdFolderOpen } from "react-icons/md" 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

View File

@ -45,7 +45,6 @@ const DragAndDrop: React.FC<Props> = (props) => {
props.onDrop?.() props.onDrop?.()
if (event.dataTransfer?.files && event.dataTransfer.files.length > 0) { if (event.dataTransfer?.files && event.dataTransfer.files.length > 0) {
props.handleDrop?.(event.dataTransfer.files) props.handleDrop?.(event.dataTransfer.files)
// event.dataTransfer.clearData()
} }
} }

View File

@ -20,7 +20,6 @@ interface Props {
} }
const FileBrowserContextMenu: React.FC<Props> = (props) => { const FileBrowserContextMenu: React.FC<Props> = (props) => {
function onClick({ props: itemProps, data }: ItemParams<{id:string}, Action>) { function onClick({ props: itemProps, data }: ItemParams<{id:string}, Action>) {
if (itemProps?.id && data != null){ if (itemProps?.id && data != null){
props.onSelect?.(data,itemProps.id) props.onSelect?.(data,itemProps.id)

View File

@ -1,12 +1,11 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import { Directory, File } from "../generated/graphql" import { Directory, File } from "../generated/graphql"
import DirectoryComponent from "./DirectoryElement" import DirectoryComponent from "./DirectoryElement"
import FileElement from "./FileElement" import FileElement from "./FileElement"
interface Props { interface Props {
file?: File | null file?: File
dir?: Directory | null dir?: Directory
onClick?: (event: React.MouseEvent ,data: File | Directory) => void onClick?: (event: React.MouseEvent ,data: File | Directory) => void
onContextMenu?: (e:React.MouseEvent) => 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

View File

@ -23,7 +23,7 @@ const FileBrowserList: React.FC<Props> = (props) => {
</thead> </thead>
<tbody className="divide-y dark:divide-gray-900"> <tbody className="divide-y dark:divide-gray-900">
{ props.directorys.map(v => (<FileBrowserElement { props.directorys.map(v => (<FileBrowserElement
key={v?.id} key={v.id}
dir={v} dir={v}
onClick={(e,dir)=>{ onClick={(e,dir)=>{
props.onDirClick?.(e,dir.id) props.onDirClick?.(e,dir.id)
@ -34,7 +34,7 @@ const FileBrowserList: React.FC<Props> = (props) => {
/>))} />))}
{ props.files.map(v => (<FileBrowserElement { props.files.map(v => (<FileBrowserElement
key={v?.id} key={v.id}
file={v} file={v}
onClick={(e,file)=>{ onClick={(e,file)=>{
props.onFileClick?.(e,file.id) props.onFileClick?.(e,file.id)

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import { File } from "../generated/graphql" import { File } from "../generated/graphql"
import sizeToReadable from "../functions/sizeToReadable" import sizeToReadable from "../functions/sizeToReadable"
import dateFormat from "../functions/dateFomat" import dateFormat from "../functions/dateFomat"
@ -26,8 +25,4 @@ const FileElement: React.FC<Props> = (props) => {
) )
} }
FileElement.propTypes = {
file: PropTypes.any.isRequired
}
export default FileElement export default FileElement

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import { useGetFileQuery } from "../generated/graphql" import { useGetFileQuery } from "../generated/graphql"
import ImageOpener from "./ImageOpener" import ImageOpener from "./ImageOpener"
import TextOpener from "./TextOpener" import TextOpener from "./TextOpener"
@ -13,7 +12,6 @@ interface Props {
} }
const FileOpen: React.FC<Props> = (props) => { const FileOpen: React.FC<Props> = (props) => {
if (!props.id) { if (!props.id) {
return <></> 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 export default FileOpen

View File

@ -7,7 +7,6 @@ interface Props {
} }
const FileUploadButton: React.FC<Props> = (props) => { const FileUploadButton: React.FC<Props> = (props) => {
const inputRef = useRef<HTMLInputElement>(null) const inputRef = useRef<HTMLInputElement>(null)
return ( return (

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import genDownloadLink from "../functions/genDownloadLink" import genDownloadLink from "../functions/genDownloadLink"
import { FileOpenerProps } from "../types/FileOpenerProps" import { FileOpenerProps } from "../types/FileOpenerProps"
@ -9,8 +8,4 @@ const ImageOpener: React.FC<FileOpenerProps> = (props) => {
) )
} }
ImageOpener.propTypes = {
file: PropTypes.any.isRequired
}
export default ImageOpener export default ImageOpener

View File

@ -1,5 +1,4 @@
import React from "react" import React from "react"
import PropTypes from "prop-types"
import { FileOpenerProps } from "../types/FileOpenerProps" import { FileOpenerProps } from "../types/FileOpenerProps"
import { useEffect } from "react" import { useEffect } from "react"
import { useState } 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 export default TextOpener