feat: add size to datatable

This commit is contained in:
diced 2023-03-04 17:20:49 -08:00
parent bc4b528ac6
commit e2673fa9e1
No known key found for this signature in database
GPG key ID: 370BD1BA142842D1
2 changed files with 3 additions and 0 deletions

View file

@ -9,6 +9,7 @@ import useFetch from 'lib/hooks/useFetch';
import { usePaginatedFiles, useRecent } from 'lib/queries/files';
import { useStats } from 'lib/queries/stats';
import { userSelector } from 'lib/recoil/user';
import { bytesToHuman } from 'lib/utils/bytes';
import { DataTable, DataTableSortStatus } from 'mantine-datatable';
import { useEffect, useState } from 'react';
import { useRecoilValue } from 'recoil';
@ -157,6 +158,7 @@ export default function Dashboard({ disableMediaPreview, exifEnabled }) {
columns={[
{ accessor: 'name', sortable: true },
{ accessor: 'mimetype', sortable: true },
{ accessor: 'size', sortable: true, render: (file) => bytesToHuman(file.size) },
{
accessor: 'createdAt',
sortable: true,

View file

@ -9,6 +9,7 @@ export type UserFilesResponse = {
id: string;
favorite: boolean;
url: string;
size: number;
};
export const useFiles = (query: { [key: string]: string } = {}) => {