From aea582cf5ef9977f19151e4218bf8c8a0c880979 Mon Sep 17 00:00:00 2001 From: tonyrewin Date: Fri, 25 Nov 2022 08:54:19 +0300 Subject: [PATCH] all-authors-topics-stat-fixes --- src/components/Article/FullArticle.tsx | 8 ++++++-- src/components/Views/AllAuthors.tsx | 13 +++++++++---- src/components/Views/AllTopics.tsx | 7 ++++++- src/components/_shared/StatMetrics.tsx | 23 ++++++++++++----------- src/graphql/query/authors-all.ts | 2 -- src/main.astro | 5 ----- 6 files changed, 33 insertions(+), 25 deletions(-) diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx index ecc3c51b..ffa43924 100644 --- a/src/components/Article/FullArticle.tsx +++ b/src/components/Article/FullArticle.tsx @@ -52,11 +52,15 @@ export const FullArticle = (props: ArticleProps) => { ) onMount(() => { + const script = document.createElement('script') + script.async = true + script.src = 'https://ackee.discours.io/increment.js' + script.setAttribute('data-ackee-server', 'https://ackee.discours.io') + script.setAttribute('data-ackee-domain-id', '1004abeb-89b2-4e85-ad97-74f8d2c8ed2d') + document.body.appendChild(script) const windowHash = window.location.hash - if (windowHash?.length > 0) { const comments = document.querySelector(windowHash) - if (comments) { window.scrollTo({ top: comments.getBoundingClientRect().top, diff --git a/src/components/Views/AllAuthors.tsx b/src/components/Views/AllAuthors.tsx index d9c55653..25fbdcf5 100644 --- a/src/components/Views/AllAuthors.tsx +++ b/src/components/Views/AllAuthors.tsx @@ -29,14 +29,19 @@ export const AllAuthorsView = (props: Props) => { const { searchParams, changeSearchParam } = useRouter() const { sortedAuthors } = useAuthorsStore({ authors: props.authors, - sortBy: searchParams().by || 'shouts' + sortBy: searchParams().by || 'name' }) const { session } = useSession() - onMount(() => changeSearchParam('by', 'shouts')) + onMount(() => { + if (!searchParams().by) { + setAuthorsSort('name') + changeSearchParam('by', 'name') + } + }) createEffect(() => { - setAuthorsSort(searchParams().by || 'shouts') + setAuthorsSort(searchParams().by || 'name') setLimit(PAGE_SIZE) }) @@ -211,7 +216,7 @@ export const AllAuthorsView = (props: Props) => { - limit()}> + limit()}>