Merge pull request #1474 from Human-Connection/cursor-fixes

Cursor fixes
This commit is contained in:
Robert Schäfer 2019-09-04 23:20:57 +02:00 committed by GitHub
commit 8d2ea9c4c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 139 deletions

View File

@ -6,9 +6,9 @@
<ds-flex class="main-navigation-flex" centered>
<ds-flex-item :width="{ lg: '3.5%' }" />
<ds-flex-item :width="{ base: '80%', sm: '80%', md: '80%', lg: '15%' }">
<a @click="redirectToRoot">
<nuxt-link :to="{ name: 'index' }">
<ds-logo />
</a>
</nuxt-link>
</ds-flex-item>
<ds-flex-item
:width="{ base: '20%', sm: '20%', md: '20%', lg: '0%' }"
@ -147,7 +147,7 @@
</template>
<script>
import { mapGetters, mapActions, mapMutations } from 'vuex'
import { mapGetters, mapActions } from 'vuex'
import LocaleSwitch from '~/components/LocaleSwitch/LocaleSwitch'
import SearchInput from '~/components/SearchInput.vue'
import Modal from '~/components/Modal'
@ -183,8 +183,6 @@ export default {
isAdmin: 'auth/isAdmin',
quickSearchResults: 'search/quickResults',
quickSearchPending: 'search/quickPending',
usersFollowedFilter: 'posts/usersFollowedFilter',
categoriesFilter: 'posts/categoriesFilter',
}),
userName() {
const { name } = this.user || {}
@ -236,10 +234,6 @@ export default {
...mapActions({
quickSearchClear: 'search/quickClear',
quickSearch: 'search/quickSearch',
fetchPosts: 'posts/fetchPosts',
}),
...mapMutations({
setFilteredByFollowers: 'posts/SET_FILTERED_BY_FOLLOWERS',
}),
goToPost(item) {
this.$nextTick(() => {
@ -259,17 +253,6 @@ export default {
toggleMobileMenuView() {
this.toggleMobileMenu = !this.toggleMobileMenu
},
redirectToRoot() {
this.$router.replace('/')
this.fetchPosts({
i18n: this.$i18n,
filter: {
...this.usersFollowedFilter,
...this.categoriesFilter,
...this.filter,
},
})
},
},
apollo: {
Category: {

View File

@ -178,6 +178,7 @@ export default {
.post-card {
margin: auto;
cursor: auto;
.comments {
margin-top: $space-small;

View File

@ -1,119 +0,0 @@
import gql from 'graphql-tag'
export const state = () => {
return {
posts: [],
filteredByUsersFollowed: false,
filteredByCategories: false,
usersFollowedFilter: {},
categoriesFilter: {},
selectedCategoryIds: [],
}
}
export const mutations = {
SET_POSTS(state, posts) {
state.posts = posts || null
},
SET_FILTERED_BY_FOLLOWERS(state, boolean) {
state.filteredByUsersFollowed = boolean || null
},
SET_FILTERED_BY_CATEGORIES(state, boolean) {
state.filteredByCategories = boolean || null
},
SET_USERS_FOLLOWED_FILTER(state, filter) {
state.usersFollowedFilter = filter || null
},
SET_CATEGORIES_FILTER(state, filter) {
state.categoriesFilter = filter || null
},
SET_SELECTED_CATEGORY_IDS(state, categoryId) {
if (!categoryId) {
state.selectedCategoryIds = []
} else {
const index = state.selectedCategoryIds.indexOf(categoryId)
if (index > -1) {
state.selectedCategoryIds.splice(index, 1)
} else {
state.selectedCategoryIds.push(categoryId)
}
}
},
}
export const getters = {
posts(state) {
return state.posts || []
},
filteredByUsersFollowed(state) {
return state.filteredByUsersFollowed || false
},
filteredByCategories(state) {
return state.filteredByCategories || false
},
usersFollowedFilter(state) {
return state.usersFollowedFilter || {}
},
categoriesFilter(state) {
return state.categoriesFilter || {}
},
selectedCategoryIds(state) {
return state.selectedCategoryIds || []
},
}
export const actions = {
async fetchPosts({ commit, dispatch }, { i18n, filter }) {
const client = this.app.apolloProvider.defaultClient
const {
data: { Post },
} = await client.query({
query: gql`
query Post($filter: _PostFilter, $first: Int, $offset: Int) {
Post(filter: $filter, first: $first, offset: $offset) {
id
title
contentExcerpt
createdAt
disabled
deleted
slug
image
author {
id
avatar
slug
name
disabled
deleted
contributionsCount
shoutedCount
commentedCount
followedByCount
followedByCurrentUser
location {
name: name${i18n.locale().toUpperCase()}
}
badges {
id
icon
}
}
categories {
id
name
icon
}
shoutedCount
}
}`,
variables: {
filter,
first: 12,
offset: 0,
},
})
commit('SET_POSTS', Post)
return Post
},
}