Skip to content

Commit

Permalink
frontsite: DocumentDetails: Display multipart above Literature Title
Browse files Browse the repository at this point in the history
  • Loading branch information
sakshamarora1 authored and kpsherva committed Jun 28, 2024
1 parent 89ac4cf commit 795272e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import React, { Component } from 'react';
import { Grid, Header, Label } from 'semantic-ui-react';
import LiteratureTitle from '@modules/Literature/LiteratureTitle';
import { Media } from '@components/Media';
import { FrontSiteRoutes } from '@routes/urls';
import { Link } from 'react-router-dom';

export class DocumentTitle extends Component {
subtitle() {
Expand All @@ -19,6 +21,25 @@ export class DocumentTitle extends Component {
}
}

getLinkTo(relation) {
return relation.pid_type === 'docid'
? FrontSiteRoutes.documentDetailsFor(relation.pid_value)
: FrontSiteRoutes.seriesDetailsFor(relation.pid_value);
}

relationsTitle(relationsData) {
const relation = relationsData[0];
return !_isEmpty(relationsData) ? (
<Header>
<Header.Subheader>
<Link className="relations-title" to={this.getLinkTo(relation)}>
{relation.record_metadata.title}
</Link>
</Header.Subheader>
</Header>
) : null;
}

render() {
const { metadata } = this.props;
const volume = _get(metadata, 'relations.multipart_monograph[0].volume');
Expand All @@ -31,6 +52,13 @@ export class DocumentTitle extends Component {
<Grid.Column textAlign="left">
{metadata.document_type}
</Grid.Column>
</Grid.Row>
<Grid.Row className="pb-0 pt-0">
<Grid.Column textAlign="left" verticalAlign="bottom">
{this.relationsTitle(
_get(metadata, 'relations.multipart_monograph', [])
)}
</Grid.Column>
<Grid.Column textAlign="right">
{volume && <Label>{'Volume ' + volume}</Label>}
</Grid.Column>
Expand All @@ -40,6 +68,11 @@ export class DocumentTitle extends Component {
<Media lessThan="tablet">
<Grid columns={2} textAlign="center">
<Grid.Row className="pb-0 pt-2">{metadata.document_type}</Grid.Row>
<Grid.Row className="pb-0">
{this.relationsTitle(
_get(metadata, 'relations.multipart_monograph', [])
)}
</Grid.Row>
<Grid.Row className="pb-0">
{volume && <Label>{'Volume ' + volume}</Label>}
</Grid.Row>
Expand Down
4 changes: 4 additions & 0 deletions src/semantic-ui/site/globals/site.overrides
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,10 @@ a {
color: #1aa3ff;
}

a.relations-title{
font-style: italic;
}

#notifications {
z-index: 9999;
margin-top: 1rem;
Expand Down

0 comments on commit 795272e

Please sign in to comment.