Skip to content

Commit

Permalink
feat: add last published date to HistoryWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Jan 13, 2025
1 parent e6bce56 commit e05dccc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/library-authoring/collections/CollectionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ const CollectionDetails = () => {
{intl.formatMessage(messages.detailsTabHistoryTitle)}
</h3>
<HistoryWidget
created={collection.created ? new Date(collection.created) : null}
modified={collection.modified ? new Date(collection.modified) : null}
{...collection}
/>
</div>
</Stack>
Expand Down
8 changes: 8 additions & 0 deletions src/library-authoring/generic/history-widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const CustomFormattedDate = ({ date }: { date: string | Date }) => (
type HistoryWidgedProps = {
modified: string | Date | null;
created: string | Date | null;
lastPublished?: string | Date | null;
};

/**
Expand All @@ -32,8 +33,15 @@ type HistoryWidgedProps = {
const HistoryWidget = ({
modified,
created,
lastPublished,
}: HistoryWidgedProps) => (
<Stack className="history-widget-bar small" gap={3}>
{lastPublished && (
<div>
<div className="text-muted"><FormattedMessage {...messages.lastPublishedTitle} /> </div>
<CustomFormattedDate date={lastPublished} />
</div>
)}
{modified && (
<div>
<div className="text-muted"><FormattedMessage {...messages.lastModifiedTitle} /> </div>
Expand Down
5 changes: 5 additions & 0 deletions src/library-authoring/generic/history-widget/messages.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { defineMessages } from '@edx/frontend-platform/i18n';

const messages = defineMessages({
lastPublishedTitle: {
id: 'course-authoring.library-authoring.generic.history-widget.last-published',
defaultMessage: 'Last Published',
description: 'Title of the last published section in the library authoring sidebar.',
},
lastModifiedTitle: {
id: 'course-authoring.library-authoring.generic.history-widget.last-modified',
defaultMessage: 'Last Modified',
Expand Down

0 comments on commit e05dccc

Please sign in to comment.