Comment fixies (#256)
This commit is contained in:
parent
d2c6f94c33
commit
c9febc75ea
|
@ -36,8 +36,9 @@ type Props = {
|
|||
export const Comment = (props: Props) => {
|
||||
const { t } = useLocalize()
|
||||
const [isReplyVisible, setIsReplyVisible] = createSignal(false)
|
||||
const [loading, setLoading] = createSignal<boolean>(false)
|
||||
const [editMode, setEditMode] = createSignal<boolean>(false)
|
||||
const [loading, setLoading] = createSignal(false)
|
||||
const [editMode, setEditMode] = createSignal(false)
|
||||
const [clearEditor, setClearEditor] = createSignal(false)
|
||||
const { session } = useSession()
|
||||
|
||||
const {
|
||||
|
@ -81,11 +82,13 @@ export const Comment = (props: Props) => {
|
|||
body: value,
|
||||
shout: props.comment.shout.id
|
||||
})
|
||||
setClearEditor(true)
|
||||
setIsReplyVisible(false)
|
||||
setLoading(false)
|
||||
} catch (error) {
|
||||
console.error('[handleCreate reaction]:', error)
|
||||
}
|
||||
setClearEditor(false)
|
||||
}
|
||||
|
||||
const toggleEditMode = () => {
|
||||
|
@ -175,11 +178,13 @@ export const Comment = (props: Props) => {
|
|||
<SimplifiedEditor
|
||||
initialContent={comment().body}
|
||||
submitButtonText={t('Save')}
|
||||
submitByEnter={true}
|
||||
quoteEnabled={true}
|
||||
imageEnabled={true}
|
||||
placeholder={t('Write a comment...')}
|
||||
onSubmit={(value) => handleUpdate(value)}
|
||||
submitByShiftEnter={true}
|
||||
setClear={clearEditor()}
|
||||
/>
|
||||
</Suspense>
|
||||
</Show>
|
||||
|
|
|
@ -33,7 +33,7 @@ const sortCommentsByRating = (a: Reaction, b: Reaction): -1 | 0 | 1 => {
|
|||
}
|
||||
|
||||
type Props = {
|
||||
commentAuthors: Author[]
|
||||
articleAuthors: Author[]
|
||||
shoutSlug: string
|
||||
shoutId: number
|
||||
}
|
||||
|
@ -149,7 +149,9 @@ export const CommentsTree = (props: Props) => {
|
|||
{(reaction) => (
|
||||
<Comment
|
||||
sortedComments={sortedComments()}
|
||||
isArticleAuthor={Boolean(props.commentAuthors.some((a) => a.slug === session()?.user.slug))}
|
||||
isArticleAuthor={Boolean(
|
||||
props.articleAuthors.some((a) => a.slug === reaction.createdBy.slug)
|
||||
)}
|
||||
comment={reaction}
|
||||
lastSeen={dateFromLocalStorage}
|
||||
/>
|
||||
|
|
|
@ -431,7 +431,7 @@ export const FullArticle = (props: Props) => {
|
|||
<CommentsTree
|
||||
shoutId={props.article.id}
|
||||
shoutSlug={props.article.slug}
|
||||
commentAuthors={props.article.authors}
|
||||
articleAuthors={props.article.authors}
|
||||
/>
|
||||
</Show>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user