Merge pull request #266 from Discours/feature/notifications3

notifications fixes
This commit is contained in:
Kosta 2023-10-16 22:54:36 +03:00 committed by GitHub
commit fbe9cbe794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -225,7 +225,7 @@
"NotificationNewCommentText2": "от",
"NotificationNewCommentText3": "{restUsersCount, plural, =0 {} one { и ещё 1 пользователя} few { и ещё {restUsersCount} пользователей} other { и ещё {restUsersCount} пользователей}}",
"NotificationNewReplyText1": "{commentsCount, plural, one {Новый ответ} few {{commentsCount} новых ответа} other {{commentsCount} новых ответов}} к вашему комментарию к публикации",
"NotificationNewReplyText1": "{commentsCount, plural, one {Новый ответ} few {{commentsCount} новых ответа} other {{commentsCount} новых ответов}} на ваш комментарий к публикации",
"NotificationNewReplyText2": "от",
"NotificationNewReplyText3": "{restUsersCount, plural, =0 {} one { и ещё 1 пользователя} few { и ещё {restUsersCount} пользователей} other { и ещё {restUsersCount} пользователей}}",

View File

@ -39,8 +39,10 @@ export type ArticlePageSearchParams = {
}
const scrollTo = (el: HTMLElement) => {
const { top } = el.getBoundingClientRect()
window.scrollTo({
top: el.offsetTop - 96,
top: top + window.scrollY - 96,
left: 0,
behavior: 'smooth'
})
@ -90,7 +92,9 @@ export const FullArticle = (props: Props) => {
return JSON.parse(props.article.media || '[]')
})
const commentsRef: { current: HTMLDivElement } = { current: null }
const commentsRef: {
current: HTMLDivElement
} = { current: null }
const scrollToComments = () => {
scrollTo(commentsRef.current)
@ -118,7 +122,9 @@ export const FullArticle = (props: Props) => {
const commentElement = document.querySelector<HTMLElement>(
`[id='comment_${searchParams().commentId}']`
)
changeSearchParam({ commentId: null })
if (commentElement) {
scrollTo(commentElement)
}