Skip to content

Commit 8e4da88

Browse files
authored
feat(simplify): add subtitle, sort by firstPublishedAt (#4)
1 parent 708b89d commit 8e4da88

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## [HEAD]
44
> Unreleased
55
6+
* feat(simplify): add subtitle, sort by firstPublishedAt
7+
68
## [v1.0.2]
79
> Aug 08, 2017
810

src/utils/__tests__/__snapshots__/simplify.test.js.snap

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,63 @@
33
exports[`should return simplify list 1`] = `
44
Array [
55
Object {
6+
"firstPublishedAt": 1501225933707,
7+
"subtitle": "減少 Monorepo CI 所需花費時間",
68
"title": "使用 CircleCI 2.0 Workflows 挑戰三倍速",
7-
"updatedAt": 1501469016352,
89
"url": "https://medium.com/@username/使用-circleci-2-0-workflows-挑戰三倍速-9691e54b0ef0",
910
},
1011
Object {
12+
"firstPublishedAt": 1499912011732,
13+
"subtitle": "使用 Redux-Cylces 實行錯誤集中處理",
1114
"title": "Centralized Error Handle in React with RxJS",
12-
"updatedAt": 1501559328163,
1315
"url": "https://medium.com/@username/centralized-error-handle-in-react-with-rxjs-fac9e9e37e44",
1416
},
1517
Object {
18+
"firstPublishedAt": 1499671540298,
19+
"subtitle": "Landing Page for MCS Lite",
1620
"title": "React Stack 開發體驗與優化策略",
17-
"updatedAt": 1502118302072,
1821
"url": "https://medium.com/@username/react-stack-開發體驗與優化策略-b056da2fa0aa",
1922
},
2023
Object {
24+
"firstPublishedAt": 1495693600421,
25+
"subtitle": "Lazy Load React Component with React-Loadable",
2126
"title": "Component-based Code Splitting",
22-
"updatedAt": 1500651808870,
2327
"url": "https://medium.com/@username/component-based-code-splitting-70aeebbb2dc7",
2428
},
2529
Object {
30+
"firstPublishedAt": 1494422818494,
31+
"subtitle": "以一個簡單到不行的大小寫為例,不單只是 Coding Style 或命名規範,你可能會需要 Eslint 來幫你盡量降低這種小意外的發生。",
2632
"title": "這個雷踩了四次,為什麼你可能需要 Eslint",
27-
"updatedAt": 1501491755288,
2833
"url": "https://medium.com/@username/這個雷踩了四次-為什麼你可能需要-eslint-9330c1245ec1",
2934
},
3035
Object {
36+
"firstPublishedAt": 1493908671942,
37+
"subtitle": "Recently, I have read an article by José M. Pérez about How Medium does progressive image loading, and that is what I need about the lazy…",
3138
"title": "Reproducing Medium Style Progressive Image Loading for React",
32-
"updatedAt": 1501145571134,
3339
"url": "https://medium.com/@username/reproducing-medium-style-progressive-image-loading-for-react-2e83bba0c608",
3440
},
3541
Object {
42+
"firstPublishedAt": 1493193304597,
43+
"subtitle": "MCS Lite’s Front-End Tech Stack for Mobile",
3644
"title": "Build A Web App in MediaTek",
37-
"updatedAt": 1502104016925,
3845
"url": "https://medium.com/@username/build-a-web-app-in-mediatek-61b0a26215a0",
3946
},
4047
Object {
48+
"firstPublishedAt": 1493083372209,
49+
"subtitle": "開發板の隨手筆記 - 封裝 MCS API for Arduino",
4150
"title": "Writing a Library for LinkIt 7697",
42-
"updatedAt": 1494514540173,
4351
"url": "https://medium.com/@username/writing-a-library-for-linkit-7697-9e562d28e17",
4452
},
4553
Object {
54+
"firstPublishedAt": 1492745328047,
55+
"subtitle": "多國語言的機制建議盡量在專案初期就能有好的規劃,不至中後期要把字串抽出將會是件累人的事,而在現今前端開發的演進下,多國語言的流程也出現了一些不同的處理方式,以下簡介我們在 MediaTek 內前端專案處理的模式。",
4656
"title": "I18n Workflow for React Project",
47-
"updatedAt": 1502091407846,
4857
"url": "https://medium.com/@username/i18n-workflow-for-react-project-9f9ff8fe9aef",
4958
},
5059
Object {
60+
"firstPublishedAt": 1492590593069,
61+
"subtitle": "Prettier v1.0.0 就在四月初已經正式釋出,等同宣稱在 Production 環境也可安心穩定地使用了,也是時候考慮導入至專案中囉。在專案的導入順序我想應該會是 Prettier 再來才是 Eslint 的設定,兩者是可以並存的,以下以我覺得的導入順序做介紹。",
5162
"title": "Introducing Prettier with Eslint",
52-
"updatedAt": 1501264734071,
5363
"url": "https://medium.com/@username/introducing-prettier-with-eslint-13f567ae0184",
5464
},
5565
]

src/utils/simplify.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@ const simplify = username =>
55
R.pipe(
66
R.path(['payload', 'references', 'Post']),
77
R.values,
8-
R.project(['title', 'uniqueSlug', 'updatedAt']),
8+
R.project(['title', 'uniqueSlug', 'firstPublishedAt', 'content']),
99
R.map(e => ({
1010
title: e.title,
11-
updatedAt: e.updatedAt,
11+
firstPublishedAt: e.firstPublishedAt,
1212
url: `${BASE_URL}/@${username}/${e.uniqueSlug}`,
13+
subtitle: e.content.subtitle,
1314
})),
15+
R.sort(R.descend(R.prop('firstPublishedAt'))),
1416
);
1517

1618
module.exports = simplify;

0 commit comments

Comments
 (0)