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

@ -43,3 +43,4 @@ vjrj:piwik # Stats
mdg:geolocation
natestrauser:publish-performant-counts
maximum:server-transform
mys:fonts

View file

@ -75,6 +75,7 @@ modules-runtime@0.8.0
mongo@1.2.2
mongo-dev-server@1.0.1
mongo-id@1.0.6
mys:fonts@0.0.2
natestrauser:publish-performant-counts@0.1.2
npm-bcrypt@0.9.3
npm-mongo@2.2.30

View file

@ -7,8 +7,8 @@
https://fezvrasta.github.io/bootstrap-material-design/docs/4.0/getting-started/introduction/ -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons">
<!-- <link rel="stylesheet" href="https://unpkg.com/bootstrap-material-design@4.0.0-beta.4/dist/css/bootstrap-material-design.min.css" integrity="sha384-R80DC0KVBO4GSTw+wZ5x2zn2pu4POSErBkf8/fSFhPXHxvHJydT0CSgAP2Yo2r4I" crossorigin="anonymous"> -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://unpkg.com/popper.js@1.12.6/dist/umd/popper.js" integrity="sha384-fA23ZRQ3G/J53mElWqVJEGJzU0sTs+SvzG8fXVWP+kJQ1lwFAOkcUOysnlKJC33U" crossorigin="anonymous"></script>
<!-- <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://unpkg.com/popper.js@1.12.6/dist/umd/popper.js" integrity="sha384-fA23ZRQ3G/J53mElWqVJEGJzU0sTs+SvzG8fXVWP+kJQ1lwFAOkcUOysnlKJC33U" crossorigin="anonymous"></script> -->
<!-- <script src="https://unpkg.com/bootstrap-material-design@4.0.0-beta.4/dist/js/bootstrap-material-design.js" integrity="sha384-3xciOSDAlaXneEmyOo0ME/2grfpqzhhTcM4cE32Ce9+8DW/04AGoTACzQpphYGYe" crossorigin="anonymous"></script>
<script>$(document).ready(function() { $('body').bootstrapMaterialDesign(); });</script> -->
@ -17,7 +17,7 @@
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/daemonite-material@4.0.0-beta/css/material.min.css">
<script src="https://cdn.jsdelivr.net/npm/daemonite-material@4.0.0-beta/js/material.min.js"></script> -->
<link rel="shortcut icon" type="image/png" href="/favicon.ico?v2" sizes="16x16 32x32 64x64">
<link rel="shortcut icon" type="image/png" href="/favicon.ico?v3" sizes="16x16 32x32 64x64">
<link rel="apple-touch-icon" sizes="120x120" href="/apple-touch-icon-precomposed.png">
</head>

View file

@ -264,6 +264,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
@ -336,7 +337,7 @@
</g>
<g
id="g22554"
transform="translate(115.99498,49.712132)"
transform="translate(103.16604,61.471991)"
inkscape:export-filename="/mnt/md1/proyectos/dev/todos-contra-el-fuego-web/public/fire-marker.png"
inkscape:export-xdpi="4.0856881"
inkscape:export-ydpi="4.0856881">
@ -447,5 +448,38 @@
inkscape:connector-curvature="0" />
</g>
</g>
<g
id="g17717"
inkscape:export-filename="/mnt/md1/proyectos/dev/todos-contra-el-fuego-web/public/favicon.png"
inkscape:export-xdpi="6"
inkscape:export-ydpi="6">
<rect
y="108.84225"
x="-419.07861"
height="176.48029"
width="176.48029"
id="rect17701"
style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:none;stroke-width:0.26458332;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
<g
style="stroke-width:0.88457036"
inkscape:export-ydpi="4.0856881"
inkscape:export-xdpi="4.0856881"
inkscape:export-filename="/mnt/md1/proyectos/dev/todos-contra-el-fuego-web/public/fire-marker.png"
transform="matrix(1.1304923,0,0,1.1304923,-313.01185,70.713452)"
id="g22554-4">
<path
sodipodi:nodetypes="cszzcczasc"
inkscape:connector-curvature="0"
id="path5329-5"
d="m -25.638382,38.048346 c 11.566313,13.887908 17.1215844,22.244854 13.751242,33.868326 -2.465387,8.50265 -8.895424,18.626534 -18.100172,25.532106 -9.204776,6.905572 -20.549951,13.517692 -24.263404,17.728802 -3.71348,4.21108 -9.835779,11.6046 -10.976769,21.82688 -2.725208,24.7073 15.038044,45.63926 39.702238,48.35952 11.289242,1.2311 26.6324564,-5.2645 34.2331684,-10.31973 C 16.308659,169.98901 28.520768,152.76263 31.570884,138.81099 35.854436,119.21732 35.065926,96.385127 23.626002,79.16853 12.946123,63.095807 3.8673424,50.775037 -25.638382,38.048346 Z"
style="fill:#d41300;fill-opacity:1;stroke:none;stroke-width:9.36170292;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cszzcczcsc"
inkscape:connector-curvature="0"
id="path5331-3"
d="m -7.5198746,101.09834 c 4.018254,8.70077 3.821166,14.69136 0.49964,20.18233 -2.429696,4.01667 -7.1125824,8.31964 -12.7749834,10.59336 -5.662401,2.27373 -12.38086,4.1034 -14.860826,5.75067 -2.479966,1.64727 -6.630512,4.59399 -8.617877,9.67322 -4.786736,12.28103 1.27127,26.11038 13.530846,30.8887 5.613373,2.17993 11.515354,2.13146 17.442629,-0.0849 5.9272234,-2.21636 14.0405914,-9.44377 18.0234704,-15.42084 6.3490206,-9.59829 8.9531296,-23.76395 5.4565016,-34.15229 -3.2643496,-9.69812 -4.6224286,-12.3603 -18.6994006,-27.43025 z"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:9.36170292;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before After
Before After

10
fonts.json Normal file
View file

@ -0,0 +1,10 @@
{
"extensions": [ "ttf", "woff", "woff2" ],
"map": {
"node_modules/simple-line-icons/fonts/Simple-Line-Icons.woff": "fonts/Simple-Line-Icons.woff",
"node_modules/simple-line-icons/fonts/Simple-Line-Icons.woff": "fonts/Simple-Line-Icons.woff?v=2.4.0",
"node_modules/simple-line-icons/fonts/Simple-Line-Icons.woff2": "fonts/Simple-Line-Icons.woff2?v=2.4.0",
"node_modules/simple-line-icons/fonts/Simple-Line-Icons.ttf": "fonts/Simple-Line-Icons.ttf?v=2.4.0"
},
"verbose": false
}

View file

@ -0,0 +1,47 @@
import React from 'react';
import { Meteor } from 'meteor/meteor';
import i18n from 'i18next';
const gmapkey = new ReactiveVar();
Meteor.startup(function() {
Meteor.call('getMapKey', function (error, key) {
if (typeof key !== 'undefined') {
// console.log(key);
gmapkey.set(key);
} else {
callback(error, null)
}
})
});
class GkeysC {
constructor() {
this.state = { init: false };
}
load(callback) {
if (this.state.init) {
// already loaded
callback(null, gmapkey.get());
} else {
this.state.init = true;
Meteor.autorun(function() {
var key = gmapkey.get();
if (typeof key !== 'undefined') {
var script = document.createElement('script');
script.type = 'text/javascript';
script.onload = function () {
// console.log(key);
callback(null, key);
}.bind(this);
// https://stackoverflow.com/questions/28130114/google-maps-places-autocomplete-language-output
script.src = `https://maps.googleapis.com/maps/api/js?key=${key}&libraries=places&language=${i18n.language}`
document.body.appendChild(script);
}
}.bind(this));
}
}
}
export let Gkeys = new GkeysC();

View file

@ -1,34 +0,0 @@
import { Meteor } from 'meteor/meteor';
import i18n from 'i18next';
const gmapkey = new ReactiveVar();
Meteor.startup(function() {
Meteor.call('getMapKey', function (error, key) {
if (typeof key !== 'undefined') {
// console.log(key);
gmapkey.set(key);
} else {
callback(error, null)
}
})
});
var getGKeys = function (callback) {
Meteor.autorun(function() {
var key = gmapkey.get();
if (typeof key !== 'undefined') {
var script = document.createElement('script');
script.type = 'text/javascript';
script.onload = function () {
// console.log(key);
callback(null, key);
};
// https://stackoverflow.com/questions/28130114/google-maps-places-autocomplete-language-output
script.src = `https://maps.googleapis.com/maps/api/js?key=${key}&libraries=places&language=${i18n.language}`
document.body.appendChild(script);
}
});
}
export default getGKeys;

View file

@ -16,17 +16,19 @@ import NavItem from '../NavItem/NavItem';
import { Meteor } from 'meteor/meteor';
const AuthenticatedNavigation = ({ name, history, props }) => (
<Nav pullRight>
<ul className="navbar-nav ml-auto ">
{/* <Nav pullRight> */}
<LinkContainer className="nav-item" anchorClassName="nav-link" to="/documents">
<NavItem eventKey={1} href="/documents">Documents</NavItem>
<NavItem eventKey={3} href="/documents">Documents</NavItem>
</LinkContainer>
<LinkContainer className="nav-item" anchorClassName="nav-link" to="/profile">
<NavItem eventKey={2.1} href="/profile">{name}</NavItem>
<NavItem eventKey={3.1} href="/profile">{name}</NavItem>
</LinkContainer>
<LinkContainer className="nav-item" anchorClassName="nav-link" to="/logout">
<NavItem eventKey={2.2} onClick={() => history.push('/logout')} href="/logout"><Trans i18nKey="Cerrar sesión">Cerrar sesión</Trans></NavItem>
<NavItem eventKey={3.2} onClick={() => history.push('/logout')} href="/logout"><Trans i18nKey="Cerrar sesión">Cerrar sesión</Trans></NavItem>
</LinkContainer>
</Nav>
{/* </Nav> */}
</ul>
);
AuthenticatedNavigation.propTypes = {

View file

@ -9,7 +9,6 @@ class CenterInMyPosition extends React.Component {
}
onClick = (event) => {
console.log("Click?");
// this.props.onClick(event);
// https://atmospherejs.com/mdg/geolocation
// only with SSL:
@ -27,6 +26,7 @@ class CenterInMyPosition extends React.Component {
zoom: 11
}
self.props.onClick(viewport);
// console.log(viewport);
// self.onViewportChanged(viewport);
computation.stop();
}
@ -36,7 +36,7 @@ class CenterInMyPosition extends React.Component {
render() {
return (
<Button bsStyle="default" onClick={(event) => this.onClick(event)}>
<i className="location"/>{this.props.t("Centrar el mapa en tu ubicación")}
<i className="icons icon-target"/>{this.props.t("Centrar el mapa en tu ubicación")}
</Button>
)
}

View file

@ -9,23 +9,29 @@ import { translate } from 'react-i18next';
import './Navigation.scss';
const Navigation = props => (
<Navbar bsClass="navbar navbar-dark bg-dark">
<nav className="navbar navbar-expand-lg navbar-dark bg-dark">
<div className="container">
{/* <Navbar bsClass="navbar navbar-dark bg-dark"> */}
{/* https://github.com/react-bootstrap/react-bootstrap/blob/master/src/Navbar.js */}
<Navbar.Header>
{window.location.pathname != '/'?
<Navbar.Brand>
<Link to="/">{props.t('AppNameFull')}</Link>
</Navbar.Brand>: ''
}
<Link to="/">{props.t('AppNameFull')}</Link>
</Navbar.Brand>
{/* <Navbar.Toggle/> */}
<button className="sr-only navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span>
</button>
</Navbar.Header>
<Navbar.Collapse>
<button className="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span className="navbar-toggler-icon"></span>
</button>
{/* <Navbar.Collapse> */}
<div className="collapse navbar-collapse" id="navbarNavDropdown">
{!props.authenticated ? <PublicNavigation /> : <AuthenticatedNavigation {...props} />}
</Navbar.Collapse>
</Navbar>
{/* </Navbar.Collapse> */}
</div>
</div>
</nav>
);
Navigation.defaultProps = {

View file

@ -26,3 +26,15 @@ a.nav-link:hover {
.navbar {
padding: 0.3rem 0rem;
}
a.navbar-brand {
font-size: 26px;
}
@media (max-width: 480px) {
a.navbar-brand {
font-size: 16px;
padding: 15px 3px;
}
}

View file

@ -12,7 +12,11 @@ import { translate } from 'react-i18next';
import NavItem from '../NavItem/NavItem';
const PublicNavigation = (props) => (
<Nav pullRight>
<ul className="navbar-nav ml-auto ">
{/* <Nav pullRight> */}
<LinkContainer className="nav-item" anchorClassName="nav-link" to="/sandbox">
<NavItem href="/sandbox">Sandbox</NavItem>
</LinkContainer>
<LinkContainer className="nav-item" anchorClassName="nav-link" to="/fires">
<NavItem href="/fires">{props.t('activeFires')}</NavItem>
</LinkContainer>
@ -22,7 +26,8 @@ const PublicNavigation = (props) => (
<LinkContainer className="nav-item" anchorClassName="nav-link" to="/login">
<NavItem eventKey={2} href="/login">{props.t('Iniciar sesión')}</NavItem>
</LinkContainer>
</Nav>
{/* </Nav> */}
</ul>
);
export default translate([], { wait: true })(PublicNavigation);

View file

@ -43,6 +43,7 @@ import { check } from 'meteor/check';
import FiresMap from '../../pages/FiresMap/FiresMap';
import Sandbox from '../../pages/Sandbox/Sandbox';
import 'simple-line-icons/css/simple-line-icons.css';
import './App.scss';
const history = createHistory()

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() {

View file

@ -50,6 +50,7 @@
"react-router-dom": "^4.2.2",
"reactstrap": "^5.0.0-alpha.3",
"simpl-schema": "^0.3.2",
"simple-line-icons": "^2.4.1",
"turf-union": "^3.0.12"
},
"devDependencies": {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

Before After
Before After

BIN
public/favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB