merged
This commit is contained in:
commit
3e2d7416b7
|
@ -83,6 +83,7 @@
|
||||||
"Comment successfully deleted": "Comment successfully deleted",
|
"Comment successfully deleted": "Comment successfully deleted",
|
||||||
"Commentator": "Commentator",
|
"Commentator": "Commentator",
|
||||||
"Comments": "Comments",
|
"Comments": "Comments",
|
||||||
|
"CommentsWithCount": "{count, plural, =0 {{count} comments} one {{count} comment} few {{count} comments} other {{count} comments}}",
|
||||||
"Communities": "Communities",
|
"Communities": "Communities",
|
||||||
"Community Discussion Rules": "Community Discussion Rules",
|
"Community Discussion Rules": "Community Discussion Rules",
|
||||||
"Community Principles": "Community Principles",
|
"Community Principles": "Community Principles",
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
"Comment": "Комментировать",
|
"Comment": "Комментировать",
|
||||||
"Commentator": "Комментатор",
|
"Commentator": "Комментатор",
|
||||||
"Comments": "Комментарии",
|
"Comments": "Комментарии",
|
||||||
|
"CommentsWithCount": "{count, plural, =0 {{count} комментариев} one {{count} комментарий} few {{count} комментария} other {{count} комментариев}}",
|
||||||
"Communities": "Сообщества",
|
"Communities": "Сообщества",
|
||||||
"Community Discussion Rules": "Правила дискуссий в сообществе",
|
"Community Discussion Rules": "Правила дискуссий в сообществе",
|
||||||
"Community Principles": "Принципы сообщества",
|
"Community Principles": "Принципы сообщества",
|
||||||
|
|
|
@ -30,6 +30,7 @@ type Props = {
|
||||||
showArticleLink?: boolean
|
showArticleLink?: boolean
|
||||||
clickedReply?: (id: number) => void
|
clickedReply?: (id: number) => void
|
||||||
clickedReplyId?: number
|
clickedReplyId?: number
|
||||||
|
onDelete?: (id: number) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Comment = (props: Props) => {
|
export const Comment = (props: Props) => {
|
||||||
|
@ -64,7 +65,10 @@ export const Comment = (props: Props) => {
|
||||||
|
|
||||||
if (isConfirmed) {
|
if (isConfirmed) {
|
||||||
await deleteReaction(props.comment.id)
|
await deleteReaction(props.comment.id)
|
||||||
|
// TODO: Учесть то что deleteReaction может вернуть error
|
||||||
|
if (props.onDelete) {
|
||||||
|
props.onDelete(props.comment.id)
|
||||||
|
}
|
||||||
await showSnackbar({ body: t('Comment successfully deleted') })
|
await showSnackbar({ body: t('Comment successfully deleted') })
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|
|
@ -115,12 +115,15 @@ export const TopicBadge = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class={styles.stats}>
|
<div class={styles.stats}>
|
||||||
<span class={styles.statsItem}>{t('shoutsWithCount', { count: props.topic?.stat?.shouts })}</span>
|
<span class={styles.statsItem}>{t('shoutsWithCount', {count: props.topic?.stat?.shouts})}</span>
|
||||||
<span class={styles.statsItem}>{t('authorsWithCount', { count: props.topic?.stat?.authors })}</span>
|
<span class={styles.statsItem}>{t('authorsWithCount', {count: props.topic?.stat?.authors})}</span>
|
||||||
<span class={styles.statsItem}>
|
<span class={styles.statsItem}>
|
||||||
{t('followersWithCount', { count: props.topic?.stat?.followers })}
|
{t('FollowersWithCount', {count: props.topic?.stat?.followers})}
|
||||||
</span>
|
</span>
|
||||||
|
<Show when={props.topic?.stat?.comments}>
|
||||||
|
<span class={styles.statsItem}>{t('CommentsWithCount', {count: props.topic?.stat?.comments ?? 0})}</span>
|
||||||
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import { capitalize } from '../../../utils/capitalize'
|
||||||
import { dummyFilter } from '../../../utils/dummyFilter'
|
import { dummyFilter } from '../../../utils/dummyFilter'
|
||||||
import { getImageUrl } from '../../../utils/getImageUrl'
|
import { getImageUrl } from '../../../utils/getImageUrl'
|
||||||
import { scrollHandler } from '../../../utils/scroll'
|
import { scrollHandler } from '../../../utils/scroll'
|
||||||
import { TopicCard } from '../../Topic/Card'
|
|
||||||
import { Loading } from '../../_shared/Loading'
|
import { Loading } from '../../_shared/Loading'
|
||||||
import { SearchField } from '../../_shared/SearchField'
|
import { SearchField } from '../../_shared/SearchField'
|
||||||
|
|
||||||
|
|
|
@ -127,9 +127,8 @@ export const AuthorView = (props: Props) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
const a = author()
|
if (author()) {
|
||||||
if (a) {
|
fetchComments(author())
|
||||||
fetchComments(a)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -139,6 +138,9 @@ export const AuthorView = (props: Props) => {
|
||||||
: getImageUrl('production/image/logo_image.png'),
|
: getImageUrl('production/image/logo_image.png'),
|
||||||
)
|
)
|
||||||
const description = createMemo(() => getDescription(author()?.bio))
|
const description = createMemo(() => getDescription(author()?.bio))
|
||||||
|
const handleDeleteComment = (id: number) => {
|
||||||
|
setCommented((prev) => prev.filter((comment) => comment.id !== id))
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={styles.authorPage}>
|
<div class={styles.authorPage}>
|
||||||
|
@ -233,7 +235,14 @@ export const AuthorView = (props: Props) => {
|
||||||
<div class="col-md-20 col-lg-18">
|
<div class="col-md-20 col-lg-18">
|
||||||
<ul class={stylesArticle.comments}>
|
<ul class={stylesArticle.comments}>
|
||||||
<For each={commented()?.sort(byCreated).reverse()}>
|
<For each={commented()?.sort(byCreated).reverse()}>
|
||||||
{(comment) => <Comment comment={comment} class={styles.comment} showArticleLink />}
|
{(comment) => (
|
||||||
|
<Comment
|
||||||
|
comment={comment}
|
||||||
|
class={styles.comment}
|
||||||
|
showArticleLink={true}
|
||||||
|
onDelete={(id) => handleDeleteComment(id)}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</For>
|
</For>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -135,6 +135,7 @@ export const apiClient = {
|
||||||
user?: string
|
user?: string
|
||||||
}): Promise<AuthorFollows> => {
|
}): Promise<AuthorFollows> => {
|
||||||
const response = await publicGraphQLClient.query(authorFollows, params).toPromise()
|
const response = await publicGraphQLClient.query(authorFollows, params).toPromise()
|
||||||
|
console.log('!!! response:', response)
|
||||||
return response.data.get_author_follows
|
return response.data.get_author_follows
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user