Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overriden: backoffice: ItemCirculation: Handle empty shelf value #891

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ui/src/overridden/backoffice/Items/ItemCirculationShelf.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from "react";
import { Grid, Embed, Button, Icon } from "semantic-ui-react";
import { Grid, Embed, Button, Icon, Message, List } from "semantic-ui-react";
import PropTypes from "prop-types";
import _isEmpty from "lodash/isEmpty";
import { shelfLink } from "../../utils";

export const ItemCirculationShelf = ({ metadata }) => {
return (
return !_isEmpty(metadata.shelf) ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: ternary operators are quite unreadable. It would be easier to use return

Suggested change
return !_isEmpty(metadata.shelf) ? (
if (!_isEmpty(metadata.shelf)){
return <Grid.Column width={6}>
...
}
return <Grid.Column ....

<Grid.Column width={6}>
<>
<Embed active url={shelfLink(metadata.shelf, true)} />
Expand All @@ -22,6 +23,15 @@ export const ItemCirculationShelf = ({ metadata }) => {
</Button>
</>
</Grid.Column>
) : (
<Grid.Column width={6}>
<Message warning icon style={{ justifyContent: "center" }}>
<Icon name="exclamation circle" />
<List className="mt-5">
<Message.Header>Shelf location missing!</Message.Header>
</List>
</Message>
</Grid.Column>
);
};

Expand Down
Loading