Skip to content

Commit

Permalink
Merge pull request #511 from mlibrary/remove-RecordDescription
Browse files Browse the repository at this point in the history
Removing RecordDescription
  • Loading branch information
erinesullivan authored Dec 12, 2024
2 parents 86a3873 + 8d13b71 commit afb5cf2
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 66 deletions.
20 changes: 0 additions & 20 deletions src/modules/records/components/RecordDescription/index.js

This file was deleted.

84 changes: 43 additions & 41 deletions src/modules/records/components/RecordFull/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
FullRecordPlaceholder,
Metadata,
RecommendedResource,
RecordDescription,
RecordFullFormats,
ViewMARC,
Zotero
Expand All @@ -31,25 +30,25 @@ let prejudiceInstance = prejudice.createVariableStorageDriverInstance();
const FullRecord = () => {
const [activeAction, setActiveAction] = useState('');

const params = useParams();
const { recordUid } = useParams();
const navigate = useNavigate();

const record = useSelector((state) => {
return state.records.record;
const { record } = useSelector((state) => {
return state.records;
});
const datastores = useSelector((state) => {
const { active: datastoreUid, datastores } = useSelector((state) => {
return state.datastores;
});
const list = useSelector((state) => {
return state.lists[datastores.active];
const { [datastoreUid]: list } = useSelector((state) => {
return state.lists;
});

const { recordUid } = params;
const datastoreUid = datastores.active;
const datastore = findWhere(datastores.datastores, {
const datastore = findWhere(datastores, {
uid: datastoreUid
});

const { name: datastoreName, slug: datastoreSlug } = datastore;

useEffect(() => {
requestRecord({ datastoreUid, recordUid });
prejudiceInstance = prejudice.createVariableStorageDriverInstance();
Expand All @@ -67,32 +66,32 @@ const FullRecord = () => {
// Treat as an aleph id
navigate(`/onlinejournals/record/${record.uid}`);
} else if (record.alt_ids.includes(recordUid)) {
navigate(`/${datastore.slug}/record/${record.uid}`);
navigate(`/${datastoreSlug}/record/${record.uid}`);
} else {
requestRecord({ datastoreUid, recordUid });
}
}

const activeDatastore = findWhere(datastores.datastores, {
uid: datastores.active
const { name: activeDatastore } = findWhere(datastores, {
uid: datastoreUid
});

setDocumentTitle([
[].concat(record.names).join().slice(0, 120),
'Record',
activeDatastore.name
activeDatastore
]);
}
}, [record, recordUid, datastores, navigate, datastore.slug, datastoreUid]);
}, [record, recordUid, datastores, navigate, datastoreSlug]);

if (!record) {
return (
<div className='container container-narrow y-spacing'>
<Breadcrumb
items={[
{
text: `${datastore.name}`,
to: `/${datastore.slug}${document.location.search}`
text: `${datastoreName}`,
to: `/${datastoreSlug}${document.location.search}`
},
{ text: 'Record' }
]}
Expand All @@ -114,28 +113,30 @@ const FullRecord = () => {
if (recordUidValue !== recordUid) {
return (
<div className='container container-narrow'>
<GoToList list={list} datastore={datastore} />
<GoToList {...{ datastore, list }} />
<FullRecordPlaceholder />
</div>
);
}

const inDatastore = ['catalog', 'onlinejournals'].includes(datastore.slug);
const [description] = getFieldValue(getField(record.fields, 'abstract') || getField(record.fields, 'description'));

const inDatastore = ['catalog', 'onlinejournals'].includes(datastoreSlug);

return (
<div className='container container-narrow full-record-page-container y-spacing'>
<Breadcrumb
items={[
{
text: `${datastore.name}`,
to: `/${datastore.slug}${document.location.search}`
text: `${datastoreName}`,
to: `/${datastoreSlug}${document.location.search}`
},
{ text: 'Record' }
]}
/>
<GoToList list={list} datastore={datastore} />
<GoToList {...{ datastore, list }} />
<div className={`container__rounded full-record-container ${isInList(list, record.uid) ? 'record--highlight' : ''}`}>
<RecordFullFormats formats={record.formats} />
<RecordFullFormats {...{ formats: record.formats }} />
<div className='record-container'>
<div className='full-record-title-and-actions-container'>
<H1 className='full-record-title'>
Expand All @@ -148,17 +149,17 @@ const FullRecord = () => {
);
}
return (
<TrimString string={title} expandable key={index} />
<TrimString key={index} string={title} expandable />
);
})}
<RecommendedResource fields={record.fields} />
<RecommendedResource {...{ fields: record.fields }} />
</H1>
<AddToListButton item={record} />
<AddToListButton {...{ item: record }} />
</div>
<RecordDescription record={record} />
<Zotero fields={record.fields} />
{description && <p className='full-record__description' dangerouslySetInnerHTML={{ __html: description }} />}
<Zotero {...{ fields: record.fields }} />
<h2 className='full-record__record-info'>Record info:</h2>
<Metadata metadata={record.metadata} />
<Metadata {...{ metadata: record.metadata }} />
{inDatastore && (
<p>
The University of Michigan Library aims to describe its collections in a way that respects the people and communities who create, use, and are represented in them. We encourage you to
Expand All @@ -178,10 +179,10 @@ const FullRecord = () => {
Available at:
</h2>
</div>
<ResourceAccess record={record} />
<ResourceAccess {...{ record }} />
</section>
</div>
{datastoreUid === 'mirlyn' && <ShelfBrowse record={record} />}
{datastoreUid === 'mirlyn' && <ShelfBrowse {...{ record }} />}
<div className='full-record__actions-container'>
<h2 className='lists-actions-heading u-display-inline-block u-margin-right-1 u-margin-bottom-none'>
Actions
Expand All @@ -190,26 +191,27 @@ const FullRecord = () => {
Select what to do with this record.
</span>
</h2>
<ActionsList
setActive={setActiveAction}
active={activeAction}
prejudice={prejudiceInstance}
datastore={datastore}
record={record}
<ActionsList {...{
active: activeAction,
datastore,
prejudice: prejudiceInstance,
record,
setActive: setActiveAction
}}
/>
</div>
{inDatastore && (() => {
const indexingDate = findWhere(record.fields, { uid: 'indexing_date' });
if (!indexingDate) {
const { name: indexingName, value: indexingValue } = findWhere(record.fields, { uid: 'indexing_date' });
if (!indexingValue) {
return null;
}
return (
<p className='margin-top__none text-grey full-record__date-last-indexed'>
<span className='strong'>{indexingDate.name}:</span> {indexingDate.value}
<span className='strong'>{indexingName || 'Date Last Indexed'}:</span> {indexingValue}
</p>
);
})()}
{datastoreUid === 'mirlyn' && <ViewMARC record={record} />}
{datastoreUid === 'mirlyn' && <ViewMARC {...{ fields: record.fields }} />}
</div>
);
};
Expand Down
6 changes: 3 additions & 3 deletions src/modules/records/components/ViewMARC/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import React, { useState } from 'react';
import MARCTable from '../MARCTable';
import PropTypes from 'prop-types';

const ViewMARC = ({ record }) => {
const ViewMARC = ({ fields }) => {
const [view, setView] = useState(false);
const [marc] = getFieldValue(getField(record.fields, 'marc_record'));
const [marc] = getFieldValue(getField(fields, 'marc_record'));

if (marc) {
if (view) {
Expand All @@ -30,7 +30,7 @@ const ViewMARC = ({ record }) => {
};

ViewMARC.propTypes = {
record: PropTypes.object.isRequired
fields: PropTypes.array.isRequired
};

export default ViewMARC;
2 changes: 0 additions & 2 deletions src/modules/records/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import Metadata from './components/Metadata';
import Pagination from './components/Pagination';
import RecommendedResource from './components/RecommendedResource';
import Record from './components/Record';
import RecordDescription from './components/RecordDescription';
import RecordFull from './components/RecordFull';
import RecordFullFormats from './components/RecordFullFormats';
import RecordList from './components/RecordList';
Expand All @@ -43,7 +42,6 @@ export {
Pagination,
RecommendedResource,
Record,
RecordDescription,
RecordFull,
RecordFullFormats,
RecordList,
Expand Down

0 comments on commit afb5cf2

Please sign in to comment.