Remove size and date from folder list item (#484)

This commit is contained in:
Cesar N
2020-12-07 18:22:07 -06:00
committed by GitHub
parent e2d86354fc
commit e541446631

View File

@@ -256,7 +256,7 @@ const ListObjects = ({
xhr.open("POST", uploadUrl, true);
xhr.withCredentials = false;
xhr.onload = function (event) {
xhr.onload = function(event) {
// TODO: handle status
if (xhr.status === 401 || xhr.status === 403) {
showSnackBarMessage("An error occurred while uploading the file.");
@@ -291,8 +291,18 @@ const ListObjects = ({
e.target.value = null;
};
const displayParsedDate = (date: string) => {
return <reactMoment.default>{date}</reactMoment.default>;
const displayParsedDate = (object: BucketObject) => {
if (object.name.endsWith("/")) {
return "";
}
return <reactMoment.default>{object.last_modified}</reactMoment.default>;
};
const displayNiceBytes = (object: BucketObject) => {
if (object.name.endsWith("/")) {
return "";
}
return niceBytes(String(object.size));
};
const confirmDeleteObject = (object: string) => {
@@ -488,11 +498,13 @@ const ListObjects = ({
label: "Last Modified",
elementKey: "last_modified",
renderFunction: displayParsedDate,
renderFullObject: true,
},
{
label: "Size",
elementKey: "size",
renderFunction: niceBytes,
renderFunction: displayNiceBytes,
renderFullObject: true,
width: 60,
contentTextAlign: "right",
},