Skip to content

Commit

Permalink
Fw 5744 dashboard add created by last modified by word phrase detail …
Browse files Browse the repository at this point in the history
…view (#719)

* added createdBy created modifiedBy modified to data adaptor

* added created and modified to drawer

* added boolean to show dashboard only

* styled
  • Loading branch information
Cara-Barter authored Dec 11, 2024
1 parent 9c9079d commit 246cf67
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/common/dataAdaptors/dictionaryAdaptors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ function DashboardEntriesPresentationList({
id={selectedItem?.id}
type={selectedItem?.type}
isDrawer
isDashboard
/>
</>
)}
Expand Down
10 changes: 9 additions & 1 deletion src/components/DictionaryDetail/DictionaryDetailContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -27,6 +33,7 @@ function DictionaryDetailContainer({ id, sitename, isDrawer, kids }) {
entry={entry}
moreActions={moreActions}
sitename={sitenameToSend}
isDashboard={isDashboard}
/>
)}
{kids && (
Expand Down Expand Up @@ -54,6 +61,7 @@ DictionaryDetailContainer.propTypes = {
sitename: string,
isDrawer: bool,
kids: bool,
isDashboard: bool,
}

export default DictionaryDetailContainer
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function DictionaryDetailPresentationDrawer({
moreActions,
entry,
sitename,
isDashboard,
}) {
const labelStyling =
'text-left font-medium text-lg uppercase text-charcoal-900'
Expand Down Expand Up @@ -282,18 +283,38 @@ function DictionaryDetailPresentationDrawer({
</ul>
</div>
)}
{/* created and modified */}
{isDashboard && (
<div className="border-t text-sm">
{entry?.createdBy && (
<div className="py-4">
<p>
Created: {entry?.created?.slice(0, 10)} by{' '}
{entry?.createdBy}
</p>
</div>
)}
{entry?.lastModifiedBy && (
<p>
Modified: {entry?.lastModified?.slice(0, 10)} by{' '}
{entry?.lastModifiedBy}
</p>
)}
</div>
)}
</section>
</div>
</div>
)
}
// 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
4 changes: 3 additions & 1 deletion src/components/EntryDetail/EntryDetailContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -16,6 +16,7 @@ function EntryDetailContainer({ id, type, sitename, isDrawer }) {
id={id}
sitename={sitename}
isDrawer={isDrawer}
isDashboard={isDashboard}
/>
)
case TYPE_SONG:
Expand All @@ -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

0 comments on commit 246cf67

Please sign in to comment.