const m = require('mithril') const Authentication = require('./authentication') const api = require('./api') const Input = require('./input') const Upload = { oninit: function(vnode) { Authentication.requiresLogin() this.error = '' this.form = { title: '', date: new Date(), file: null, } }, uploadvideo: function(vnode, e) { }, view: function(vnode) { return [ m('div.page.page-upload', [ m('div.modal', [ m('form', { onsubmit: this.uploadvideo.bind(this, vnode), }, [ m('h3', 'Upload new video'), this.error ? m('p.error', this.error) : null, m(Input, { label: 'Title', form: this.form, formKey: 'title', }), m(Input, { label: 'Date', type: 'datetime', form: this.form, formKey: 'date', }), m('input.spinner', { hidden: api.loading, type: 'submit', value: 'Log in', }), api.loading ? m('div.loading-spinner') : null, ]), m('div.login--asuna.spritesheet'), ]), ]), ] }, } module.exports = Upload