drop.chapril.org-firefoxsend/android/pages/home.js
Donovan Preston 71ea4e74f6
Implement wss preference url in html; Update to work with the tip of vnext branch; allow viewing the android ui from the webpack server (#918)
* Merge branch 'vnext' of https://github.com/mozilla/send into android-preferences

Fix conflicts

* Implement wss preference url in html; Update to work with the tip of vnext branch; allow viewing the android ui from the webpack server

* Use a try/catch in case localStorage isn't available, which it isn't in a ServiceWorker
2018-09-06 18:56:04 -04:00

46 lines
1.4 KiB
JavaScript

const html = require('choo/html');
export default function mainPage(state, emit) {
if (window.location.pathname === '/android/app/src/main/assets/') {
// Hack: For debugging the android app in a web browser from
// http://0.0.0.0:8080/android/app/src/main/assets/ after running webpack
state.prefix = '/android/app/src/main/assets';
}
function clickPreferences(event) {
event.preventDefault();
emit('pushState', '/preferences');
}
function uploadFile(event) {
event.preventDefault();
const target = event.target;
const file = target.files[0];
if (file.size === 0) {
return;
}
emit('pushState', '/upload');
emit('addFiles', { files: [file] });
emit('upload', {});
}
return html`<body>
<div id="white">
<div id="centering">
<a href="#" onclick=${clickPreferences}>
preferenes
</a>
<img src=${state.getAsset('encrypted-envelope.png')} />
<h4>Private, Encrypted File Sharing</h4>
<div>
Send files through a safe, private, and encrypted link that automatically expires to ensure your stuff does not remain online forever.
</div>
<div id="spacer">
</div>
<label id="label" for="input">
<img src=${state.getAsset('cloud-upload.png')} />
</label>
<input id="input" name="input" type="file" onchange=${uploadFile} />
</div>
</div>
</body>`;
}