From 246cf6721e3bc4f4d56e9dc3648784472f879080 Mon Sep 17 00:00:00 2001 From: Cara Barter Date: Wed, 11 Dec 2024 09:29:20 -0800 Subject: [PATCH] Fw 5744 dashboard add created by last modified by word phrase detail view (#719) * added createdBy created modifiedBy modified to data adaptor * added created and modified to drawer * added boolean to show dashboard only * styled --- src/common/dataAdaptors/dictionaryAdaptors.js | 4 ++++ .../DashboardEntriesPresentationList.js | 1 + .../DictionaryDetailContainer.js | 10 +++++++- .../DictionaryDetailPresentationDrawer.js | 23 ++++++++++++++++++- .../EntryDetail/EntryDetailContainer.js | 4 +++- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/common/dataAdaptors/dictionaryAdaptors.js b/src/common/dataAdaptors/dictionaryAdaptors.js index fc11733f..72ee5a1d 100644 --- a/src/common/dataAdaptors/dictionaryAdaptors.js +++ b/src/common/dataAdaptors/dictionaryAdaptors.js @@ -40,6 +40,10 @@ export function entryForEditing({ item }) { export function entryForViewing({ item }) { return { partOfSpeech: item?.partOfSpeech || '', + created: item?.created, + createdBy: item?.createdBy, + lastModified: item?.lastModified, + lastModifiedBy: item?.lastModifiedBy, ...coreEntry({ item }), ...audienceForViewing({ item }), ...relatedMediaForViewing({ item }), diff --git a/src/components/DashboardEntries/DashboardEntriesPresentationList.js b/src/components/DashboardEntries/DashboardEntriesPresentationList.js index 2f88a4c7..2f090c3d 100644 --- a/src/components/DashboardEntries/DashboardEntriesPresentationList.js +++ b/src/components/DashboardEntries/DashboardEntriesPresentationList.js @@ -268,6 +268,7 @@ function DashboardEntriesPresentationList({ id={selectedItem?.id} type={selectedItem?.type} isDrawer + isDashboard /> )} diff --git a/src/components/DictionaryDetail/DictionaryDetailContainer.js b/src/components/DictionaryDetail/DictionaryDetailContainer.js index 5a51b9b3..0d568cf1 100644 --- a/src/components/DictionaryDetail/DictionaryDetailContainer.js +++ b/src/components/DictionaryDetail/DictionaryDetailContainer.js @@ -7,7 +7,13 @@ import DictionaryDetailPresentationKids from 'components/DictionaryDetail/Dictio import LoadOrError from 'components/LoadOrError' import { useParams } from 'react-router-dom' -function DictionaryDetailContainer({ id, sitename, isDrawer, kids }) { +function DictionaryDetailContainer({ + id, + sitename, + isDrawer, + kids, + isDashboard, +}) { const { sitename: sitenameParams } = useParams() const sitenameToSend = sitename || sitenameParams @@ -27,6 +33,7 @@ function DictionaryDetailContainer({ id, sitename, isDrawer, kids }) { entry={entry} moreActions={moreActions} sitename={sitenameToSend} + isDashboard={isDashboard} /> )} {kids && ( @@ -54,6 +61,7 @@ DictionaryDetailContainer.propTypes = { sitename: string, isDrawer: bool, kids: bool, + isDashboard: bool, } export default DictionaryDetailContainer diff --git a/src/components/DictionaryDetail/DictionaryDetailPresentationDrawer.js b/src/components/DictionaryDetail/DictionaryDetailPresentationDrawer.js index f8385d17..9cafc0fc 100644 --- a/src/components/DictionaryDetail/DictionaryDetailPresentationDrawer.js +++ b/src/components/DictionaryDetail/DictionaryDetailPresentationDrawer.js @@ -21,6 +21,7 @@ function DictionaryDetailPresentationDrawer({ moreActions, entry, sitename, + isDashboard, }) { const labelStyling = 'text-left font-medium text-lg uppercase text-charcoal-900' @@ -282,18 +283,38 @@ function DictionaryDetailPresentationDrawer({ )} + {/* created and modified */} + {isDashboard && ( +
+ {entry?.createdBy && ( +
+

+ Created: {entry?.created?.slice(0, 10)} by{' '} + {entry?.createdBy} +

+
+ )} + {entry?.lastModifiedBy && ( +

+ Modified: {entry?.lastModified?.slice(0, 10)} by{' '} + {entry?.lastModifiedBy} +

+ )} +
+ )} ) } // PROPTYPES -const { array, object, string } = PropTypes +const { array, object, string, bool } = PropTypes DictionaryDetailPresentationDrawer.propTypes = { actions: array, entry: object, moreActions: array, sitename: string, + isDashboard: bool, } export default DictionaryDetailPresentationDrawer diff --git a/src/components/EntryDetail/EntryDetailContainer.js b/src/components/EntryDetail/EntryDetailContainer.js index d0397210..b2e8b85f 100644 --- a/src/components/EntryDetail/EntryDetailContainer.js +++ b/src/components/EntryDetail/EntryDetailContainer.js @@ -7,7 +7,7 @@ import DictionaryDetail from 'components/DictionaryDetail' import Song from 'components/Song' import Story from 'components/Story' -function EntryDetailContainer({ id, type, sitename, isDrawer }) { +function EntryDetailContainer({ id, type, sitename, isDrawer, isDashboard }) { switch (type) { case TYPE_PHRASE: case TYPE_WORD: @@ -16,6 +16,7 @@ function EntryDetailContainer({ id, type, sitename, isDrawer }) { id={id} sitename={sitename} isDrawer={isDrawer} + isDashboard={isDashboard} /> ) case TYPE_SONG: @@ -33,6 +34,7 @@ EntryDetailContainer.propTypes = { sitename: string, type: oneOf([TYPE_PHRASE, TYPE_SONG, TYPE_STORY, TYPE_WORD]), isDrawer: bool, + isDashboard: bool, } export default EntryDetailContainer