Many improvements: navbar, favico, new icons

This commit is contained in:
vjrj 2017-12-07 17:29:17 +01:00
parent 3dc8edb4a8
commit f1786541cd
20 changed files with 161 additions and 83 deletions

View file

@ -6,8 +6,9 @@ import DistanceSlider from '/imports/ui/components/DistanceSlider/DistanceSlider
import SelectionMap from '/imports/ui/components/SelectionMap/SelectionMap';
import update from 'immutability-helper';
import { withTracker } from 'meteor/react-meteor-data';
import getGKeys from '/imports/startup/client/gkeys';
import { Gkeys } from '/imports/startup/client/Gkeys';
import SubsAutocomplete from './SubsAutocomplete';
import CenterInMyPosition from '/imports/ui/components/CenterInMyPosition/CenterInMyPosition.js';
class FireSubscription extends React.Component {
constructor(props) {
@ -18,11 +19,15 @@ class FireSubscription extends React.Component {
}
componentDidMount = () => {
getGKeys(function(err, key) {
Gkeys.load(function(err, key) {
this.setState({init: true});
}.bind(this));
}
centerOnUserLocation = (value) => {
this.setState(update(this.state, {$merge: {lat: value.center[0], lng: value.center[1]}}));
}
onAutocompleteChange = (value) => {
this.setState(update(this.state, {$merge: {lat: value.lat, lng: value.lng}}));
}
@ -49,6 +54,9 @@ class FireSubscription extends React.Component {
</Col>
<Col xs={12} sm={12} md={6} lg={6} >
<DistanceSlider onChange={(value) => this.onSliderChange(value)} />
<Row className="align-items-center justify-content-center">
<CenterInMyPosition onClick={(viewport) => this.centerOnUserLocation(viewport)} />
</Row>
</Col>
</Row>
<Row className="align-items-center justify-content-center">

View file

@ -46,9 +46,10 @@ class SubsAutocomplete extends React.Component {
},
}
// http://simplelineicons.com/
const AutocompleteItem = ({ formattedSuggestion }) => (
<div className="suggestion-item">
<i className='fa fa-map-marker suggestion-icon'/>{' '}
<i className="icons icon-location-pin suggestion-icon"/>{' '}
<strong>{formattedSuggestion.mainText}</strong>{' '}
<small className="text-muted">{formattedSuggestion.secondaryText}</small>
</div>)

View file

@ -140,28 +140,8 @@ class FiresMap extends React.Component {
this.unionGroup = new L.LayerGroup();
}
centerOnUserLocation = () => {
// https://atmospherejs.com/mdg/geolocation
// only with SSL:
// https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
// https://stackoverflow.com/questions/31608579/somethings-wrong-with-my-meteor-geolocation-functions
var userGeoLocation = new ReactiveVar(null);
var state = this.state;
var self = this;
Tracker.autorun(function (computation) {
userGeoLocation.set(Geolocation.latLng());
if (userGeoLocation.get()) {
//stop the tracker if we got something
var viewport = {
center: [userGeoLocation.get().lat, userGeoLocation.get().lng],
zoom: 11
}
self.onViewportChanged(viewport);
// console.log(userGeoLocation.get());
computation.stop();
}
});
centerOnUserLocation = (viewport) => {
this.onViewportChanged(viewport);
}
componentDidMount() {
@ -274,7 +254,7 @@ class FiresMap extends React.Component {
<Checkbox disabled={this.state.viewport.zoom < MAXZOOM} inline={false} onClick={e => this.useMarkers(e.target.checked)}>
<Trans className="mark-checkbox" parent="span">Resaltar los fuegos con un marcador</Trans>
</Checkbox>
<CenterInMyPosition onClick={(event) => this.centerOnUserLocation(event)} />
<CenterInMyPosition onClick={(viewport) => this.centerOnUserLocation(viewport)} />
</Col>
</Row>
<Row>
@ -304,7 +284,7 @@ class FiresMap extends React.Component {
</Map>
</Row>
<Row>
(*)&nbsp;<Trans i18nKey="mapPrivacy" parent="span"><em>Para preservar la privacidad de nuestros usuarios/as, los datos reflejados están aleatoriamente alterados y son solo orientativos.</em></Trans>
<p><span style={{paddingRight: "5px"}}>(*)</span><Trans i18nKey="mapPrivacy" parent="span"><em>Para preservar la privacidad de nuestros usuarios/as, los datos reflejados están aleatoriamente alterados y son solo orientativos.</em></Trans></p>
</Row>
</div>
);

View file

@ -3,7 +3,7 @@ import { Trans, translate } from 'react-i18next';
import DistanceSlider from '/imports/ui/components/DistanceSlider/DistanceSlider';
import SelectionMap from '/imports/ui/components/SelectionMap/SelectionMap';
import update from 'immutability-helper';
import getGKeys from '/imports/startup/client/gkeys';
import { Gkeys } from '/imports/startup/client/Gkeys';
import FireSubscription from '/imports/ui/pages/FireSubscription/FireSubscription';
class Sandbox extends React.Component {
@ -16,6 +16,9 @@ class Sandbox extends React.Component {
componentDidMount = () => {
this.setState({init: true});
Gkeys.load(function(err, key) {
console.log(key);
}.bind(this));
}
render() {