generated from superdesk/newsroom-app
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[STTNHUB-340] ui: New STTCoverageVersion preview field (#29)
* [STTNHUB-340] ui: New STTCoverageVersion preview field * Rename STTCoverageVersionPreviewField to STTCoverageVersionField
- Loading branch information
1 parent
f45587c
commit fe12029
Showing
6 changed files
with
69 additions
and
3 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import {exposed} from 'newsroom-core'; | ||
import {STTCoverageVersionField} from './stt/STTCoverageVersionField'; | ||
|
||
exposed.agenda.registerCoverageFieldComponent('sttversion', STTCoverageVersionField); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as React from 'react'; | ||
|
||
import {ICoverageMetadataPreviewProps} from 'newsroom-core/assets/interfaces'; | ||
import {exposed} from 'newsroom-core'; | ||
|
||
export function STTCoverageVersionField({coverage, fullCoverage}: ICoverageMetadataPreviewProps) { | ||
const {gettext} = exposed.locale; | ||
|
||
if (fullCoverage == null) { | ||
console.warn(`Unable to find the full coverage for ${coverage.coverage_id}`); | ||
return null; | ||
} | ||
|
||
const sttVersion = (fullCoverage.planning?.subjects || []).filter( | ||
(subject) => subject.scheme === 'sttversion' | ||
); | ||
|
||
return sttVersion.length === 0 ? null : ( | ||
<div className="coverage-item__row align-items-center"> | ||
<span className="coverage-item__text-label me-1">{gettext('Version')}:</span> | ||
<span>{sttVersion[0].name}</span> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"extends": "newsroom-core/tsconfig", | ||
"include": [ | ||
"." | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters