diff --git a/.eslintrc b/.eslintrc
new file mode 100644
index 0000000000..d30cf2aa56
--- /dev/null
+++ b/.eslintrc
@@ -0,0 +1,17 @@
+{
+ "parserOptions": {
+ "parser": "typescript-eslint-parser"
+ },
+ "extends": [
+ "eslint:recommended",
+ "plugin:vue/recommended"
+ ],
+ "rules": {
+ "vue/require-v-for-key": false,
+ "vue/max-attributes-per-line": false,
+ "vue/html-indent": false,
+ "vue/html-self-closing": false,
+ "vue/no-unused-vars": false,
+ "no-console": 0
+ }
+}
diff --git a/package.json b/package.json
index e87be0ab21..727c4af716 100644
--- a/package.json
+++ b/package.json
@@ -99,6 +99,8 @@
"diskusage": "0.2.4",
"elasticsearch": "14.1.0",
"escape-regexp": "0.0.1",
+ "eslint": "^4.18.0",
+ "eslint-plugin-vue": "^4.2.2",
"eventemitter3": "3.0.0",
"exif-js": "2.3.0",
"express": "4.16.2",
@@ -174,6 +176,7 @@
"ts-node": "4.1.0",
"tslint": "5.9.1",
"typescript": "2.7.1",
+ "typescript-eslint-parser": "^13.0.0",
"uglify-es": "3.3.9",
"uglifyjs-webpack-plugin": "1.1.8",
"uuid": "3.2.1",
diff --git a/src/web/app/desktop/-tags/home-widgets/timemachine.tag b/src/web/app/desktop/-tags/home-widgets/timemachine.tag
deleted file mode 100644
index 43f59fe674..0000000000
--- a/src/web/app/desktop/-tags/home-widgets/timemachine.tag
+++ /dev/null
@@ -1,23 +0,0 @@
-
ホームのカスタマイズでは、ウィジェットを追加/削除したり、ドラッグ&ドロップして並べ替えたりすることができます。
' + + '一部のウィジェットは、右クリックすることで表示を変更することができます。
' + + 'ウィジェットを削除するには、ヘッダーの「ゴミ箱」と書かれたエリアにウィジェットをドラッグ&ドロップします。
' + + 'カスタマイズを終了するには、右上の「完了」をクリックします。
', + actions: [{ + text: 'Got it!' + }] + }); + + const sortableOption = { + group: 'kyoppie', + animation: 150, + onMove: evt => { + const id = evt.dragged.getAttribute('data-widget-id'); + this.home.find(tag => tag.id == id).widget.place = evt.to.getAttribute('data-place'); + }, + onSort: () => { + this.saveHome(); + } + }; + + new Sortable(this.leftEl, sortableOption); + new Sortable(this.rightEl, sortableOption); + new Sortable(this.$refs.trash, Object.assign({}, sortableOption, { + onAdd: evt => { + const el = evt.item; + const id = el.getAttribute('data-widget-id'); + el.parentNode.removeChild(el); + (this as any).os.i.client_settings.home = (this as any).os.i.client_settings.home.filter(w => w.id != id); + this.saveHome(); + } + })); + } + }); + }, + beforeDestroy() { + (this as any).os.i.off('refreshed', this.onMeRefreshed); + }, methods: { bakeHomeData() { return JSON.stringify((this as any).os.i.client_settings.home); @@ -130,102 +187,27 @@ export default Vue.extend({ saveHome() { const data = []; - Array.from((this.$refs.left as Element).children).forEach(el => { + Array.from(this.leftEl.children).forEach(el => { const id = el.getAttribute('data-widget-id'); const widget = (this as any).os.i.client_settings.home.find(w => w.id == id); widget.place = 'left'; data.push(widget); }); - Array.from((this.$refs.right as Element).children).forEach(el => { + Array.from(this.rightEl.children).forEach(el => { const id = el.getAttribute('data-widget-id'); const widget = (this as any).os.i.client_settings.home.find(w => w.id == id); widget.place = 'right'; data.push(widget); }); - Array.from((this.$refs.maintop as Element).children).forEach(el => { - const id = el.getAttribute('data-widget-id'); - const widget = (this as any).os.i.client_settings.home.find(w => w.id == id); - widget.place = 'main'; - data.push(widget); - }); - (this as any).api('i/update_home', { home: data }); - } - }, - computed: { - leftWidgets(): any { - return (this as any).os.i.client_settings.home.filter(w => w.place == 'left'); }, - centerWidgets(): any { - return (this as any).os.i.client_settings.home.filter(w => w.place == 'center'); - }, - rightWidgets(): any { - return (this as any).os.i.client_settings.home.filter(w => w.place == 'right'); + warp(date) { + (this.$refs.tl as any)[0].warp(date); } - }, - created() { - this.bakedHomeData = this.bakeHomeData(); - }, - mounted() { - (this as any).os.i.on('refreshed', this.onMeRefreshed); - - this.home = (this as any).os.i.client_settings.home; - - if (!this.customize) { - if ((this.$refs.left as Element).children.length == 0) { - (this.$refs.left as Element).parentNode.removeChild((this.$refs.left as Element)); - } - if ((this.$refs.right as Element).children.length == 0) { - (this.$refs.right as Element).parentNode.removeChild((this.$refs.right as Element)); - } - } - - if (this.customize) { - /*dialog('%fa:info-circle%カスタマイズのヒント', - 'ホームのカスタマイズでは、ウィジェットを追加/削除したり、ドラッグ&ドロップして並べ替えたりすることができます。
' + - '一部のウィジェットは、右クリックすることで表示を変更することができます。
' + - 'ウィジェットを削除するには、ヘッダーの「ゴミ箱」と書かれたエリアにウィジェットをドラッグ&ドロップします。
' + - 'カスタマイズを終了するには、右上の「完了」をクリックします。
', - [{ - text: 'Got it!' - }]);*/ - - const sortableOption = { - group: 'kyoppie', - animation: 150, - onMove: evt => { - const id = evt.dragged.getAttribute('data-widget-id'); - this.home.find(tag => tag.id == id).update({ place: evt.to.getAttribute('data-place') }); - }, - onSort: () => { - this.saveHome(); - } - }; - - new Sortable(this.$refs.left, sortableOption); - new Sortable(this.$refs.right, sortableOption); - new Sortable(this.$refs.maintop, sortableOption); - new Sortable(this.$refs.trash, Object.assign({}, sortableOption, { - onAdd: evt => { - const el = evt.item; - const id = el.getAttribute('data-widget-id'); - el.parentNode.removeChild(el); - (this as any).os.i.client_settings.home = (this as any).os.i.client_settings.home.filter(w => w.id != id); - this.saveHome(); - } - })); - } - }, - beforeDestroy() { - (this as any).os.i.off('refreshed', this.onMeRefreshed); - - this.home.forEach(widget => { - widget.unmount(); - }); } }); @@ -324,26 +306,16 @@ export default Vue.extend({ > * pointer-events none - > main + > .main padding 16px width calc(100% - 275px * 2) - > *:not(.maintop):not(:last-child) - > .maintop > *:not(:last-child) - margin-bottom 16px - - > .maintop - min-height 64px - margin-bottom 16px - > *:not(main) width 275px + padding 16px 0 16px 0 - > * - padding 16px 0 16px 0 - - > *:not(:last-child) - margin-bottom 16px + > *:not(:last-child) + margin-bottom 16px > .left padding-left 16px @@ -355,7 +327,7 @@ export default Vue.extend({ > *:not(main) display none - > main + > .main float none width 100% max-width 700px diff --git a/src/web/app/desktop/views/components/index.ts b/src/web/app/desktop/views/components/index.ts index 151ebf296b..9a27369547 100644 --- a/src/web/app/desktop/views/components/index.ts +++ b/src/web/app/desktop/views/components/index.ts @@ -33,6 +33,7 @@ import driveFolder from './drive-folder.vue'; import driveNavFolder from './drive-nav-folder.vue'; import postDetail from './post-detail.vue'; import settings from './settings.vue'; +import calendar from './calendar.vue'; import wNav from './widgets/nav.vue'; import wCalendar from './widgets/calendar.vue'; import wPhotoStream from './widgets/photo-stream.vue'; @@ -41,6 +42,7 @@ import wTips from './widgets/tips.vue'; import wDonation from './widgets/donation.vue'; import wNotifications from './widgets/notifications.vue'; import wBroadcast from './widgets/broadcast.vue'; +import wTimemachine from './widgets/timemachine.vue'; Vue.component('mk-ui', ui); Vue.component('mk-ui-header', uiHeader); @@ -75,6 +77,7 @@ Vue.component('mk-drive-folder', driveFolder); Vue.component('mk-drive-nav-folder', driveNavFolder); Vue.component('mk-post-detail', postDetail); Vue.component('mk-settings', settings); +Vue.component('mk-calendar', calendar); Vue.component('mkw-nav', wNav); Vue.component('mkw-calendar', wCalendar); Vue.component('mkw-photo-stream', wPhotoStream); @@ -83,3 +86,4 @@ Vue.component('mkw-tips', wTips); Vue.component('mkw-donation', wDonation); Vue.component('mkw-notifications', wNotifications); Vue.component('mkw-broadcast', wBroadcast); +Vue.component('mkw-timemachine', wTimemachine); diff --git a/src/web/app/desktop/views/components/timeline.vue b/src/web/app/desktop/views/components/timeline.vue index 3d792436e0..66d70a9578 100644 --- a/src/web/app/desktop/views/components/timeline.vue +++ b/src/web/app/desktop/views/components/timeline.vue @@ -13,19 +13,14 @@ import Vue from 'vue'; export default Vue.extend({ - props: { - date: { - type: Date, - required: false - } - }, data() { return { fetching: true, moreFetching: false, posts: [], connection: null, - connectionId: null + connectionId: null, + date: null }; }, computed: { @@ -60,7 +55,7 @@ export default Vue.extend({ this.fetching = true; (this as any).api('posts/timeline', { - until_date: this.date ? (this.date as any).getTime() : undefined + until_date: this.date ? this.date.getTime() : undefined }).then(posts => { this.fetching = false; this.posts = posts; @@ -93,6 +88,10 @@ export default Vue.extend({ (this.$refs.timeline as any).focus(); } } + }, + warp(date) { + this.date = date; + this.fetch(); } } }); diff --git a/src/web/app/desktop/views/components/widgets/timemachine.vue b/src/web/app/desktop/views/components/widgets/timemachine.vue new file mode 100644 index 0000000000..d484ce6d74 --- /dev/null +++ b/src/web/app/desktop/views/components/widgets/timemachine.vue @@ -0,0 +1,28 @@ + +