diff --git a/client/components/lookup/index.jsx b/client/components/lookup/index.jsx index 3047420..28fa3e6 100644 --- a/client/components/lookup/index.jsx +++ b/client/components/lookup/index.jsx @@ -10,7 +10,6 @@ import {connect} from 'react-redux' import {replace} from 'react-router-redux' import {setLookupQueryValue} from './actions' -import {makeSearchQueryProps} from './query' import LookupResults from './results' import SearchInput from 'components/search-input' @@ -46,9 +45,15 @@ class Lookup extends React.Component { } doLookup(q) { + // Make path + const destination = { + pathname: "/search", + search: `?q=${q}` + }; + // Set lookup params this.props.dispatch(setLookupQueryValue(q)); - this.debouncedDispatch(replace(makeSearchQueryProps(q))); + this.debouncedDispatch(replace(destination)); } componentDidMount() { diff --git a/client/components/lookup/page.jsx b/client/components/lookup/page.jsx index 8c54338..a5b45cb 100644 --- a/client/components/lookup/page.jsx +++ b/client/components/lookup/page.jsx @@ -9,7 +9,7 @@ import LookupSummary from 'components/lookup/results-summary' import Content from 'components/content' -class LookupView extends React.Component { +class _LookupView extends React.Component { render() { if (this.props.enabled == false) { return null; @@ -28,26 +28,24 @@ class LookupView extends React.Component { } } -const LookupWidget = connect( +const LookupView = connect( (state) => { return { enabled: state.config.prefix_lookup_enabled } } -)(LookupView); +)(_LookupView); -export default class Welcome extends React.Component { +export default class LookupPage extends React.Component { render() { return (

- - +
); } } - diff --git a/client/components/lookup/pagination.jsx b/client/components/lookup/pagination.jsx index 1cc36b7..44a5c09 100644 --- a/client/components/lookup/pagination.jsx +++ b/client/components/lookup/pagination.jsx @@ -21,6 +21,7 @@ import {connect} from 'react-redux' import {Link} from 'react-router' import {push} from 'react-router-redux' + /* * Maybe this can be customized and injected into * the PageLink component. diff --git a/client/components/lookup/query.jsx b/client/components/lookup/query.jsx deleted file mode 100644 index 9ca538f..0000000 --- a/client/components/lookup/query.jsx +++ /dev/null @@ -1,11 +0,0 @@ - -import {urlEscape} from 'components/utils/query' - -export const makeSearchQueryProps = function(query) { - query = urlEscape(query); - return { - pathname: '/search', - search: `?q=${query}` - } -} - diff --git a/client/components/lookup/results-summary.jsx b/client/components/lookup/results-summary.jsx index ce65756..b854c46 100644 --- a/client/components/lookup/results-summary.jsx +++ b/client/components/lookup/results-summary.jsx @@ -1,8 +1,39 @@ import React from 'react' import {connect} from 'react-redux' +import moment from 'moment' + import RelativeTime from 'components/relativetime' + + +const RefreshState = function(props) { + if (!props.cachedAt || !props.cacheTtl) { + return null; + } + + const cachedAt = moment.utc(props.cachedAt); + const cacheTtl = moment.utc(props.cacheTtl); + + if (cacheTtl.isBefore(moment.utc())) { + // This means cache is currently being rebuilt + return ( +
  • + Routes cache was built + and is currently being refreshed. +
  • + ); + + } + + return ( +
  • + Routes cache was built + and will be refreshed . +
  • + ); +} + class ResultsBox extends React.Component { render() { @@ -23,9 +54,8 @@ class ResultsBox extends React.Component { and {this.props.totalFiltered} filtered routes.
  • Query took {queryDuration} ms to complete.
  • -
  • Routes cache was built - and will be refreshed . -
  • +