From e01b9d3f16dacb6504c69a65b2f3c3e0f85c4094 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 18 Feb 2018 23:51:41 +0900 Subject: wip --- src/web/app/common/define-widget.ts | 23 +-- src/web/app/common/views/components/index.ts | 22 ++- .../app/common/views/components/messaging-form.vue | 18 +- src/web/app/common/views/components/messaging.vue | 2 +- .../common/views/components/widgets/calendar.vue | 192 --------------------- .../common/views/components/widgets/donation.vue | 45 ----- .../app/common/views/components/widgets/nav.vue | 29 ---- .../views/components/widgets/photo-stream.vue | 122 ------------- .../common/views/components/widgets/profile.vue | 125 -------------- .../common/views/components/widgets/slideshow.vue | 153 ---------------- .../app/common/views/components/widgets/tips.vue | 108 ------------ .../desktop/-tags/home-widgets/notifications.tag | 66 ------- .../app/desktop/views/components/drive-window.vue | 10 +- .../app/desktop/views/components/follow-button.vue | 1 - src/web/app/desktop/views/components/home.vue | 12 +- src/web/app/desktop/views/components/index.ts | 14 ++ .../desktop/views/components/messaging-window.vue | 4 +- .../desktop/views/components/settings-window.vue | 5 + .../desktop/views/components/ui-header-account.vue | 4 +- .../app/desktop/views/components/ui-header-nav.vue | 4 +- .../desktop/views/components/widgets/calendar.vue | 192 +++++++++++++++++++++ .../desktop/views/components/widgets/donation.vue | 45 +++++ .../desktop/views/components/widgets/messaging.vue | 2 +- .../app/desktop/views/components/widgets/nav.vue | 29 ++++ .../views/components/widgets/notifications.vue | 70 ++++++++ .../views/components/widgets/photo-stream.vue | 122 +++++++++++++ .../desktop/views/components/widgets/profile.vue | 125 ++++++++++++++ .../desktop/views/components/widgets/slideshow.vue | 153 ++++++++++++++++ .../app/desktop/views/components/widgets/tips.vue | 108 ++++++++++++ 29 files changed, 909 insertions(+), 896 deletions(-) delete mode 100644 src/web/app/common/views/components/widgets/calendar.vue delete mode 100644 src/web/app/common/views/components/widgets/donation.vue delete mode 100644 src/web/app/common/views/components/widgets/nav.vue delete mode 100644 src/web/app/common/views/components/widgets/photo-stream.vue delete mode 100644 src/web/app/common/views/components/widgets/profile.vue delete mode 100644 src/web/app/common/views/components/widgets/slideshow.vue delete mode 100644 src/web/app/common/views/components/widgets/tips.vue delete mode 100644 src/web/app/desktop/-tags/home-widgets/notifications.tag create mode 100644 src/web/app/desktop/views/components/widgets/calendar.vue create mode 100644 src/web/app/desktop/views/components/widgets/donation.vue create mode 100644 src/web/app/desktop/views/components/widgets/nav.vue create mode 100644 src/web/app/desktop/views/components/widgets/notifications.vue create mode 100644 src/web/app/desktop/views/components/widgets/photo-stream.vue create mode 100644 src/web/app/desktop/views/components/widgets/profile.vue create mode 100644 src/web/app/desktop/views/components/widgets/slideshow.vue create mode 100644 src/web/app/desktop/views/components/widgets/tips.vue (limited to 'src') diff --git a/src/web/app/common/define-widget.ts b/src/web/app/common/define-widget.ts index 4e83e37c6e..6088efd7e5 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 209a68fe52..646fa3b71c 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 18d45790e4..37ac51509d 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 1b56382b08..c0b3a1924b 100644 --- a/src/web/app/common/views/components/messaging.vue +++ b/src/web/app/common/views/components/messaging.vue @@ -1,6 +1,6 @@ + + diff --git a/src/web/app/desktop/views/components/widgets/notifications.vue b/src/web/app/desktop/views/components/widgets/notifications.vue new file mode 100644 index 0000000000..2d613fa232 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/notifications.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/photo-stream.vue b/src/web/app/desktop/views/components/widgets/photo-stream.vue new file mode 100644 index 0000000000..a3f37e8c7e --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/photo-stream.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/profile.vue b/src/web/app/desktop/views/components/widgets/profile.vue new file mode 100644 index 0000000000..9a0d40a5c0 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/profile.vue @@ -0,0 +1,125 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/slideshow.vue b/src/web/app/desktop/views/components/widgets/slideshow.vue new file mode 100644 index 0000000000..beda350666 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/slideshow.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/src/web/app/desktop/views/components/widgets/tips.vue b/src/web/app/desktop/views/components/widgets/tips.vue new file mode 100644 index 0000000000..2991fbc3b9 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/tips.vue @@ -0,0 +1,108 @@ + + + + + -- cgit v1.2.3-freya