Skip to content

Commit

Permalink
chore(): merge remote
Browse files Browse the repository at this point in the history
  • Loading branch information
sterlingrules committed Feb 14, 2020
2 parents 12d71ed + fdcfaf0 commit fdb9e3f
Show file tree
Hide file tree
Showing 27 changed files with 163 additions and 401 deletions.
2 changes: 0 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
<body>
<div id="app"></div>
<!-- built files will be auto injected -->

<script> window.prerenderReady = false; </script>
<script src="https://js.stripe.com/v3/"></script>
<script src="https://www.google.com/recaptcha/api.js?onload=vueRecaptchaApiLoaded&render=explicit" async defer></script>
<script>
Expand Down
7 changes: 3 additions & 4 deletions src/components/Highlightable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@
<comment-highlight
:forumThreadId="forumThreadId"
:highlight="selectedText"
:autoFocus="isHighlighting"
:autoFocus="true"
:onSubmit="resetTools" />
</div>
<div class="tools-comment-reply">
<comment-reply
v-if="isLoggedIn"
:entityId="entityId"
:doneCallback="resetTools"
:highlight="selectedText"
Expand Down Expand Up @@ -154,7 +153,7 @@ export default {
const parentWidth = this.$el.offsetWidth
const toolsWidth = this.$refs.tools.offsetWidth
const toolsCenter = toolsWidth / 2
const arrowOffset = 7
const arrowOffset = 6
if ((this.isHighlighting || this.isReplying) && window.innerWidth > 990) {
return this.arrowX = arrowOffset * -1
Expand Down Expand Up @@ -249,7 +248,7 @@ export default {
this.selectedWidth = width
},
onReply (action) {
onReply () {
this.isReplying = true
},
Expand Down
1 change: 0 additions & 1 deletion src/components/HomeSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
</div>
</template>


<script>
import FeedList from '@/components/feed/FeedList'
import { mapState, mapActions, mapGetters } from 'vuex'
Expand Down
4 changes: 2 additions & 2 deletions src/components/SwitchToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default {
height: 34px;
}
.switch input {
.switch input {
opacity: 0;
width: 0;
height: 0;
Expand Down Expand Up @@ -72,4 +72,4 @@ input:checked + .slider:before {
border-radius: 50%;
}
</style>
</style>
33 changes: 10 additions & 23 deletions src/components/comment/CommentBox.vue
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<template>
<div class="comment-box">
<svg class="comment-chevron" viewBox="0 0 320 512" data-ember-extension="1"><path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg>
<svg class="comment-chevron" viewBox="0 0 320 512" data-ember-extension="1">
<path fill="currentColor" d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/>
</svg>
<div class="title">
{{commentCount}} {{commentCount == 1 ? 'comment' : 'comments'}}
</div>
<div class="title" v-if="!post.thread">
0 comments
</div>
<div
v-if="isLoggedIn">
<br/>
<div v-if="isLoggedIn && !filter">
<comment-compose
:initialComment="initialComment"
:entityId="forumThreadId"
:rootEntityType='"forumthread"' />
</div>
<div v-else class="guest-message">
<div v-else-if="!isLoggedIn" class="guest-message">
<p>Please <router-link to="/login">log in</router-link> to leave a comment</p>
</div>
<div class="row comments">
Expand Down Expand Up @@ -50,7 +50,11 @@ export default {
},
comments: {
type: Array
}
},
commentCount: {
type: Number,
default: 0,
},
},
components: {
Expand All @@ -60,23 +64,6 @@ export default {
computed: {
...mapGetters([ 'isLoggedIn' ]),
commentCount () {
if (!this.comments || !isArray(this.comments)) {
return 0
}
let comments = this.comments.filter(c => (this.filter) ? !!(c[this.filter]) : !(c.highlight))
let commentCount = comments.length
comments.forEach(c => {
commentCount += (c.replies || [])
.filter(c => !c.deleted)
.length
})
return commentCount
}
},
}
</script>
Expand Down
5 changes: 0 additions & 5 deletions src/components/comment/CommentCompose.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

<template>
<comment-form
:autoFocus="autoFocus"
:highlight="highlight"
:isSubmitting="isSubmitting"
:initialComment="initialComment"
Expand Down Expand Up @@ -30,10 +29,6 @@ export default {
highlight: {
type: String,
},
autoFocus: {
type: Boolean,
default: false,
},
onSubmit: {
type: Function,
},
Expand Down
17 changes: 4 additions & 13 deletions src/components/comment/CommentForm.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<template>
<div v-if="me" class="comment-container">
<!-- <span class="active-without-border" v-if="isLoggedIn">
Expand Down Expand Up @@ -90,10 +89,6 @@ export default {
type: String,
default: "Submit"
},
autoFocus: {
type: Boolean,
default: false,
},
},
components: {
CommentTribute,
Expand Down Expand Up @@ -121,25 +116,21 @@ export default {
errorImg: ''
};
},
mounted() {
console.log('this.autoFocus ', this.autoFocus)
// this.$refs.content.focus()
if (this.autoFocus) {
this.focusTextarea()
}
},
watch: {
commentContent: function() {
// Check mentions
if(this.isLoggedIn){
if (this.isLoggedIn) {
const currentMentions = [];
each(this.mentionedUsers, user => {
const mentionText = "@" + user.name;
if (this.commentContent.indexOf(mentionText) >= 0) {
currentMentions.push(user);
}
});
this.mentionedUsers = currentMentions;
} else {
this.$toasted.error('You must login to post a comment')
Expand Down
5 changes: 0 additions & 5 deletions src/components/comment/CommentHighlight.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<div class="comment-compose">
<comment-compose
:highlight="highlight"
:autoFocus="autoFocus"
:entityId="forumThreadId"
:rootEntityType='"forumthread"'
:onSubmit="onSubmit" />
Expand Down Expand Up @@ -42,10 +41,6 @@ export default {
onSubmit: {
type: Function,
},
autoFocus: {
type: Boolean,
default: false,
},
},
components: {
CommentCompose,
Expand Down
67 changes: 38 additions & 29 deletions src/components/comment/CommentReply.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
<template>
<div
v-if="me"
:class="{ 'is-highlight': !!(highlight) }">
<comment-quote :highlight="highlight" />
<div class='reply-container'>
<comment-form
:isSubmitting="isSubmitting"
:content="commentContent"
:submitCallback="submitCallback"
:cancelPressed="doneCallback"
:existingMentions="existingMentions"
:showCancel="true"
:submitButtonText="'Reply'" />
<div>
<div
v-if="me && isLoggedIn"
:class="{ 'is-highlight': !!(highlight) }">
<comment-quote :highlight="highlight" />
<div class='reply-container'>
<comment-form
:isSubmitting="isSubmitting"
:content="commentContent"
:submitCallback="submitCallback"
:cancelPressed="doneCallback"
:existingMentions="existingMentions"
:showCancel="true"
:submitButtonText="'Reply'" />
</div>
</div>
<div v-else class="guest-message">
<p>Please <router-link to="/login">log in</router-link> to leave a reply</p>
</div>
</div>
</template>

<script>
import CommentForm from '@/components/comment/CommentForm'
import CommentQuote from '@/components/comment/CommentQuote'
import { mapState, mapActions } from 'vuex'
import { mapState, mapActions, mapGetters } from 'vuex'
export default {
name: 'comment-reply',
Expand Down Expand Up @@ -66,6 +71,8 @@ export default {
},
computed: {
...mapGetters([ 'isLoggedIn' ]),
// local computed methods +
...mapState({
me (state) {
Expand All @@ -78,6 +85,7 @@ export default {
...mapActions(['commentsCreate', 'commentsFetch']),
submitCallback ({ content, mentions }) {
this.isSubmitting = true
// First update then change back to empty to clear: this.commentContent = content
this.commentContent = content
this.commentsCreate({
Expand All @@ -87,23 +95,24 @@ export default {
parentCommentId: this.parentCommentId,
content
})
.then((response) => {
this.isSubmitting = false
this.commentContent = ''
this.commentsFetch({
entityId: this.entityId
})
this.doneCallback()
.then((response) => {
this.isSubmitting = false
this.commentContent = ''
this.commentsFetch({
entityId: this.entityId
})
.catch((error) => {
this.$toasted.error(error.response.data.message, {
singleton: true,
theme: "bubble",
position: "bottom-center",
duration : 700
})
this.doneCallback()
})
.catch((error) => {
this.$toasted.error(error.response.data.message, {
singleton: true,
theme: "bubble",
position: "bottom-center",
duration : 700
})
} }
})
}
}
}
</script>

Expand Down

0 comments on commit fdb9e3f

Please sign in to comment.