forked from inveniosoftware/invenio-app-rdm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dashboard uploads: refactor uploads view
* remove empty content. * create a custom mobile interface. * fix request_items naming. * closes: inveniosoftware#1771
- Loading branch information
Showing
9 changed files
with
333 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
.../semantic-ui/js/invenio_app_rdm/user_dashboard/uploads_items/ComputerTabletUploadsItem.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// This file is part of InvenioRDM | ||
// Copyright (C) 2022 CERN. | ||
// | ||
// Invenio App RDM is free software; you can redistribute it and/or modify it | ||
// under the terms of the MIT License; see LICENSE file for more details. | ||
|
||
import { i18next } from "@translations/invenio_app_rdm/i18next"; | ||
import _truncate from "lodash/truncate"; | ||
import React from "react"; | ||
import { Button, Icon, Item, Label } from "semantic-ui-react"; | ||
import { SearchItemCreators } from "../../utils"; | ||
import PropTypes from "prop-types"; | ||
import { uploadsResultProps } from "./UploadsResultProps"; | ||
|
||
export const ComputerTabletUploadsItem = ({ result, index, editRecord, statuses }) => { | ||
const { | ||
accessStatusId, | ||
accessStatus, | ||
accessStatusIcon, | ||
descriptionStripped, | ||
title, | ||
creators, | ||
subjects, | ||
publicationDate, | ||
resourceType, | ||
createdDate, | ||
version, | ||
isPublished, | ||
viewLink, | ||
} = uploadsResultProps(result); | ||
|
||
const icon = isPublished ? ( | ||
<Icon name="check" className="positive" /> | ||
) : ( | ||
<Icon name="upload" className="negative" /> | ||
); | ||
|
||
return ( | ||
<Item key={index} className="deposits-list-item mb-20 computer tablet only flex"> | ||
<div className="status-icon mr-10"> | ||
<Item.Content verticalAlign="top"> | ||
<Item.Extra>{icon}</Item.Extra> | ||
</Item.Content> | ||
</div> | ||
<Item.Content style={{ cursor: "default" }}> | ||
<Item.Extra className="labels-actions"> | ||
{result.status in statuses && result.status !== "published" && ( | ||
<Label size="tiny" className={statuses[result.status].color}> | ||
{statuses[result.status].title} | ||
</Label> | ||
)} | ||
<Label size="tiny" className="primary"> | ||
{publicationDate} ({version}) | ||
</Label> | ||
<Label size="tiny" className="neutral"> | ||
{resourceType} | ||
</Label> | ||
<Label size="tiny" className={`access-status ${accessStatusId}`}> | ||
<i className={`icon ${accessStatusIcon}`} /> | ||
{accessStatus} | ||
</Label> | ||
<Button compact size="small" floated="right" onClick={() => editRecord()}> | ||
<Icon name="edit" /> | ||
{i18next.t("Edit")} | ||
</Button> | ||
{isPublished && ( | ||
<Button compact size="small" floated="right" href={viewLink}> | ||
<Icon name="eye" /> | ||
{i18next.t("View")} | ||
</Button> | ||
)} | ||
</Item.Extra> | ||
<Item.Header as="h2"> | ||
<a href={viewLink} className="truncate-lines-2"> | ||
{title} | ||
</a> | ||
</Item.Header> | ||
<Item.Meta> | ||
<div className="creatibutors"> | ||
<SearchItemCreators creators={creators} /> | ||
</div> | ||
</Item.Meta> | ||
<Item.Description> | ||
{_truncate(descriptionStripped, { | ||
length: 350, | ||
})} | ||
</Item.Description> | ||
<Item.Extra> | ||
{subjects.map((subject) => ( | ||
<Label key={subject.title_l10n} size="tiny"> | ||
{subject.title_l10n} | ||
</Label> | ||
))} | ||
<div> | ||
{} | ||
<small> | ||
{createdDate ? ( | ||
<> | ||
{i18next.t("Uploaded on")} <span>{createdDate}</span> | ||
</> | ||
) : ( | ||
i18next.t("No creation date found.") | ||
)} | ||
</small> | ||
</div> | ||
</Item.Extra> | ||
</Item.Content> | ||
</Item> | ||
); | ||
}; | ||
|
||
ComputerTabletUploadsItem.propTypes = { | ||
result: PropTypes.object.isRequired, | ||
index: PropTypes.string, | ||
editRecord: PropTypes.func.isRequired, | ||
statuses: PropTypes.object.isRequired, | ||
}; | ||
|
||
ComputerTabletUploadsItem.defaultProps = { | ||
index: null, | ||
}; |
Oops, something went wrong.