From 1cec2b696952ef2c472219329961bc102ed315df Mon Sep 17 00:00:00 2001
From: taehoon
Date: Wed, 3 Apr 2019 22:17:42 -0400
Subject: [PATCH] use reusable List vue component instead of withList hoc
Using slot is the preferred way in vue
---
src/components/list/list.vue | 28 +++++++++++++++++++
src/components/user_settings/user_settings.js | 27 ++++++++----------
.../user_settings/user_settings.vue | 14 +++++++---
3 files changed, 49 insertions(+), 20 deletions(-)
create mode 100644 src/components/list/list.vue
diff --git a/src/components/list/list.vue b/src/components/list/list.vue
new file mode 100644
index 00000000..f361e3b1
--- /dev/null
+++ b/src/components/list/list.vue
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js
index dd931e67..057d1cec 100644
--- a/src/components/user_settings/user_settings.js
+++ b/src/components/user_settings/user_settings.js
@@ -10,29 +10,24 @@ import ScopeSelector from '../scope_selector/scope_selector.vue'
import fileSizeFormatService from '../../services/file_size_format/file_size_format.js'
import BlockCard from '../block_card/block_card.vue'
import MuteCard from '../mute_card/mute_card.vue'
+import List from '../list/list.vue'
import EmojiInput from '../emoji-input/emoji-input.vue'
import Autosuggest from '../autosuggest/autosuggest.vue'
import withSubscription from '../../hocs/with_subscription/with_subscription'
import withList from '../../hocs/with_list/with_list'
import userSearchApi from '../../services/new_api/user_search.js'
-const BlockList = compose(
- withSubscription({
- fetch: (props, $store) => $store.dispatch('fetchBlocks'),
- select: (props, $store) => get($store.state.users.currentUser, 'blockIds', []),
- childPropName: 'entries'
- }),
- withList({ getEntryProps: userId => ({ userId }) })
-)(BlockCard)
+const BlockList = withSubscription({
+ fetch: (props, $store) => $store.dispatch('fetchBlocks'),
+ select: (props, $store) => get($store.state.users.currentUser, 'blockIds', []),
+ childPropName: 'items'
+})(List)
-const MuteList = compose(
- withSubscription({
- fetch: (props, $store) => $store.dispatch('fetchMutes'),
- select: (props, $store) => get($store.state.users.currentUser, 'muteIds', []),
- childPropName: 'entries'
- }),
- withList({ getEntryProps: userId => ({ userId }) })
-)(MuteCard)
+const MuteList = withSubscription({
+ fetch: (props, $store) => $store.dispatch('fetchMutes'),
+ select: (props, $store) => get($store.state.users.currentUser, 'muteIds', []),
+ childPropName: 'items'
+})(List)
const UserSettings = {
data () {
diff --git a/src/components/user_settings/user_settings.vue b/src/components/user_settings/user_settings.vue
index 9d37ffc4..741fbe3f 100644
--- a/src/components/user_settings/user_settings.vue
+++ b/src/components/user_settings/user_settings.vue
@@ -200,9 +200,12 @@
-
+
+
+
+
{{$t('settings.no_blocks')}}
-
+
@@ -211,9 +214,12 @@
-
+
+
+
+
{{$t('settings.no_mutes')}}
-
+