From e01b9d3f16dacb6504c69a65b2f3c3e0f85c4094 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 18 Feb 2018 23:51:41 +0900 Subject: [PATCH] wip --- src/web/app/common/define-widget.ts | 23 ++---- src/web/app/common/views/components/index.ts | 22 +++--- .../views/components/messaging-form.vue | 18 ++--- .../app/common/views/components/messaging.vue | 2 +- .../-tags/home-widgets/notifications.tag | 66 ----------------- .../desktop/views/components/drive-window.vue | 10 +-- .../views/components/follow-button.vue | 1 - src/web/app/desktop/views/components/home.vue | 12 ++-- src/web/app/desktop/views/components/index.ts | 14 ++++ .../views/components/messaging-window.vue | 4 +- .../views/components/settings-window.vue | 5 ++ .../views/components/ui-header-account.vue | 4 +- .../views/components/ui-header-nav.vue | 4 +- .../views/components/widgets/calendar.vue | 2 +- .../views/components/widgets/donation.vue | 2 +- .../views/components/widgets/messaging.vue | 2 +- .../views/components/widgets/nav.vue | 2 +- .../components/widgets/notifications.vue | 70 +++++++++++++++++++ .../views/components/widgets/photo-stream.vue | 2 +- .../views/components/widgets/profile.vue | 2 +- .../views/components/widgets/slideshow.vue | 2 +- .../views/components/widgets/tips.vue | 2 +- 22 files changed, 142 insertions(+), 129 deletions(-) delete mode 100644 src/web/app/desktop/-tags/home-widgets/notifications.tag rename src/web/app/{common => desktop}/views/components/widgets/calendar.vue (98%) rename src/web/app/{common => desktop}/views/components/widgets/donation.vue (94%) rename src/web/app/{common => desktop}/views/components/widgets/nav.vue (86%) create mode 100644 src/web/app/desktop/views/components/widgets/notifications.vue rename src/web/app/{common => desktop}/views/components/widgets/photo-stream.vue (97%) rename src/web/app/{common => desktop}/views/components/widgets/profile.vue (97%) rename src/web/app/{common => desktop}/views/components/widgets/slideshow.vue (98%) rename src/web/app/{common => desktop}/views/components/widgets/tips.vue (98%) 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 @@