/* eslint-disable react/jsx-indent-props */ /* eslint-disable import/no-absolute-path */ /* eslint-disable react/jsx-indent */ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { Table, Alert, Button } from 'react-bootstrap'; import { timeago } from '@cleverbeagle/dates'; import { Meteor } from 'meteor/meteor'; import { withTracker } from 'meteor/react-meteor-data'; import { Trans, translate } from 'react-i18next'; import { Bert } from 'meteor/themeteorchef:bert'; import UserSubsToFiresCollection from '/imports/api/Subscriptions/Subscriptions'; import SelectionMap, { action } from '/imports/ui/components/SelectionMap/SelectionMap'; import Loading from '../../components/Loading/Loading'; import './Subscriptions.scss'; class Subscriptions extends Component { constructor(props) { super(props); this.t = props.t; this.state = { action: action.view }; this.onViewportChanged = this.onViewportChanged.bind(this); this.onFstBtn = this.onFstBtn.bind(this); this.onSndBtn = this.onSndBtn.bind(this); } onFstBtn() { // console.log(this.state); this.props.history.push(`${this.props.match.url}/new`, { center: this.state.center, zoom: this.state.zoom }); } onSndBtn() { this.setState({ action: action.edit }); } onViewportChanged(viewport) { this.state.center = viewport.center; this.state.zoom = viewport.zoom; } handleRemove(subscriptionId) { if (confirm('Are you sure? This is permanent!')) { Meteor.call('subscriptions.remove', subscriptionId, (error) => { if (error) { Bert.alert(error.reason, 'danger'); } else { Bert.alert('Subscription deleted!', 'success'); } }); } } render() { const { loading, t, subscriptions, match, history } = this.props; return (!loading ? (
| {location.lat},{location.lon} | {timeago(updatedAt)} | {timeago(createdAt)} |