From 30b078cb264396f1b3028f3213d18ea6833cce1d Mon Sep 17 00:00:00 2001 From: MedzikUser Date: Sun, 22 May 2022 13:38:28 +0200 Subject: [PATCH] chore(website): update table --- scripts/create-sqlite-database.sh | 12 ------------ website/components/header.tsx | 10 +++++++--- website/components/user/table.tsx | 9 +++++++++ website/pages/user/files.tsx | 22 +++++++++++++++++++--- 4 files changed, 35 insertions(+), 18 deletions(-) delete mode 100755 scripts/create-sqlite-database.sh diff --git a/scripts/create-sqlite-database.sh b/scripts/create-sqlite-database.sh deleted file mode 100755 index 4b40bf2..0000000 --- a/scripts/create-sqlite-database.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -if [ -f 'homedisk.db' ] -then - echo 'Database `homedisk.db` exists!' - exit 1 -fi - -# create a database using the commands from the `tables.sql` file -sqlite3 homedisk.db < tables.sql - -echo 'Created SQLite database `homedisk.db`!' diff --git a/website/components/header.tsx b/website/components/header.tsx index a4636e2..edaf63c 100644 --- a/website/components/header.tsx +++ b/website/components/header.tsx @@ -1,4 +1,4 @@ -import { faMoon, faSun } from "@fortawesome/free-solid-svg-icons" +import { faMoon, faSignOut, faSun } from "@fortawesome/free-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { RocketLaunch } from "@mui/icons-material" import { AppBar, IconButton, Link, Stack, Toolbar, Typography } from "@mui/material" @@ -26,9 +26,13 @@ export default function Footer({ toggleTheme, theme}: Props) { -
toggleTheme()}> + toggleTheme()}> -
+ + + + +
diff --git a/website/components/user/table.tsx b/website/components/user/table.tsx index 64c310b..735ec6b 100644 --- a/website/components/user/table.tsx +++ b/website/components/user/table.tsx @@ -16,6 +16,15 @@ const Table = styled.table` padding: 8px; } + td:first-child { + width: 70%; + } + + td:last-child { + width: 10%; + } + + a { text-decoration: none; } diff --git a/website/pages/user/files.tsx b/website/pages/user/files.tsx index 2da2745..5ac713d 100644 --- a/website/pages/user/files.tsx +++ b/website/pages/user/files.tsx @@ -4,6 +4,7 @@ import Head from 'next/head' import Link from 'next/link' import { useEffect, useState } from 'react' import { useCookies } from 'react-cookie' +import { resolve as pathResolve } from 'path' import api from '../../api_utils' import Icon from "../../components/other/icon" import Table from "../../components/user/table" @@ -27,7 +28,7 @@ export default function Files() { useEffect(() => { const params = new URLSearchParams(window.location.search) - const path = params.get("dir") || "" + const path = params.get("path") || "" api.list(path, cookies.token) .then(data => { @@ -54,6 +55,21 @@ export default function Files() { + {path != "" && path != "/" && ( + + + + refresh(pathResolve(path, '..'))}> + + .. (go up) + + + + + + + )} + {folders.map((f, index) => )} {files.map((f, index) => )} @@ -66,7 +82,7 @@ function FolderComponent({ name, path, size, modified, refresh }: Props) { return ( - + refresh(path)}> {name.replace("/", "")} @@ -83,7 +99,7 @@ function FileComponent({ name, path, size, modified, refresh }: Props) { return ( - + refresh(path)}> {name.replace("/", "")}