@financial-times/cp-content-pipeline-ui 7.10.1 → 7.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/components/ArticleInfo/index.d.ts +3 -3
- package/lib/components/ArticleInfo/index.js +22 -8
- package/lib/components/ArticleInfo/index.js.map +1 -1
- package/lib/components/content-tree/Table/TableCell.js +3 -1
- package/lib/components/content-tree/Table/TableCell.js.map +1 -1
- package/package.json +1 -1
- package/src/components/ArticleInfo/index.tsx +64 -27
- package/src/components/content-tree/Table/TableCell.tsx +3 -1
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -574,6 +574,20 @@
|
|
|
574
574
|
* @financial-times/cp-content-pipeline-client bumped from ^3.7.2 to ^3.7.3
|
|
575
575
|
* @financial-times/cp-content-pipeline-schema bumped from ^2.10.1 to ^2.10.2
|
|
576
576
|
|
|
577
|
+
## [7.11.1](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v7.11.0...cp-content-pipeline-ui-v7.11.1) (2025-02-28)
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
### Bug Fixes
|
|
581
|
+
|
|
582
|
+
* ci-2708 sortable table column index can be 0 ([0c89bc9](https://github.com/Financial-Times/cp-content-pipeline/commit/0c89bc975334e7bd7d006dfe9844edc24289b3a8))
|
|
583
|
+
|
|
584
|
+
## [7.11.0](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v7.10.1...cp-content-pipeline-ui-v7.11.0) (2025-02-25)
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
### Features
|
|
588
|
+
|
|
589
|
+
* **byline:** added updated publish date label to byline and modified date format logic ([aa08cb7](https://github.com/Financial-Times/cp-content-pipeline/commit/aa08cb7d0c531be0c0c512d2ec7c6a56ef3fbdc1))
|
|
590
|
+
|
|
577
591
|
## [7.10.1](https://github.com/Financial-Times/cp-content-pipeline/compare/cp-content-pipeline-ui-v7.10.0...cp-content-pipeline-ui-v7.10.1) (2025-01-27)
|
|
578
592
|
|
|
579
593
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import type { ArticleQuery } from
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ArticleQuery } from "@financial-times/cp-content-pipeline-client";
|
|
3
3
|
type ArticleInfoProps = {
|
|
4
|
-
content: ArticleQuery[
|
|
4
|
+
content: ArticleQuery["content"];
|
|
5
5
|
};
|
|
6
6
|
declare const ArticleInfo: React.FC<React.PropsWithChildren<ArticleInfoProps>>;
|
|
7
7
|
export default ArticleInfo;
|
|
@@ -7,15 +7,29 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const Byline_1 = __importDefault(require("../Byline"));
|
|
8
8
|
const ft_date_format_1 = __importDefault(require("@financial-times/ft-date-format"));
|
|
9
9
|
const ArticleInfo = ({ children, content, }) => {
|
|
10
|
-
const isLiveBlogPackage = content.__typename ===
|
|
11
|
-
const
|
|
10
|
+
const isLiveBlogPackage = content.__typename === "LiveBlogPackage";
|
|
11
|
+
const formattedFirstPublishedDate = ft_date_format_1.default.format(new Date(content.firstPublishedDate), "date");
|
|
12
|
+
const formattedPublishedDate = ft_date_format_1.default.format(new Date(content.publishedTimestamp), "date");
|
|
13
|
+
const displayPublishedDate = content.publishedDate && !isLiveBlogPackage;
|
|
14
|
+
const displayUpdatedDate = new Date(content.firstPublishedDate).getTime() !==
|
|
15
|
+
content.publishedTimestamp;
|
|
16
|
+
const isPublishedMoreThanOneDayAgo = Date.now() - new Date(content.firstPublishedDate).getTime() >
|
|
17
|
+
24 * 60 * 60 * 1000;
|
|
12
18
|
return (react_1.default.createElement("div", { className: "article-info" },
|
|
13
|
-
react_1.default.createElement("div", { className: "article-info__time-byline" },
|
|
14
|
-
content.byline && content.__typename !==
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
react_1.default.createElement("div", { className: "article-info__time-byline-row" },
|
|
20
|
+
react_1.default.createElement("div", { className: "article-info__time-byline-content" }, content.byline && content.__typename !== "Audio" && (react_1.default.createElement(Byline_1.default, { structuredContent: content.byline, showEditedBy: isLiveBlogPackage }))),
|
|
21
|
+
!displayPublishedDate && children),
|
|
22
|
+
displayPublishedDate && (react_1.default.createElement("div", { className: "article-info__time-byline-row" },
|
|
23
|
+
react_1.default.createElement("div", { className: "article-info__time-byline-content" },
|
|
24
|
+
react_1.default.createElement("p", { className: "article-info__timestamp-item" },
|
|
25
|
+
"Published",
|
|
26
|
+
react_1.default.createElement("time", { "data-o-component": "o-date", ...(isPublishedMoreThanOneDayAgo
|
|
27
|
+
? { "data-o-date-format": "MMM d yyyy" }
|
|
28
|
+
: {}), className: "article-info__timestamp o-date", dateTime: content.firstPublishedDate }, formattedFirstPublishedDate)),
|
|
29
|
+
displayUpdatedDate && (react_1.default.createElement("p", { className: "article-info__timestamp-item article-info__updated-timestamp" },
|
|
30
|
+
"Updated",
|
|
31
|
+
react_1.default.createElement("time", { "data-o-component": "o-date", "data-o-date-format": isPublishedMoreThanOneDayAgo ? "MMM d yyyy, HH:mm" : "HH:mm", className: "article-info__timestamp o-date", dateTime: content.publishedDate }, formattedPublishedDate)))),
|
|
32
|
+
children))));
|
|
19
33
|
};
|
|
20
34
|
exports.default = ArticleInfo;
|
|
21
35
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ArticleInfo/index.tsx"],"names":[],"mappings":";;;;;AAAA,kDAAyB;AACzB,uDAA8B;AAE9B,qFAA0D;AAM1D,MAAM,WAAW,GAAwD,CAAC,EACxE,QAAQ,EACR,OAAO,GACR,EAAE,EAAE;IACH,MAAM,iBAAiB,GAAG,OAAO,CAAC,UAAU,KAAK,iBAAiB,CAAA;IAClE,MAAM,sBAAsB,GAAG,wBAAY,CAAC,MAAM,CAChD,IAAI,IAA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MAAM,EACjC,YAAY,EAAE,iBAAiB,GAC/B,CACH,CACG;YACL,CAAC,oBAAoB,IAAI,QAAQ,CAC9B;QACL,oBAAoB,IAAI,CACvB,uCAAK,SAAS,EAAC,+BAA+B;YAC5C,uCAAK,SAAS,EAAC,mCAAmC;gBAChD,qCAAG,SAAS,EAAC,8BAA8B;;oBAEzC,4DACmB,QAAQ,KACrB,CAAC,4BAA4B;4BAC/B,CAAC,CAAC,EAAE,oBAAoB,EAAE,YAAY,EAAE;4BACxC,CAAC,CAAC,EAAE,CAAC,EACP,SAAS,EAAC,gCAAgC,EAC1C,QAAQ,EAAE,OAAO,CAAC,kBAAkB,IAEnC,2BAA2B,CACvB,CACL;gBACH,kBAAkB,IAAI,CACrB,qCAAG,SAAS,EAAC,8DAA8D;;oBAEzE,4DACmB,QAAQ,wBAEvB,4BAA4B,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,OAAO,EAE9D,SAAS,EAAC,gCAAgC,EAC1C,QAAQ,EAAE,OAAO,CAAC,aAAa,IAE9B,sBAAsB,CAClB,CACL,CACL,CACG;YACL,QAAQ,CACL,CACP,CACG,CACP,CAAA;AACH,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -32,7 +32,9 @@ const _1 = require(".");
|
|
|
32
32
|
const classnames_1 = __importDefault(require("classnames"));
|
|
33
33
|
const TableCell = (props) => {
|
|
34
34
|
const allColumnSettings = (0, react_1.useContext)(_1.ColumnSettingsContext);
|
|
35
|
-
const columnSettings = (
|
|
35
|
+
const columnSettings = (typeof props.parentIndex === 'number'
|
|
36
|
+
? allColumnSettings[props.parentIndex]
|
|
37
|
+
: undefined) ?? {
|
|
36
38
|
hideOnMobile: false,
|
|
37
39
|
sortable: false,
|
|
38
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableCell.js","sourceRoot":"","sources":["../../../../src/components/content-tree/Table/TableCell.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;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Q,CACZ,CACN,CAAA;AACH,CAAC,CAAA;AAlCY,QAAA,SAAS,aAkCrB"}
|
package/package.json
CHANGED
|
@@ -1,45 +1,82 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Byline from
|
|
3
|
-
import type { ArticleQuery } from
|
|
4
|
-
import ftDateFormat from
|
|
1
|
+
import React from "react"
|
|
2
|
+
import Byline from "../Byline"
|
|
3
|
+
import type { ArticleQuery } from "@financial-times/cp-content-pipeline-client"
|
|
4
|
+
import ftDateFormat from "@financial-times/ft-date-format"
|
|
5
5
|
|
|
6
6
|
type ArticleInfoProps = {
|
|
7
|
-
content: ArticleQuery[
|
|
7
|
+
content: ArticleQuery["content"]
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const ArticleInfo: React.FC<React.PropsWithChildren<ArticleInfoProps>> = ({
|
|
11
11
|
children,
|
|
12
12
|
content,
|
|
13
13
|
}) => {
|
|
14
|
-
const isLiveBlogPackage = content.__typename ===
|
|
14
|
+
const isLiveBlogPackage = content.__typename === "LiveBlogPackage"
|
|
15
|
+
const formattedFirstPublishedDate = ftDateFormat.format(
|
|
16
|
+
new Date(content.firstPublishedDate),
|
|
17
|
+
"date"
|
|
18
|
+
)
|
|
15
19
|
const formattedPublishedDate = ftDateFormat.format(
|
|
16
20
|
new Date(content.publishedTimestamp),
|
|
17
|
-
|
|
21
|
+
"date"
|
|
18
22
|
)
|
|
19
23
|
|
|
24
|
+
const displayPublishedDate = content.publishedDate && !isLiveBlogPackage
|
|
25
|
+
const displayUpdatedDate =
|
|
26
|
+
new Date(content.firstPublishedDate).getTime() !==
|
|
27
|
+
content.publishedTimestamp
|
|
28
|
+
const isPublishedMoreThanOneDayAgo =
|
|
29
|
+
Date.now() - new Date(content.firstPublishedDate).getTime() >
|
|
30
|
+
24 * 60 * 60 * 1000
|
|
31
|
+
|
|
20
32
|
return (
|
|
21
33
|
<div className="article-info">
|
|
22
|
-
<div className="article-info__time-byline">
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
<time
|
|
33
|
-
data-o-component="o-date"
|
|
34
|
-
className="article-info__timestamp o-date"
|
|
35
|
-
dateTime={content.publishedDate}
|
|
36
|
-
>
|
|
37
|
-
{formattedPublishedDate}
|
|
38
|
-
</time>
|
|
39
|
-
</>
|
|
40
|
-
)}
|
|
34
|
+
<div className="article-info__time-byline-row">
|
|
35
|
+
<div className="article-info__time-byline-content">
|
|
36
|
+
{content.byline && content.__typename !== "Audio" && (
|
|
37
|
+
<Byline
|
|
38
|
+
structuredContent={content.byline}
|
|
39
|
+
showEditedBy={isLiveBlogPackage}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
</div>
|
|
43
|
+
{!displayPublishedDate && children}
|
|
41
44
|
</div>
|
|
42
|
-
{
|
|
45
|
+
{displayPublishedDate && (
|
|
46
|
+
<div className="article-info__time-byline-row">
|
|
47
|
+
<div className="article-info__time-byline-content">
|
|
48
|
+
<p className="article-info__timestamp-item">
|
|
49
|
+
Published
|
|
50
|
+
<time
|
|
51
|
+
data-o-component="o-date"
|
|
52
|
+
{...(isPublishedMoreThanOneDayAgo
|
|
53
|
+
? { "data-o-date-format": "MMM d yyyy" }
|
|
54
|
+
: {})}
|
|
55
|
+
className="article-info__timestamp o-date"
|
|
56
|
+
dateTime={content.firstPublishedDate}
|
|
57
|
+
>
|
|
58
|
+
{formattedFirstPublishedDate}
|
|
59
|
+
</time>
|
|
60
|
+
</p>
|
|
61
|
+
{displayUpdatedDate && (
|
|
62
|
+
<p className="article-info__timestamp-item article-info__updated-timestamp">
|
|
63
|
+
Updated
|
|
64
|
+
<time
|
|
65
|
+
data-o-component="o-date"
|
|
66
|
+
data-o-date-format={
|
|
67
|
+
isPublishedMoreThanOneDayAgo ? "MMM d yyyy, HH:mm" : "HH:mm"
|
|
68
|
+
}
|
|
69
|
+
className="article-info__timestamp o-date"
|
|
70
|
+
dateTime={content.publishedDate}
|
|
71
|
+
>
|
|
72
|
+
{formattedPublishedDate}
|
|
73
|
+
</time>
|
|
74
|
+
</p>
|
|
75
|
+
)}
|
|
76
|
+
</div>
|
|
77
|
+
{children}
|
|
78
|
+
</div>
|
|
79
|
+
)}
|
|
43
80
|
</div>
|
|
44
81
|
)
|
|
45
82
|
}
|
|
@@ -12,7 +12,9 @@ export const TableCell: React.FC<React.PropsWithChildren<TableCellProps>> = (
|
|
|
12
12
|
) => {
|
|
13
13
|
const allColumnSettings = useContext(ColumnSettingsContext)
|
|
14
14
|
const columnSettings: ContentTreeWorkarounds.TableColumnSettings =
|
|
15
|
-
(
|
|
15
|
+
(typeof props.parentIndex === 'number'
|
|
16
|
+
? allColumnSettings[props.parentIndex]
|
|
17
|
+
: undefined) ?? {
|
|
16
18
|
hideOnMobile: false,
|
|
17
19
|
sortable: false,
|
|
18
20
|
}
|