diff --git a/src/config/locales/de/translation.missing.json b/src/config/locales/de/translation.missing.json index 2f7b0c1b..ca2d03ed 100644 --- a/src/config/locales/de/translation.missing.json +++ b/src/config/locales/de/translation.missing.json @@ -16,5 +16,8 @@ "public": "Public Timeline" } } + }, + "search": { + "tag": "Hashtag" } } diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index b89bcd93..7ddb211b 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -289,6 +289,7 @@ "search": { "search": "Search", "account": "Account", + "tag": "Hashtag", "keyword": "keyword" }, "lists": { diff --git a/src/config/locales/fr/translation.missing.json b/src/config/locales/fr/translation.missing.json index 2f7b0c1b..ca2d03ed 100644 --- a/src/config/locales/fr/translation.missing.json +++ b/src/config/locales/fr/translation.missing.json @@ -16,5 +16,8 @@ "public": "Public Timeline" } } + }, + "search": { + "tag": "Hashtag" } } diff --git a/src/config/locales/ja/translation.json b/src/config/locales/ja/translation.json index 64955610..dafc5c1f 100644 --- a/src/config/locales/ja/translation.json +++ b/src/config/locales/ja/translation.json @@ -283,6 +283,7 @@ "search": { "search": "検索", "account": "アカウント", + "tag": "ハッシュタグ", "keyword": "キーワード" }, "lists": { diff --git a/src/config/locales/ko/translation.missing.json b/src/config/locales/ko/translation.missing.json index 2f7b0c1b..ca2d03ed 100644 --- a/src/config/locales/ko/translation.missing.json +++ b/src/config/locales/ko/translation.missing.json @@ -16,5 +16,8 @@ "public": "Public Timeline" } } + }, + "search": { + "tag": "Hashtag" } } diff --git a/src/config/locales/pl/translation.missing.json b/src/config/locales/pl/translation.missing.json index 2f7b0c1b..ca2d03ed 100644 --- a/src/config/locales/pl/translation.missing.json +++ b/src/config/locales/pl/translation.missing.json @@ -16,5 +16,8 @@ "public": "Public Timeline" } } + }, + "search": { + "tag": "Hashtag" } } diff --git a/src/renderer/components/TimelineSpace/Contents/Search.vue b/src/renderer/components/TimelineSpace/Contents/Search.vue index 1e0c1f2c..0e2e4321 100644 --- a/src/renderer/components/TimelineSpace/Contents/Search.vue +++ b/src/renderer/components/TimelineSpace/Contents/Search.vue @@ -15,7 +15,8 @@
- + +
@@ -23,10 +24,11 @@ diff --git a/src/renderer/components/molecules/Tag.vue b/src/renderer/components/molecules/Tag.vue new file mode 100644 index 00000000..5b6570e0 --- /dev/null +++ b/src/renderer/components/molecules/Tag.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/src/renderer/store/TimelineSpace/Contents/Search.js b/src/renderer/store/TimelineSpace/Contents/Search.js index bba46dc8..c6d2a03e 100644 --- a/src/renderer/store/TimelineSpace/Contents/Search.js +++ b/src/renderer/store/TimelineSpace/Contents/Search.js @@ -1,8 +1,9 @@ import Account from './Search/Account' +import Tag from './Search/Tag' const Search = { namespaced: true, - modules: { Account }, + modules: { Account, Tag }, state: { loading: false }, diff --git a/src/renderer/store/TimelineSpace/Contents/Search/Account.js b/src/renderer/store/TimelineSpace/Contents/Search/Account.js index 1be853ce..a63d1750 100644 --- a/src/renderer/store/TimelineSpace/Contents/Search/Account.js +++ b/src/renderer/store/TimelineSpace/Contents/Search/Account.js @@ -20,12 +20,10 @@ const Account = { return client.get('/search', { q: query, resolve: true }) .then(res => { commit('updateResults', res.data.accounts) - commit('TimelineSpace/Contents/Search/changeLoading', false, { root: true }) return res.data }) - .catch(err => { + .finally(() => { commit('TimelineSpace/Contents/Search/changeLoading', false, { root: true }) - throw err }) } } diff --git a/src/renderer/store/TimelineSpace/Contents/Search/Tag.js b/src/renderer/store/TimelineSpace/Contents/Search/Tag.js new file mode 100644 index 00000000..17de64fb --- /dev/null +++ b/src/renderer/store/TimelineSpace/Contents/Search/Tag.js @@ -0,0 +1,30 @@ +import Mastodon from 'megalodon' + +export default { + namespaced: true, + state: { + results: [] + }, + mutations: { + updateResults (state, results) { + state.results = results + } + }, + actions: { + search ({ state, commit, rootState }, query) { + commit('TimelineSpace/Contents/Search/changeLoading', true, { root: true }) + const client = new Mastodon( + rootState.TimelineSpace.account.accessToken, + rootState.TimelineSpace.account.baseURL + '/api/v2' + ) + return client.get('/search', { q: query, resolve: true }) + .then(res => { + commit('updateResults', res.data.hashtags) + return res.data + }) + .finally(() => { + commit('TimelineSpace/Contents/Search/changeLoading', false, { root: true }) + }) + } + } +}