Skip to content

Commit

Permalink
Moving RecordDescription logic into RecordFull and deleting compo…
Browse files Browse the repository at this point in the history
…nent.
  • Loading branch information
erinesullivan committed Dec 12, 2024
1 parent 86a3873 commit ce02ab6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 36 deletions.
20 changes: 0 additions & 20 deletions src/modules/records/components/RecordDescription/index.js

This file was deleted.

27 changes: 13 additions & 14 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,22 +30,20 @@ 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
});

Expand All @@ -73,8 +70,8 @@ const FullRecord = () => {
}
}

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

setDocumentTitle([
Expand All @@ -83,7 +80,7 @@ const FullRecord = () => {
activeDatastore.name
]);
}
}, [record, recordUid, datastores, navigate, datastore.slug, datastoreUid]);
}, [record, recordUid, datastores, navigate, datastore.slug]);

if (!record) {
return (
Expand Down Expand Up @@ -120,6 +117,8 @@ const FullRecord = () => {
);
}

const [description] = getFieldValue(getField(record.fields, 'abstract') || getField(record.fields, 'description'));

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

return (
Expand Down Expand Up @@ -155,7 +154,7 @@ const FullRecord = () => {
</H1>
<AddToListButton item={record} />
</div>
<RecordDescription record={record} />
{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} />
Expand Down
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 ce02ab6

Please sign in to comment.