use date estimate
This commit is contained in:
parent
336f398ce1
commit
3de1298d25
5 changed files with 32 additions and 15 deletions
|
@ -49,7 +49,7 @@
|
|||
"formik": "^0.10.4",
|
||||
"hast-util-sanitize": "^1.1.2",
|
||||
"keytar": "^4.2.1",
|
||||
"lbry-redux": "lbryio/lbry-redux#aa10240bc1e90dff299821e31a88edcb4c5fd295",
|
||||
"lbry-redux": "lbryio/lbry-redux#6f1e3b054fda5a818eacf778393022f96082c387",
|
||||
"lbryinc": "lbryio/lbryinc#7a458ea13ceceffa0191e73139f94e5c953f22b1",
|
||||
"localforage": "^1.7.1",
|
||||
"mammoth": "^1.4.6",
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
import { connect } from 'react-redux';
|
||||
import { selectPageTitle, selectHistoryIndex, selectActiveHistoryEntry } from 'lbry-redux';
|
||||
import {
|
||||
selectPageTitle,
|
||||
selectHistoryIndex,
|
||||
selectActiveHistoryEntry,
|
||||
doUpdateBlockHeight,
|
||||
} from 'lbry-redux';
|
||||
import { doRecordScroll } from 'redux/actions/navigation';
|
||||
import { selectUser } from 'lbryinc';
|
||||
import { doAlertError } from 'redux/actions/app';
|
||||
|
@ -17,6 +22,7 @@ const select = state => ({
|
|||
const perform = dispatch => ({
|
||||
alertError: errorList => dispatch(doAlertError(errorList)),
|
||||
recordScroll: scrollPosition => dispatch(doRecordScroll(scrollPosition)),
|
||||
updateBlockHeight: () => dispatch(doUpdateBlockHeight()),
|
||||
});
|
||||
|
||||
export default connect(
|
||||
|
|
|
@ -8,6 +8,8 @@ import SideBar from 'component/sideBar';
|
|||
import Header from 'component/header';
|
||||
import { openContextMenu } from '../../util/contextMenu';
|
||||
|
||||
const TWO_POINT_FIVE_MINUTES = 1000 * 60 * 2.5;
|
||||
|
||||
type Props = {
|
||||
alertError: (string | {}) => void,
|
||||
recordScroll: number => void,
|
||||
|
@ -15,6 +17,7 @@ type Props = {
|
|||
currentPageAttributes: { path: string, scrollY: number },
|
||||
pageTitle: ?string,
|
||||
theme: string,
|
||||
updateBlockHeight: () => void,
|
||||
};
|
||||
|
||||
class App extends React.PureComponent<Props> {
|
||||
|
@ -38,6 +41,8 @@ class App extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { updateBlockHeight } = this.props;
|
||||
|
||||
const mainContent = document.getElementById('content');
|
||||
this.mainContent = mainContent;
|
||||
|
||||
|
@ -46,6 +51,11 @@ class App extends React.PureComponent<Props> {
|
|||
}
|
||||
|
||||
ReactModal.setAppElement('#window'); // fuck this
|
||||
|
||||
updateBlockHeight();
|
||||
setInterval(() => {
|
||||
updateBlockHeight();
|
||||
}, TWO_POINT_FIVE_MINUTES);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(props: Props) {
|
||||
|
|
|
@ -23,27 +23,28 @@ class DateTime extends React.PureComponent<Props> {
|
|||
};
|
||||
|
||||
componentWillMount() {
|
||||
this.refreshDate(this.props);
|
||||
// this.refreshDate(this.props);
|
||||
}
|
||||
|
||||
componentWillReceiveProps(props) {
|
||||
this.refreshDate(props);
|
||||
componentWillReceiveProps() {
|
||||
// this.refreshDate(props);
|
||||
}
|
||||
|
||||
refreshDate(props) {
|
||||
const { block, date, fetchBlock } = props;
|
||||
if (block && date === undefined) {
|
||||
fetchBlock(block);
|
||||
}
|
||||
}
|
||||
// Removing this for performance reasons. Can be un-commented once block_show is better with large numbers of calls
|
||||
// Or the date is included in the claim
|
||||
//
|
||||
// refreshDate(props: Props) {
|
||||
// const { block, date, fetchBlock } = props;
|
||||
// if (block && date === undefined) {
|
||||
// fetchBlock(block);
|
||||
// }
|
||||
// }
|
||||
|
||||
render() {
|
||||
const { date, formatOptions, timeAgo } = this.props;
|
||||
const show = this.props.show || DateTime.SHOW_BOTH;
|
||||
const locale = app.i18n.getLocale();
|
||||
|
||||
// If !date, it's currently being fetched
|
||||
|
||||
if (timeAgo) {
|
||||
return date ? <span>{moment(date).from(moment())}</span> : <span />;
|
||||
}
|
||||
|
|
|
@ -5670,9 +5670,9 @@ lbry-redux@lbryio/lbry-redux#2375860d6269d0369418879c2531b1d48c4e47f2:
|
|||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
||||
lbry-redux@lbryio/lbry-redux#aa10240bc1e90dff299821e31a88edcb4c5fd295:
|
||||
lbry-redux@lbryio/lbry-redux#6f1e3b054fda5a818eacf778393022f96082c387:
|
||||
version "0.0.1"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/aa10240bc1e90dff299821e31a88edcb4c5fd295"
|
||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/6f1e3b054fda5a818eacf778393022f96082c387"
|
||||
dependencies:
|
||||
proxy-polyfill "0.1.6"
|
||||
reselect "^3.0.0"
|
||||
|
|
Loading…
Add table
Reference in a new issue