Cleaning up backend, bugfix in frontend

This commit is contained in:
Moriz Wahl 2019-12-10 12:34:12 +01:00
parent 72e4d0abbc
commit bdbabc2d12
4 changed files with 115 additions and 112 deletions

View File

@ -48,7 +48,7 @@ export default {
}, },
findPosts: async (object, params, context, resolveInfo) => { findPosts: async (object, params, context, resolveInfo) => {
params = await filterForBlockedUsers(params, context) params = await filterForBlockedUsers(params, context)
return neo4jgraphql(object, params, context, resolveInfo, true) return neo4jgraphql(object, params, context, resolveInfo)
}, },
profilePagePosts: async (object, params, context, resolveInfo) => { profilePagePosts: async (object, params, context, resolveInfo) => {
params = await filterForBlockedUsers(params, context) params = await filterForBlockedUsers(params, context)

View File

@ -226,8 +226,6 @@ type Query {
PostsEmotionsCountByEmotion(postId: ID!, data: _EMOTEDInput!): Int! PostsEmotionsCountByEmotion(postId: ID!, data: _EMOTEDInput!): Int!
PostsEmotionsByCurrentUser(postId: ID!): [String] PostsEmotionsByCurrentUser(postId: ID!): [String]
profilePagePosts(filter: _PostFilter, first: Int, offset: Int, orderBy: [_PostOrdering]): [Post] profilePagePosts(filter: _PostFilter, first: Int, offset: Int, orderBy: [_PostOrdering]): [Post]
isLoggedIn: Boolean!
currentUser: User
findPosts(query: String!, limit: Int = 10, filter: _PostFilter): [Post]! findPosts(query: String!, limit: Int = 10, filter: _PostFilter): [Post]!
@cypher( @cypher(
statement: """ statement: """

View File

@ -161,6 +161,7 @@ type Query {
): [User] ): [User]
blockedUsers: [User] blockedUsers: [User]
isLoggedIn: Boolean!
currentUser: User currentUser: User
findUsers(query: String!,limit: Int = 10, filter: _UserFilter): [User]! findUsers(query: String!,limit: Int = 10, filter: _UserFilter): [User]!
@cypher( @cypher(

View File

@ -44,8 +44,8 @@
</ds-heading> </ds-heading>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
<ds-flex v-else-if="option.__typename === 'User'"> <ds-flex v-if="option.__typename === 'User'">
<ds-flex-item class="search-option"> <ds-flex-item class="search-option" :class="{'extra-space': isFirstOfType(option)}">
<ds-avatar class="avatar" name="option.name" image="option.avatar" /> <ds-avatar class="avatar" name="option.name" image="option.avatar" />
<div> <div>
<ds-text class="userinfo"> <ds-text class="userinfo">
@ -57,7 +57,7 @@
</ds-text> </ds-text>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
<ds-flex v-else> <ds-flex v-if="option.__typename === 'Post'">
<ds-flex-item class="search-option-label"> <ds-flex-item class="search-option-label">
<ds-text>{{ option.title | truncate(70) }}</ds-text> <ds-text>{{ option.title | truncate(70) }}</ds-text>
</ds-flex-item> </ds-flex-item>
@ -136,11 +136,11 @@ export default {
}, },
}, },
methods: { methods: {
async query(value) { async query(value) {
if (isEmpty(value) || value.length < 3) { if (isEmpty(value) || value.length < 3) {
this.clear() this.clear()
return return
} }
this.$emit('search', value) this.$emit('search', value)
}, },
handleInput(e) { handleInput(e) {
@ -211,105 +211,109 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.search { .search {
display: flex; display: flex;
align-self: center; align-self: center;
width: 100%; width: 100%;
position: relative; position: relative;
$padding-left: $space-x-small; $padding-left: $space-x-small;
.search-option-label { .search-option-label {
align-self: center; align-self: center;
padding-left: $padding-left; padding-left: $padding-left;
} }
.search-option-meta { .search-option-meta {
align-self: center; align-self: center;
.ds-flex { .ds-flex {
flex-direction: column; flex-direction: column;
} }
} }
&, &,
.ds-select-dropdown { .ds-select-dropdown {
transition: box-shadow 100ms; transition: box-shadow 100ms;
max-height: 70vh; max-height: 70vh;
} }
&.is-open { &.is-open {
.ds-select-dropdown { .ds-select-dropdown {
box-shadow: $box-shadow-x-large; box-shadow: $box-shadow-x-large;
} }
} }
.ds-select-dropdown-message { .ds-select-dropdown-message {
opacity: 0.5; opacity: 0.5;
padding-left: $padding-left; padding-left: $padding-left;
} }
.search-clear-btn { .search-clear-btn {
right: 0; right: 0;
z-index: 10; z-index: 10;
position: absolute; position: absolute;
height: 100%; height: 100%;
width: 36px; width: 36px;
cursor: pointer; cursor: pointer;
} }
.search-meta { .search-meta {
float: right; float: right;
padding-top: 2px; padding-top: 2px;
white-space: nowrap; white-space: nowrap;
word-wrap: none; word-wrap: none;
.base-icon { .base-icon {
vertical-align: sub; vertical-align: sub;
} }
} }
.ds-select { .ds-select {
z-index: $z-index-dropdown + 1; z-index: $z-index-dropdown + 1;
} }
.ds-select-option-hover { .ds-select-option-hover {
.ds-text-size-small, .ds-text-size-small,
.ds-text-size-small-x { .ds-text-size-small-x {
color: $text-color-soft; color: $text-color-soft;
} }
} }
.field { .field {
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.control { .control {
width: 100%; width: 100%;
} }
.search-option-heading { .search-option-heading {
font-weight: bold; font-weight: bold;
cursor: default; cursor: default;
background-color: white; background-color: white;
margin: -8px; margin: -8px;
padding: 8px; padding: 8px;
} }
.avatar { .avatar {
display: inline-block; display: inline-block;
float: left; float: left;
margin-right: 4px; margin-right: 4px;
height: 100%; height: 100%;
vertical-align: middle; vertical-align: middle;
} }
.userinfo { .userinfo {
display: flex; display: flex;
align-items: center; align-items: center;
> .ds-text { > .ds-text {
display: flex; display: flex;
align-items: center; align-items: center;
margin-left: $space-xx-small; margin-left: $space-xx-small;
} }
} }
.user { .user {
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
display: flex; display: flex;
align-items: center; align-items: center;
&:hover, &:hover,
&.active { &.active {
z-index: 999; z-index: 999;
} }
} }
.username { .username {
color: #17b53f; color: #17b53f;
} }
} .extra-space {
margin-top: 8px;
padding-top: 4px;
}
}
</style> </style>