From 2d683057239d91465c8cd0534fae1ea53443b76f Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 14 Sep 2018 00:06:18 +0900 Subject: [PATCH 1/4] refs #598 Show tags in side menu --- .../TimelineSpace/Contents/Hashtag/Tag.vue | 3 -- .../components/TimelineSpace/SideMenu.vue | 38 ++++++++++--------- src/renderer/store/TimelineSpace/SideMenu.js | 22 +++++++++-- 3 files changed, 39 insertions(+), 24 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue b/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue index ff41c524..b8e9ef50 100644 --- a/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue +++ b/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue @@ -98,8 +98,6 @@ export default { }, methods: { async load (tag) { - this.$store.commit('TimelineSpace/SideMenu/updateOverrideActivePath', `/${this.$route.params.id}/hashtag`) - await this.$store.dispatch('TimelineSpace/Contents/Hashtag/Tag/fetch', tag) .catch(() => { this.$message({ @@ -117,7 +115,6 @@ export default { return true }, reset () { - this.$store.commit('TimelineSpace/SideMenu/updateOverrideActivePath', null) this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/changeHeading', true) this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/mergeTimeline') this.$store.commit('TimelineSpace/Contents/Hashtag/Tag/archiveTimeline') diff --git a/src/renderer/components/TimelineSpace/SideMenu.vue b/src/renderer/components/TimelineSpace/SideMenu.vue index e2a1a8b8..33e9c786 100644 --- a/src/renderer/components/TimelineSpace/SideMenu.vue +++ b/src/renderer/components/TimelineSpace/SideMenu.vue @@ -61,20 +61,25 @@ {{ $t("side_menu.public") }} - - - {{ $t("side_menu.hashtag") }} - {{ $t("side_menu.search") }} + + + {{ $t("side_menu.hashtag") }} + + {{ $t("side_menu.lists") }} @@ -89,27 +94,26 @@ import { shell } from 'electron' export default { name: 'side-menu', computed: { + ...mapState('TimelineSpace/SideMenu', { + unreadHomeTimeline: state => state.unreadHomeTimeline, + unreadNotifications: state => state.unreadNotifications, + unreadLocalTimeline: state => state.unreadLocalTimeline, + lists: state => state.lists, + tags: state => state.tags, + collapse: state => state.collapse + }), ...mapState({ account: state => state.TimelineSpace.account, - unreadHomeTimeline: state => state.TimelineSpace.SideMenu.unreadHomeTimeline, - unreadNotifications: state => state.TimelineSpace.SideMenu.unreadNotifications, - unreadLocalTimeline: state => state.TimelineSpace.SideMenu.unreadLocalTimeline, - lists: state => state.TimelineSpace.SideMenu.lists, - themeColor: state => state.App.theme.side_menu_color, - overrideActivePath: state => state.TimelineSpace.SideMenu.overrideActivePath, - collapse: state => state.TimelineSpace.SideMenu.collapse + themeColor: state => state.App.theme.side_menu_color }) }, created () { this.$store.dispatch('TimelineSpace/SideMenu/readCollapse') + this.$store.dispatch('TimelineSpace/SideMenu/listTags') }, methods: { activeRoute () { - if (this.overrideActivePath === null) { - return this.$route.path - } else { - return this.overrideActivePath - } + return this.$route.path }, id () { return this.$route.params.id diff --git a/src/renderer/store/TimelineSpace/SideMenu.js b/src/renderer/store/TimelineSpace/SideMenu.js index 0d2d4a8e..85b8ec43 100644 --- a/src/renderer/store/TimelineSpace/SideMenu.js +++ b/src/renderer/store/TimelineSpace/SideMenu.js @@ -8,7 +8,7 @@ const SideMenu = { unreadNotifications: false, unreadLocalTimeline: false, lists: [], - overrideActivePath: null, + tags: [], collapse: false }, mutations: { @@ -24,11 +24,11 @@ const SideMenu = { updateLists (state, lists) { state.lists = lists }, - updateOverrideActivePath (state, path) { - state.overrideActivePath = path - }, changeCollapse (state, collapse) { state.collapse = collapse + }, + updateTags (state, tags) { + state.tags = tags } }, actions: { @@ -58,6 +58,20 @@ const SideMenu = { ipcRenderer.once('response-get-collapse', (event, value) => { commit('changeCollapse', value) }) + }, + listTags ({ commit }) { + return new Promise((resolve, reject) => { + ipcRenderer.once('response-list-hashtags', (event, tags) => { + ipcRenderer.removeAllListeners('error-list-hashtags') + commit('updateTags', tags) + resolve(tags) + }) + ipcRenderer.once('error-list-hashtags', (event, err) => { + ipcRenderer.removeAlListeners('response-list-hashtags') + reject(err) + }) + ipcRenderer.send('list-hashtags') + }) } } } From 82c162142721f2405c40d71820532281a1b7e867 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 14 Sep 2018 00:20:13 +0900 Subject: [PATCH 2/4] refs #598 Add tag timelines to jump menu --- .../components/TimelineSpace/Modals/Jump.vue | 9 ++++----- src/renderer/store/TimelineSpace/Modals/Jump.js | 12 ++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Modals/Jump.vue b/src/renderer/components/TimelineSpace/Modals/Jump.vue index 035db99b..fc2b2c7e 100644 --- a/src/renderer/components/TimelineSpace/Modals/Jump.vue +++ b/src/renderer/components/TimelineSpace/Modals/Jump.vue @@ -31,11 +31,9 @@ import { mapState } from 'vuex' export default { name: 'jump', computed: { - ...mapState({ - channelList: (state) => { - return state.TimelineSpace.Modals.Jump.defaultChannelList.concat(state.TimelineSpace.Modals.Jump.listChannelList) - }, - selectedChannel: state => state.TimelineSpace.Modals.Jump.selectedChannel + ...mapState('TimelineSpace/Modals/Jump', { + channelList: state => state.defaultChannelList.concat(state.tagChannelList).concat(state.listChannelList), + selectedChannel: state => state.selectedChannel }), channel: { get () { @@ -65,6 +63,7 @@ export default { if (!oldModal && newModal) { this.$nextTick(function () { this.$store.dispatch('TimelineSpace/Modals/Jump/syncListChannel') + this.$store.dispatch('TimelineSpace/Modals/Jump/syncTagChannel') this.$refs.channel.focus() }) } else { diff --git a/src/renderer/store/TimelineSpace/Modals/Jump.js b/src/renderer/store/TimelineSpace/Modals/Jump.js index 28740917..ff103a42 100644 --- a/src/renderer/store/TimelineSpace/Modals/Jump.js +++ b/src/renderer/store/TimelineSpace/Modals/Jump.js @@ -37,6 +37,7 @@ const Jump = { } ], listChannelList: [], + tagChannelList: [], selectedChannel: { name: i18n.t('side_menu.home'), path: 'home' @@ -59,6 +60,14 @@ const Jump = { path: `lists/${l.id}` } }) + }, + updateTagChannel (state, tags) { + state.tagChannelList = tags.map(t => { + return { + name: `#${t.tagName}`, + path: `hashtag/${t.tagName}` + } + }) } }, actions: { @@ -72,6 +81,9 @@ const Jump = { }, syncListChannel ({ state, commit, rootState }) { commit('updateListChannel', rootState.TimelineSpace.SideMenu.lists) + }, + syncTagChannel ({ commit, rootState }) { + commit('updateTagChannel', rootState.TimelineSpace.SideMenu.tags) } } } From 2bd429601bc1b85c62097e7d5b1271d53c96c493 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 14 Sep 2018 01:21:07 +0900 Subject: [PATCH 3/4] refs #598 Update tag timeline in side menu when save tag timeline --- src/main/index.js | 3 +++ src/renderer/store/TimelineSpace/Contents/Hashtag.js | 5 ++++- src/renderer/store/TimelineSpace/Contents/Hashtag/List.js | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/index.js b/src/main/index.js index adc6820c..c02ce8d1 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -660,6 +660,9 @@ ipcMain.on('change-language', (event, value) => { ipcMain.on('save-hashtag', (event, tag) => { const hashtags = new Hashtags(hashtagsDB) hashtags.insertTag(tag) + .then(() => { + event.sender.send('response-save-hashtag') + }) .catch((err) => { log.error(err) }) diff --git a/src/renderer/store/TimelineSpace/Contents/Hashtag.js b/src/renderer/store/TimelineSpace/Contents/Hashtag.js index fb625ed0..38831e18 100644 --- a/src/renderer/store/TimelineSpace/Contents/Hashtag.js +++ b/src/renderer/store/TimelineSpace/Contents/Hashtag.js @@ -9,7 +9,10 @@ const Hashtag = { Tag }, actions: { - saveTag (_, tag) { + saveTag ({ dispatch }, tag) { + ipcRenderer.once('response-save-hashtag', (event, _) => { + dispatch('TimelineSpace/SideMenu/listTags', {}, { root: true }) + }) ipcRenderer.send('save-hashtag', tag) } } diff --git a/src/renderer/store/TimelineSpace/Contents/Hashtag/List.js b/src/renderer/store/TimelineSpace/Contents/Hashtag/List.js index 4e6598d8..9de9c16f 100644 --- a/src/renderer/store/TimelineSpace/Contents/Hashtag/List.js +++ b/src/renderer/store/TimelineSpace/Contents/Hashtag/List.js @@ -30,6 +30,7 @@ const List = { ipcRenderer.once('response-remove-hashtag', (event, _) => { ipcRenderer.removeAllListeners('error-remove-hashtag') dispatch('listTags') + dispatch('TimelineSpace/SideMenu/listTags', {}, { root: true }) resolve('deleted') }) ipcRenderer.once('error-remove-hashtag', (event, err) => { From a0b7e297281b13a7664d219685abb86e6ef12c31 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 14 Sep 2018 21:19:28 +0900 Subject: [PATCH 4/4] refs #598 Show title in hashtag --- src/config/locales/de/translation.json | 4 +++- src/config/locales/en/translation.json | 4 +++- src/config/locales/fr/translation.json | 4 +++- src/config/locales/ja/translation.json | 4 +++- src/config/locales/ko/translation.json | 4 +++- src/config/locales/pl/translation.json | 4 +++- src/renderer/components/TimelineSpace/Contents/Hashtag.vue | 2 +- .../components/TimelineSpace/Contents/Hashtag/List.vue | 2 +- 8 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/config/locales/de/translation.json b/src/config/locales/de/translation.json index 898ecd1b..a1e56b68 100644 --- a/src/config/locales/de/translation.json +++ b/src/config/locales/de/translation.json @@ -219,7 +219,9 @@ } }, "hashtag": { - "tag_name": "Tagname" + "tag_name": "Tagname", + "delete_tag": "Delete tag", + "save_tag": "Save tag" }, "search": { "search": "Suche", diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index bcd5c961..c16618f2 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -224,7 +224,9 @@ } }, "hashtag": { - "tag_name": "Tag name" + "tag_name": "Tag name", + "delete_tag": "Delete tag", + "save_tag": "Save tag" }, "search": { "search": "Search", diff --git a/src/config/locales/fr/translation.json b/src/config/locales/fr/translation.json index bbc2d8d7..66cbb06a 100644 --- a/src/config/locales/fr/translation.json +++ b/src/config/locales/fr/translation.json @@ -219,7 +219,9 @@ } }, "hashtag": { - "tag_name": "Nom du hashtag" + "tag_name": "Nom du hashtag", + "delete_tag": "Delete tag", + "save_tag": "Save tag" }, "search": { "search": "Rechercher", diff --git a/src/config/locales/ja/translation.json b/src/config/locales/ja/translation.json index 4fa6134b..500d5039 100644 --- a/src/config/locales/ja/translation.json +++ b/src/config/locales/ja/translation.json @@ -219,7 +219,9 @@ } }, "hashtag": { - "tag_name": "タグ名" + "tag_name": "タグ名", + "delete_tag": "タグを削除", + "save_tag": "タグを保存" }, "search": { "search": "検索", diff --git a/src/config/locales/ko/translation.json b/src/config/locales/ko/translation.json index 04fe5b1f..4e6faf59 100644 --- a/src/config/locales/ko/translation.json +++ b/src/config/locales/ko/translation.json @@ -224,7 +224,9 @@ } }, "hashtag": { - "tag_name": "태그 이름" + "tag_name": "태그 이름", + "delete_tag": "Delete tag", + "save_tag": "Save tag" }, "search": { "search": "검색", diff --git a/src/config/locales/pl/translation.json b/src/config/locales/pl/translation.json index 716eba65..bdad386a 100644 --- a/src/config/locales/pl/translation.json +++ b/src/config/locales/pl/translation.json @@ -219,7 +219,9 @@ } }, "hashtag": { - "tag_name": "Tag" + "tag_name": "Tag", + "delete_tag": "Delete tag", + "save_tag": "Save tag" }, "search": { "search": "Szukaj", diff --git a/src/renderer/components/TimelineSpace/Contents/Hashtag.vue b/src/renderer/components/TimelineSpace/Contents/Hashtag.vue index 3d8bd3ed..b0cecb2c 100644 --- a/src/renderer/components/TimelineSpace/Contents/Hashtag.vue +++ b/src/renderer/components/TimelineSpace/Contents/Hashtag.vue @@ -12,7 +12,7 @@
- +
diff --git a/src/renderer/components/TimelineSpace/Contents/Hashtag/List.vue b/src/renderer/components/TimelineSpace/Contents/Hashtag/List.vue index d8a300b1..041cea60 100644 --- a/src/renderer/components/TimelineSpace/Contents/Hashtag/List.vue +++ b/src/renderer/components/TimelineSpace/Contents/Hashtag/List.vue @@ -7,7 +7,7 @@ {{ tag.tagName }} - +