From 7ba5b93079cbd73fc6f18d38e70fbae9e05c95d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 20 Jun 2018 10:09:38 +0200 Subject: [PATCH] add SyncAgo because it's very useful thing to know... --- src/components/SyncAgo.js | 16 ++++++++++++++++ .../modals/AccountSettingRenderBody.js | 3 ++- static/i18n/en/app.yml | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/components/SyncAgo.js diff --git a/src/components/SyncAgo.js b/src/components/SyncAgo.js new file mode 100644 index 00000000..320732cf --- /dev/null +++ b/src/components/SyncAgo.js @@ -0,0 +1,16 @@ +// @flow + +import React, { PureComponent } from 'react' +import moment from 'moment' +import { translate } from 'react-i18next' +import type { T } from 'types/common' +import Box from './base/Box' + +class SyncAgo extends PureComponent<{ t: T, date: Date }> { + render() { + const { t, date } = this.props + return {t('app:common.sync.ago', { time: moment(date).fromNow() })} + } +} + +export default translate()(SyncAgo) diff --git a/src/components/modals/AccountSettingRenderBody.js b/src/components/modals/AccountSettingRenderBody.js index ee8594e8..c4aef19d 100644 --- a/src/components/modals/AccountSettingRenderBody.js +++ b/src/components/modals/AccountSettingRenderBody.js @@ -22,6 +22,7 @@ import Box from 'components/base/Box' import Button from 'components/base/Button' import Input from 'components/base/Input' import Select from 'components/base/Select' +import SyncAgo from 'components/SyncAgo' import { ModalBody, @@ -258,12 +259,12 @@ class HelperComp extends PureComponent { ) : null} +