Frontend created and rewritten a few times, with some backend fixes #1

Merged
leo merged 110 commits from plaintable into main 2023-11-08 20:38:40 +00:00
6 changed files with 18 additions and 8 deletions
Showing only changes of commit 8cc3ed1a04 - Show all commits

View File

@ -112,7 +112,7 @@
{
// TODO BETTER SORT FOR MULTPLE SIZE OR CUSTOM PIPE TO kB to MB / GB
title: 'Size',
dataIndex: 'size',
dataIndex: 'sizedisp',
className: 'column-size',
responsive: ['lg'],
sortDirections: ['ascend', 'descend'],

View File

@ -12,6 +12,7 @@ type BaseDocument = {
export type FolderDocument = BaseDocument & {
type: 'folder' | 'folder-file';
size: number;
sizedisp: string;
mtime: number;
modified: string;
};

View File

@ -1,7 +1,7 @@
import type { Document, FolderDocument } from '@/repositories/Document';
import type { ISimpleError } from '@/repositories/Client';
import { fetchFile } from '@/repositories/Document'
import { formatUnixDate } from '@/utils';
import { formatSize, formatUnixDate } from '@/utils';
import { defineStore } from 'pinia';
@ -60,6 +60,7 @@ export const useDocumentStore = defineStore({
name,
key: id,
size,
sizedisp: formatSize(size),
mtime,
modified: formatUnixDate(mtime),
type: dir === undefined ? 'folder-file' : 'folder',

View File

@ -6,6 +6,14 @@ export function determineFileType(inputString: string): "file" | "folder" {
}
}
export function formatSize(size: number) {
for (const unit of [null, 'kB', 'MB', 'GB', 'TB', 'PB', 'EB']) {
if (size < 1e5) return size.toLocaleString().replace(',', '\u202F') + (unit ? `\u202F${unit}` : '')
size = Math.round(size / 1000)
}
return "huge"
}
export function formatUnixDate(t: number) {
const date = new Date(t * 1000)
const now = new Date()

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Vite Vasanko</title>
<script type="module" crossorigin src="/assets/index-dfc6f58a.js"></script>
<script type="module" crossorigin src="/assets/index-10851222.js"></script>
<link rel="stylesheet" href="/assets/index-ee545ab1.css">
</head>
<body>