film-exif/src/views/HomeView.js

43 lines
815 B
JavaScript
Raw Normal View History

2018-04-03 14:13:16 -04:00
import {
Container,
Jumbotron,
Row,
2018-04-10 16:51:47 -04:00
} from '../components/Bootstrap';
2018-04-13 23:28:55 -04:00
import { JSONMessage } from '../helpers/web-socket';
2018-04-03 14:13:16 -04:00
2018-04-03 21:47:41 -04:00
function handleDrop (e) {
e.preventDefault();
e.stopPropagation();
2018-04-13 23:28:55 -04:00
const draggedFiles = [];
2018-04-03 21:47:41 -04:00
for (const f of e.dataTransfer.files) {
2018-04-13 23:28:55 -04:00
draggedFiles.push(f.path);
2018-04-03 21:47:41 -04:00
}
2018-04-13 23:28:55 -04:00
window.clientWS.send(JSONMessage('dropped-files', draggedFiles));
2018-04-03 21:47:41 -04:00
}
function handleDragOver (e) {
e.preventDefault();
e.stopPropagation();
}
2018-04-03 14:13:16 -04:00
export const HomeView = (props) => {
return (
2018-04-03 21:47:41 -04:00
<Jumbotron onDrop={handleDrop} onDragover={handleDragOver}>
2018-04-03 14:13:16 -04:00
<Container className="App">
<Row>
<header className="App-header">
2018-04-03 22:27:41 -04:00
<h1>Welcome to Film Exif</h1>
2018-04-03 14:13:16 -04:00
</header>
</Row>
<Row>
<p className="App-intro">
2018-04-03 22:27:41 -04:00
Drop files here.
2018-04-03 14:13:16 -04:00
</p>
</Row>
</Container>
</Jumbotron>
2018-04-03 15:19:45 -04:00
);
};