2017-05-16 13:34:00 +02:00
|
|
|
|
|
|
|
import React from 'react'
|
2017-07-04 12:43:55 +02:00
|
|
|
import {connect} from 'react-redux'
|
2018-11-08 15:29:40 +01:00
|
|
|
import {replace} from 'react-router-redux'
|
2017-05-16 13:34:00 +02:00
|
|
|
|
|
|
|
import PageHeader from 'components/page-header'
|
|
|
|
|
|
|
|
import Lookup from 'components/lookup'
|
2017-06-28 14:02:54 +02:00
|
|
|
import LookupSummary from 'components/lookup/results-summary'
|
2017-05-16 13:34:00 +02:00
|
|
|
|
2018-06-26 17:12:16 +02:00
|
|
|
import Content from 'components/content'
|
|
|
|
|
2017-07-04 12:43:55 +02:00
|
|
|
class LookupView extends React.Component {
|
|
|
|
render() {
|
|
|
|
if (this.props.enabled == false) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="lookup-container">
|
|
|
|
<div className="col-md-8">
|
|
|
|
<Lookup />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-09-17 15:35:46 +02:00
|
|
|
const LookupWidget = connect(
|
2017-07-04 12:43:55 +02:00
|
|
|
(state) => {
|
|
|
|
return {
|
|
|
|
enabled: state.config.prefix_lookup_enabled
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)(LookupView);
|
|
|
|
|
|
|
|
|
2018-11-08 15:29:40 +01:00
|
|
|
class Welcome extends React.Component {
|
|
|
|
componentDidMount() {
|
|
|
|
// Check if there is a query already set
|
|
|
|
if (this.props.query != "") {
|
|
|
|
// We should redirect to the search page
|
|
|
|
const destination = {
|
|
|
|
pathname: "/search",
|
|
|
|
search: `?q=${this.props.query}`
|
|
|
|
};
|
|
|
|
this.props.dispatch(replace(destination));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-16 13:34:00 +02:00
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className="welcome-page">
|
|
|
|
<PageHeader></PageHeader>
|
|
|
|
|
|
|
|
<div className="jumbotron">
|
2018-06-26 17:12:16 +02:00
|
|
|
<h1><Content id="welcome.title">Welcome to Alice!</Content></h1>
|
|
|
|
<p><Content id="welcome.tagline">Your friendly bird looking glass</Content></p>
|
2017-05-16 13:34:00 +02:00
|
|
|
</div>
|
|
|
|
|
2018-09-17 15:35:46 +02:00
|
|
|
<LookupWidget />
|
2017-07-04 12:43:55 +02:00
|
|
|
|
2017-05-16 13:34:00 +02:00
|
|
|
</div>
|
2017-07-04 12:43:55 +02:00
|
|
|
);
|
2017-05-16 13:34:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-08 15:29:40 +01:00
|
|
|
export default connect(
|
|
|
|
(state) => ({
|
|
|
|
query: state.lookup.query,
|
|
|
|
})
|
|
|
|
)(Welcome);
|
2017-05-16 13:34:00 +02:00
|
|
|
|