import bindAll from 'lodash-es/bindAll'; import { Component } from 'inferno'; import { Button, Col, Container, Jumbotron, Modal, ModalBody, ModalFooter, ModalHeader, Row, } from '//components/Bootstrap'; export class HomeView extends Component { constructor (props) { super(props); this.state = { exifData: [], showModal: false, }; bindAll(this, [ 'bindEvents', 'handleDrop', 'showErrorDialog', 'showOpenDialog', 'showSaveDialog', 'toggleErrorModal', ]); } componentDidMount () { this.bindEvents(); } bindEvents () { this.context.ws.subscribe('parsed-exif-tags', data => { this.setState({ exifData: data, }); }); } handleDragOver (e) { e.preventDefault(); e.stopPropagation(); } handleDrop (e) { e.preventDefault(); e.stopPropagation(); const draggedFiles = []; for (const f of e.dataTransfer.files) { draggedFiles.push(f.path); } const newTransfer = { ...e.dataTransfer }; console.info(newTransfer); this.context.ws.sendJSON('dropped-files', draggedFiles); } showErrorDialog () { this.context.ws.sendJSON( 'show-error-box', 'Looks like there was a problem. (╥﹏╥) \n (╯°□°)╯︵ ┻━┻' ); } showOpenDialog () { this.context.ws.sendJSON('show-open-dialog'); } showSaveDialog () { this.context.ws.sendJSON('show-save-dialog'); } toggleErrorModal () { this.setState(prevState => ({ showModal: !prevState.showModal, })); } render () { return (

Welcome to Film Exif

Drop files here.

Parsed Exif Data

{JSON.stringify(this.state.exifData, null, 2)}
Error Title Looks like there was a problem. (╥﹏╥)
(╯°□°)╯︵ ┻━┻
); } }