From a43cc9c5a966accecc941bad35697b76755b8202 Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Thu, 24 Sep 2020 19:35:28 -0700 Subject: [PATCH] chore(deps): Upgrade RME for improved doc search results --- app/scenes/Document/components/DataLoader.js | 19 +++++++++++++++---- package.json | 2 +- shared/styles/theme.js | 2 ++ yarn.lock | 8 ++++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/app/scenes/Document/components/DataLoader.js b/app/scenes/Document/components/DataLoader.js index 5cc625b7e..f8d99c76a 100644 --- a/app/scenes/Document/components/DataLoader.js +++ b/app/scenes/Document/components/DataLoader.js @@ -1,4 +1,5 @@ // @flow +import distanceInWordsToNow from "date-fns/distance_in_words_to_now"; import invariant from "invariant"; import { observable } from "mobx"; import { observer, inject } from "mobx-react"; @@ -77,9 +78,13 @@ class DataLoader extends React.Component { const slug = parseDocumentSlug(term); try { const document = await this.props.documents.fetch(slug); + const time = distanceInWordsToNow(document.updatedAt, { + addSuffix: true, + }); return [ { title: document.title, + subtitle: `Updated ${time}`, url: document.url, }, ]; @@ -96,10 +101,16 @@ class DataLoader extends React.Component { return results .filter((result) => result.document.title) - .map((result) => ({ - title: result.document.title, - url: result.document.url, - })); + .map((result) => { + const time = distanceInWordsToNow(result.document.updatedAt, { + addSuffix: true, + }); + return { + title: result.document.title, + subtitle: `Updated ${time}`, + url: result.document.url, + }; + }); }; onCreateLink = async (title: string) => { diff --git a/package.json b/package.json index 09346816e..4cdfebe47 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ "react-portal": "^4.0.0", "react-router-dom": "^5.1.2", "react-waypoint": "^9.0.2", - "rich-markdown-editor": "^11.0.0-7", + "rich-markdown-editor": "^11.0.0-8", "semver": "^7.3.2", "sequelize": "^6.3.4", "sequelize-cli": "^6.2.0", diff --git a/shared/styles/theme.js b/shared/styles/theme.js index 2b72284ba..fb0c458a8 100644 --- a/shared/styles/theme.js +++ b/shared/styles/theme.js @@ -139,6 +139,7 @@ export const light = { listItemHoverBackground: colors.warmGrey, + toolbarHoverBackground: colors.black, toolbarBackground: colors.lightBlack, toolbarInput: colors.white10, toolbarItem: colors.white, @@ -193,6 +194,7 @@ export const dark = { listItemHoverBackground: colors.black50, + toolbarHoverBackground: colors.slate, toolbarBackground: colors.white, toolbarInput: colors.black10, toolbarItem: colors.lightBlack, diff --git a/yarn.lock b/yarn.lock index b9884865d..434a288e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9887,10 +9887,10 @@ retry-as-promised@^3.2.0: dependencies: any-promise "^1.3.0" -rich-markdown-editor@^11.0.0-7: - version "11.0.0-7" - resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-11.0.0-7.tgz#2e7501cd37d921eb0e914e02ab076f1acb975b14" - integrity sha512-/17u4wwTv5FqWQf2NG+YhY4nbmrJl/dy//7ToGSBe8dSVcb01B8mLGqwDZ2D3PgmZqtUxbblOF2Q4E8QpQalTQ== +rich-markdown-editor@^11.0.0-8: + version "11.0.0-8" + resolved "https://registry.yarnpkg.com/rich-markdown-editor/-/rich-markdown-editor-11.0.0-8.tgz#542a33963147077a3c01ba2f689f67714056bbb9" + integrity sha512-TTMVMr33CFlk+AkHKE2/nOZ4VRSwq0aOLodCYotztSwGAQ1a01znZmue1gn/VbIrF7/AtxZ/cnIs3p2hJr82bw== dependencies: copy-to-clipboard "^3.0.8" lodash "^4.17.11"