all-authors-topics-stat-fixes
This commit is contained in:
parent
451602beb5
commit
aea582cf5e
|
@ -52,11 +52,15 @@ export const FullArticle = (props: ArticleProps) => {
|
||||||
)
|
)
|
||||||
|
|
||||||
onMount(() => {
|
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
|
const windowHash = window.location.hash
|
||||||
|
|
||||||
if (windowHash?.length > 0) {
|
if (windowHash?.length > 0) {
|
||||||
const comments = document.querySelector(windowHash)
|
const comments = document.querySelector(windowHash)
|
||||||
|
|
||||||
if (comments) {
|
if (comments) {
|
||||||
window.scrollTo({
|
window.scrollTo({
|
||||||
top: comments.getBoundingClientRect().top,
|
top: comments.getBoundingClientRect().top,
|
||||||
|
|
|
@ -29,14 +29,19 @@ export const AllAuthorsView = (props: Props) => {
|
||||||
const { searchParams, changeSearchParam } = useRouter<AllAuthorsPageSearchParams>()
|
const { searchParams, changeSearchParam } = useRouter<AllAuthorsPageSearchParams>()
|
||||||
const { sortedAuthors } = useAuthorsStore({
|
const { sortedAuthors } = useAuthorsStore({
|
||||||
authors: props.authors,
|
authors: props.authors,
|
||||||
sortBy: searchParams().by || 'shouts'
|
sortBy: searchParams().by || 'name'
|
||||||
})
|
})
|
||||||
|
|
||||||
const { session } = useSession()
|
const { session } = useSession()
|
||||||
|
|
||||||
onMount(() => changeSearchParam('by', 'shouts'))
|
onMount(() => {
|
||||||
|
if (!searchParams().by) {
|
||||||
|
setAuthorsSort('name')
|
||||||
|
changeSearchParam('by', 'name')
|
||||||
|
}
|
||||||
|
})
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
setAuthorsSort(searchParams().by || 'shouts')
|
setAuthorsSort(searchParams().by || 'name')
|
||||||
setLimit(PAGE_SIZE)
|
setLimit(PAGE_SIZE)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -211,7 +216,7 @@ export const AllAuthorsView = (props: Props) => {
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={sortedAuthors().length > limit()}>
|
<Show when={searchParams().by !== 'name' && sortedAuthors().length > limit()}>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class={clsx(styles.loadMoreContainer, 'col-12 col-md-10')}>
|
<div class={clsx(styles.loadMoreContainer, 'col-12 col-md-10')}>
|
||||||
<button class={clsx('button', styles.loadMoreButton)} onClick={showMore}>
|
<button class={clsx('button', styles.loadMoreButton)} onClick={showMore}>
|
||||||
|
|
|
@ -35,7 +35,12 @@ export const AllTopicsView = (props: AllTopicsViewProps) => {
|
||||||
|
|
||||||
const { session } = useSession()
|
const { session } = useSession()
|
||||||
|
|
||||||
onMount(() => changeSearchParam('by', 'shouts'))
|
onMount(() => {
|
||||||
|
if (!searchParams().by) {
|
||||||
|
setTopicsSort('shouts')
|
||||||
|
changeSearchParam('by', 'shouts')
|
||||||
|
}
|
||||||
|
})
|
||||||
createEffect(() => {
|
createEffect(() => {
|
||||||
setTopicsSort(searchParams().by || 'shouts')
|
setTopicsSort(searchParams().by || 'shouts')
|
||||||
setLimit(PAGE_SIZE)
|
setLimit(PAGE_SIZE)
|
||||||
|
|
|
@ -13,18 +13,19 @@ interface StatMetricsProps {
|
||||||
|
|
||||||
const pseudonames = {
|
const pseudonames = {
|
||||||
// topics: 'topics' # amount of topics for community💥
|
// topics: 'topics' # amount of topics for community💥
|
||||||
followed: 'followers',
|
followed: 'follower',
|
||||||
followers: 'followers',
|
followers: 'follower',
|
||||||
reacted: 'involvings',
|
rating: 'like',
|
||||||
reactions: 'involvings',
|
viewed: 'view',
|
||||||
commented: 'discoussions',
|
views: 'view',
|
||||||
comments: 'discussions',
|
reacted: 'involving',
|
||||||
shouts: 'posts',
|
reactions: 'involving',
|
||||||
authors: 'authors'
|
commented: 'discussion',
|
||||||
|
comments: 'discussion',
|
||||||
|
shouts: 'post',
|
||||||
|
authors: 'author'
|
||||||
}
|
}
|
||||||
|
|
||||||
const nos = (s) => s.slice(-1)
|
|
||||||
|
|
||||||
export const StatMetrics = (props: StatMetricsProps) => {
|
export const StatMetrics = (props: StatMetricsProps) => {
|
||||||
return (
|
return (
|
||||||
<div class={styles.statMetrics}>
|
<div class={styles.statMetrics}>
|
||||||
|
@ -33,7 +34,7 @@ export const StatMetrics = (props: StatMetricsProps) => {
|
||||||
<span class={styles.statMetricsItem} classList={{ compact: props.compact }}>
|
<span class={styles.statMetricsItem} classList={{ compact: props.compact }}>
|
||||||
{props.stat[entity] +
|
{props.stat[entity] +
|
||||||
' ' +
|
' ' +
|
||||||
t((pseudonames[entity] || entity).slice(-1)) +
|
t(pseudonames[entity] || entity.slice(-1)) +
|
||||||
plural(props.stat[entity] || 0, locale() === 'ru' ? ['ов', '', 'а'] : ['s', '', 's'])}
|
plural(props.stat[entity] || 0, locale() === 'ru' ? ['ов', '', 'а'] : ['s', '', 's'])}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -8,8 +8,6 @@ export default gql`
|
||||||
name
|
name
|
||||||
bio
|
bio
|
||||||
userpic
|
userpic
|
||||||
links
|
|
||||||
lastSeen
|
|
||||||
stat {
|
stat {
|
||||||
shouts
|
shouts
|
||||||
followers
|
followers
|
||||||
|
|
|
@ -16,11 +16,6 @@ setLocale(lang)
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
<title>{t('Discours')}</title>
|
<title>{t('Discours')}</title>
|
||||||
<script async
|
|
||||||
src="https://ackee.discours.io/increment.js"
|
|
||||||
data-ackee-server="https://ackee.discours.io"
|
|
||||||
data-ackee-domain-id="1004abeb-89b2-4e85-ad97-74f8d2c8ed2d"
|
|
||||||
></script>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<slot />
|
<slot />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user