diff --git a/src/web/app/common/define-widget.ts b/src/web/app/common/define-widget.ts index 4e83e37c6..6088efd7e 100644 --- a/src/web/app/common/define-widget.ts +++ b/src/web/app/common/define-widget.ts @@ -6,22 +6,13 @@ export default function(data: { }) { return Vue.extend({ props: { - wid: { - type: String, - required: true - }, - wplace: { - type: String, - required: true - }, - wprops: { - type: Object, - required: false + widget: { + type: Object } }, computed: { id(): string { - return this.wid; + return this.widget.id; } }, data() { @@ -32,19 +23,19 @@ export default function(data: { watch: { props(newProps, oldProps) { if (JSON.stringify(newProps) == JSON.stringify(oldProps)) return; - this.$root.$data.os.api('i/update_home', { + (this as any).api('i/update_home', { id: this.id, data: newProps }).then(() => { - this.$root.$data.os.i.client_settings.home.find(w => w.id == this.id).data = newProps; + (this as any).os.i.client_settings.home.find(w => w.id == this.id).data = newProps; }); } }, created() { if (this.props) { Object.keys(this.props).forEach(prop => { - if (this.wprops.hasOwnProperty(prop)) { - this.props[prop] = this.wprops[prop]; + if (this.widget.data.hasOwnProperty(prop)) { + this.props[prop] = this.widget.data[prop]; } }); } diff --git a/src/web/app/common/views/components/index.ts b/src/web/app/common/views/components/index.ts index 209a68fe5..646fa3b71 100644 --- a/src/web/app/common/views/components/index.ts +++ b/src/web/app/common/views/components/index.ts @@ -5,6 +5,7 @@ import signup from './signup.vue'; import forkit from './forkit.vue'; import nav from './nav.vue'; import postHtml from './post-html'; +import pollEditor from './poll-editor.vue'; import reactionIcon from './reaction-icon.vue'; import reactionsViewer from './reactions-viewer.vue'; import time from './time.vue'; @@ -13,18 +14,17 @@ import uploader from './uploader.vue'; import specialMessage from './special-message.vue'; import streamIndicator from './stream-indicator.vue'; import ellipsis from './ellipsis.vue'; -import wNav from './widgets/nav.vue'; -import wCalendar from './widgets/calendar.vue'; -import wPhotoStream from './widgets/photo-stream.vue'; -import wSlideshow from './widgets/slideshow.vue'; -import wTips from './widgets/tips.vue'; -import wDonation from './widgets/donation.vue'; +import messaging from './messaging.vue'; +import messagingForm from './messaging-form.vue'; +import messagingRoom from './messaging-room.vue'; +import messagingMessage from './messaging-message.vue'; Vue.component('mk-signin', signin); Vue.component('mk-signup', signup); Vue.component('mk-forkit', forkit); Vue.component('mk-nav', nav); Vue.component('mk-post-html', postHtml); +Vue.component('mk-poll-editor', pollEditor); Vue.component('mk-reaction-icon', reactionIcon); Vue.component('mk-reactions-viewer', reactionsViewer); Vue.component('mk-time', time); @@ -33,9 +33,7 @@ Vue.component('mk-uploader', uploader); Vue.component('mk-special-message', specialMessage); Vue.component('mk-stream-indicator', streamIndicator); Vue.component('mk-ellipsis', ellipsis); -Vue.component('mkw-nav', wNav); -Vue.component('mkw-calendar', wCalendar); -Vue.component('mkw-photo-stream', wPhotoStream); -Vue.component('mkw-slideshoe', wSlideshow); -Vue.component('mkw-tips', wTips); -Vue.component('mkw-donation', wDonation); +Vue.component('mk-messaging', messaging); +Vue.component('mk-messaging-form', messagingForm); +Vue.component('mk-messaging-room', messagingRoom); +Vue.component('mk-messaging-message', messagingMessage); diff --git a/src/web/app/common/views/components/messaging-form.vue b/src/web/app/common/views/components/messaging-form.vue index 18d45790e..37ac51509 100644 --- a/src/web/app/common/views/components/messaging-form.vue +++ b/src/web/app/common/views/components/messaging-form.vue @@ -23,7 +23,7 @@ export default Vue.extend({ data() { return { text: null, - files: [], + file: null, sending: false }; }, @@ -49,17 +49,17 @@ export default Vue.extend({ }, chooseFileFromDrive() { - const w = new MkDriveChooserWindow({ - propsData: { - multiple: true - } - }).$mount(); - w.$once('selected', files => { - files.forEach(this.addFile); + (this as any).apis.chooseDriveFile({ + multiple: false + }).then(file => { + this.file = file; }); - document.body.appendChild(w.$el); }, + upload() { + // TODO + } + send() { this.sending = true; (this as any).api('messaging/messages/create', { diff --git a/src/web/app/common/views/components/messaging.vue b/src/web/app/common/views/components/messaging.vue index 1b56382b0..c0b3a1924 100644 --- a/src/web/app/common/views/components/messaging.vue +++ b/src/web/app/common/views/components/messaging.vue @@ -1,6 +1,6 @@