added loading spinner

This commit is contained in:
2021-08-27 21:50:14 +02:00
parent 13e38737fb
commit 5e7169079c
2 changed files with 10 additions and 5 deletions

View File

@@ -14,6 +14,7 @@ import FileBrowserContextMenu, { Action, CONTEXT_MENU_DIR, CONTEXT_MENU_FILE } f
import FileBrowserElement from "./FileBrowserElement"
import FileOpen from "./FileOpen"
import FileUploadButton from "./FileUploadButton"
import { ReactComponent as Spinner } from "./../assets/spinner.svg"
function uriToPath(pathname:string) {
// strip the "/f" from e.g. "/f/dir1/dir2"
@@ -147,11 +148,7 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
</div>
</div>
<div>
{loading &&
<div>Loading...</div> // TODO: center
}
<table className="w-full">
<thead className="border-b-2 dark:border-gray-900">
<tr>
@@ -161,7 +158,6 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
</tr>
</thead>
<tbody className="divide-y dark:divide-gray-900">
{ data?.directorys.map(v => (<FileBrowserElement
key={v?.id}
dir={v}
@@ -186,6 +182,11 @@ const FileBrowser: React.FC<RouteComponentProps> = (props) => {
/>))}
</tbody>
</table>
{loading &&
<div className="flex justify-center mt-4">
<Spinner />
</div>
}
</div>
{<FileOpen id={openFileId} show={showFile} onCloseClick={()=>{
setShowFile(false)