fix-ackee-increment

This commit is contained in:
tonyrewin 2022-11-14 11:03:48 +03:00
parent 9e04595b3e
commit 6fc26283bd
4 changed files with 8 additions and 21 deletions

View File

@ -67,18 +67,8 @@ export const FullArticle = (props: ArticleProps) => {
}
})
//<script async
// src="https://ackee.discours.io/tracker.js"
// data-ackee-server="https://ackee.discours.io"
// data-ackee-domain-id="dfaf6bc4-163c-4885-9d8b-1e72f7064d42"
return (
<div class="shout wide-container">
<script
async
src="https://ackee.discours.io/increment.js"
data-ackee-server="https://ackee.discours.io"
data-ackee-domain-id="dfaf6bc4-163c-4885-9d8b-1e72f7064d42"
></script>
<article class="col-md-6 shift-content">
<div class="shout__header">
<div class="shout__topic">

View File

@ -29,7 +29,7 @@ export const LayoutShoutsPage = (props: PageProps) => {
})
const [isLoadMoreButtonVisible, setIsLoadMoreButtonVisible] = createSignal(false)
const { sortedLayoutShouts } = useLayoutsStore(layout(), props.shouts)
const sortedArticles = createMemo(() => sortedLayoutShouts().get(layout()))
const sortedArticles = createMemo<Shout[]>(() => sortedLayoutShouts().get(layout()) || [])
const loadMoreLayout = async (kind: LayoutType) => {
saveScrollPosition()
@ -59,12 +59,11 @@ export const LayoutShoutsPage = (props: PageProps) => {
const pages = createMemo<Shout[][]>(() =>
splitToPages(sortedArticles(), PRERENDERED_ARTICLES_COUNT, LOAD_MORE_PAGE_SIZE)
)
const [isLoaded, setIsLoaded] = createSignal(Boolean(props.shouts))
const isLoaded = createMemo(() => Boolean(sortedArticles()))
onMount(async () => {
if (!isLoaded()) {
await loadRecentLayoutShouts({ layout: layout(), amount: PRERENDERED_ARTICLES_COUNT, offset: 0 })
setIsLoaded(true)
}
})
@ -102,9 +101,8 @@ export const LayoutShoutsPage = (props: PageProps) => {
<PageWrap>
<Show when={isLoaded()} fallback={<Loading />}>
<div class={styles.topicPage}>
<Show when={layout()}>
<Show when={layout() && Boolean(sortedArticles())}>
<h1>{title()}</h1>
<ModeSwitcher />
<Row1 article={sortedArticles()[0]} />
<Row2 articles={sortedArticles().slice(1, 3)} />

View File

@ -110,12 +110,6 @@ export const HomeView = (props: HomeProps) => {
return (
<Show when={locale() && sortedArticles().length > 0}>
<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>
<NavTopics topics={randomTopics()} />
<Row5 articles={sortedArticles().slice(0, 5)} />

View File

@ -16,6 +16,11 @@ setLocale(lang)
<meta name="viewport" content="width=device-width" />
<link rel="icon" type="image/png" href="/favicon.png" />
<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>
<body>
<slot />