diff --git a/src/components/followers_list/followers_list.js b/src/components/follow_list/follow_list.js
similarity index 69%
rename from src/components/followers_list/followers_list.js
rename to src/components/follow_list/follow_list.js
index 13aace18..6d00eb94 100644
--- a/src/components/followers_list/followers_list.js
+++ b/src/components/follow_list/follow_list.js
@@ -1,6 +1,6 @@
import UserCard from '../user_card/user_card.vue'
-const FollowersList = {
+const FollowList = {
data () {
return {
loading: false,
@@ -8,11 +8,11 @@ const FollowersList = {
error: false
}
},
- props: ['userId'],
+ props: ['userId', 'showFollowers'],
created () {
window.addEventListener('scroll', this.scrollLoad)
- if (this.user.followers.length === 0) {
- this.fetchFollowers()
+ if (this.entries.length === 0) {
+ this.fetchEntries()
}
},
destroyed () {
@@ -23,18 +23,19 @@ const FollowersList = {
user () {
return this.$store.getters.userById(this.userId)
},
- followers () {
- return this.user.followers
+ entries () {
+ return this.showFollowers ? this.user.followers : this.user.friends
}
},
methods: {
- fetchFollowers () {
+ fetchEntries () {
if (!this.loading) {
+ const command = this.showFollowers ? 'addFollowers' : 'addFriends'
this.loading = true
- this.$store.dispatch('addFollowers', this.userId).then(followers => {
+ this.$store.dispatch(command, this.userId).then(entries => {
this.error = false
this.loading = false
- this.bottomedOut = followers.length === 0
+ this.bottomedOut = entries.length === 0
}).catch(() => {
this.error = true
this.loading = false
@@ -49,7 +50,7 @@ const FollowersList = {
this.$el.offsetHeight > 0 &&
(window.innerHeight + window.pageYOffset) >= (height - 750)
) {
- this.fetchFollowers()
+ this.fetchEntries()
}
}
},
@@ -58,4 +59,4 @@ const FollowersList = {
}
}
-export default FollowersList
+export default FollowList
diff --git a/src/components/follow_list/follow_list.vue b/src/components/follow_list/follow_list.vue
new file mode 100644
index 00000000..24ab97d8
--- /dev/null
+++ b/src/components/follow_list/follow_list.vue
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/components/followers_list/followers_list.vue b/src/components/followers_list/followers_list.vue
deleted file mode 100644
index b6bd35e1..00000000
--- a/src/components/followers_list/followers_list.vue
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/components/friends_list/friends_list.js b/src/components/friends_list/friends_list.js
deleted file mode 100644
index d5c1837a..00000000
--- a/src/components/friends_list/friends_list.js
+++ /dev/null
@@ -1,61 +0,0 @@
-import UserCard from '../user_card/user_card.vue'
-
-const FriendsList = {
- data () {
- return {
- loading: false,
- bottomedOut: false,
- error: false
- }
- },
- props: ['userId'],
- created () {
- window.addEventListener('scroll', this.scrollLoad)
- if (this.user.followers.length === 0) {
- this.fetchFriends()
- }
- },
- destroyed () {
- window.removeEventListener('scroll', this.scrollLoad)
- this.$store.dispatch('clearFriendsAndFollowers', this.userId)
- },
- computed: {
- user () {
- return this.$store.getters.userById(this.userId)
- },
- friends () {
- return this.user.friends
- }
- },
- methods: {
- fetchFriends () {
- if (!this.loading) {
- this.loading = true
- this.$store.dispatch('addFriends', this.userId).then(friends => {
- this.error = false
- this.loading = false
- this.bottomedOut = friends.length === 0
- }).catch(() => {
- this.error = true
- this.loading = false
- })
- }
- },
- scrollLoad (e) {
- const bodyBRect = document.body.getBoundingClientRect()
- const height = Math.max(bodyBRect.height, -(bodyBRect.y))
- if (this.loading === false &&
- this.bottomedOut === false &&
- this.$el.offsetHeight > 0 &&
- (window.innerHeight + window.pageYOffset) >= (height - 750)
- ) {
- this.fetchFriends()
- }
- }
- },
- components: {
- UserCard
- }
-}
-
-export default FriendsList
diff --git a/src/components/friends_list/friends_list.vue b/src/components/friends_list/friends_list.vue
deleted file mode 100644
index 75657cc8..00000000
--- a/src/components/friends_list/friends_list.vue
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js
index 0361d253..7b0ab705 100644
--- a/src/components/user_profile/user_profile.js
+++ b/src/components/user_profile/user_profile.js
@@ -1,8 +1,7 @@
import UserCardContent from '../user_card_content/user_card_content.vue'
import UserCard from '../user_card/user_card.vue'
import Timeline from '../timeline/timeline.vue'
-import FriendsList from '../friends_list/friends_list.vue'
-import FollowersList from '../followers_list/followers_list.vue'
+import FollowList from '../follow_list/follow_list.vue'
const UserProfile = {
created () {
@@ -102,8 +101,7 @@ const UserProfile = {
UserCardContent,
UserCard,
Timeline,
- FriendsList,
- FollowersList
+ FollowList
}
}
diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue
index c431c729..6d5b00d1 100644
--- a/src/components/user_profile/user_profile.vue
+++ b/src/components/user_profile/user_profile.vue
@@ -16,13 +16,13 @@
:user-id="fetchBy"
/>
-
+
diff --git a/src/i18n/en.json b/src/i18n/en.json
index d3b0e407..dc10fa7f 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -17,7 +17,9 @@
},
"general": {
"apply": "Apply",
- "submit": "Submit"
+ "submit": "Submit",
+ "more": "More",
+ "generic_error": "An error occured"
},
"login": {
"login": "Log in",
@@ -365,9 +367,9 @@
},
"upload":{
"error": {
- "base": "Upload failed.",
- "file_too_big": "File too big [{filesize}{filesizeunit} / {allowedsize}{allowedsizeunit}]",
- "default": "Try again later"
+ "base": "Upload failed.",
+ "file_too_big": "File too big [{filesize}{filesizeunit} / {allowedsize}{allowedsizeunit}]",
+ "default": "Try again later"
},
"file_size_units": {
"B": "B",
diff --git a/src/i18n/fi.json b/src/i18n/fi.json
index 0d62f295..5a0c1ea8 100644
--- a/src/i18n/fi.json
+++ b/src/i18n/fi.json
@@ -17,7 +17,9 @@
},
"general": {
"apply": "Aseta",
- "submit": "Lähetä"
+ "submit": "Lähetä",
+ "more": "Lisää",
+ "generic_error": "Virhe tapahtui"
},
"login": {
"login": "Kirjaudu sisään",