diff --git a/src/components/Article/FullArticle.tsx b/src/components/Article/FullArticle.tsx
index 17891d64..25863788 100644
--- a/src/components/Article/FullArticle.tsx
+++ b/src/components/Article/FullArticle.tsx
@@ -1,6 +1,6 @@
// import { install } from 'ga-gtag'
import { createPopper } from '@popperjs/core'
-import { Link, Meta } from '@solidjs/meta'
+import { Link } from '@solidjs/meta'
import { A, useSearchParams } from '@solidjs/router'
import { clsx } from 'clsx'
import { For, Show, createEffect, createMemo, createSignal, on, onCleanup, onMount } from 'solid-js'
@@ -12,10 +12,9 @@ import { useSession } from '~/context/session'
import { DEFAULT_HEADER_OFFSET, useUI } from '~/context/ui'
import type { Author, Maybe, QueryLoad_Reactions_ByArgs, Shout, Topic } from '~/graphql/schema/core.gen'
import { isCyrillic } from '~/intl/translate'
-import { getImageUrl, getOpenGraphImageUrl } from '~/lib/getImageUrl'
+import { getImageUrl } from '~/lib/getImageUrl'
import { MediaItem } from '~/types/mediaitem'
import { capitalize } from '~/utils/capitalize'
-import { getArticleDescription, getArticleKeywords } from '~/utils/meta'
import { AuthorBadge } from '../Author/AuthorBadge'
import { CardTopic } from '../Feed/CardTopic'
import { FeedArticlePopup } from '../Feed/FeedArticlePopup'
@@ -302,7 +301,6 @@ export const FullArticle = (props: Props) => {
)
onMount(async () => {
- // install('G-LQ4B87H8C2')
const opts: QueryLoad_Reactions_ByArgs = { by: { shout: props.article.slug }, limit: 999, offset: 0 }
const _rrr = await loadReactionsBy(opts)
addSeen(props.article.slug)
@@ -326,34 +324,11 @@ export const FullArticle = (props: Props) => {
})
})
- const cover = props.article.cover || 'production/image/logo_image.png'
- const ogImage = getOpenGraphImageUrl(cover, {
- title: props.article.title,
- topic: mainTopic()?.title || '',
- author: props.article.authors?.[0]?.name || '',
- width: 1200
- })
-
- const description = getArticleDescription(props.article.description || body() || media()[0]?.body)
- const ogTitle = props.article.title
- const keywords = getArticleKeywords(props.article)
const shareUrl = getShareUrl({ pathname: `/${props.article.slug || ''}` })
- const getAuthorName = (a: Author) => {
- return lang() === 'en' && isCyrillic(a.name || '') ? capitalize(a.slug.replace(/-/, ' ')) : a.name
- }
+ const getAuthorName = (a: Author) =>
+ lang() === 'en' && isCyrillic(a.name || '') ? capitalize(a.slug.replace(/-/, ' ')) : a.name
return (
<>
-
-
-
-
-
-
-
-
-
-
-
{(imageUrl) => }
@@ -522,7 +497,7 @@ export const FullArticle = (props: Props) => {
{
diff --git a/src/components/AuthorsList/AuthorsList.tsx b/src/components/AuthorsList/AuthorsList.tsx
deleted file mode 100644
index 95305042..00000000
--- a/src/components/AuthorsList/AuthorsList.tsx
+++ /dev/null
@@ -1,99 +0,0 @@
-import { clsx } from 'clsx'
-import { For, Show, createEffect, createSignal, on } from 'solid-js'
-import { useAuthors } from '~/context/authors'
-import { useLocalize } from '~/context/localize'
-import { loadAuthors } from '~/graphql/api/public'
-import { Author } from '~/graphql/schema/core.gen'
-import { AuthorBadge } from '../Author/AuthorBadge'
-import { InlineLoader } from '../InlineLoader'
-import { AUTHORS_PER_PAGE } from '../Views/AllAuthors/AllAuthors'
-import { Button } from '../_shared/Button'
-import styles from './AuthorsList.module.scss'
-
-type Props = {
- class?: string
- query: 'followers' | 'shouts'
- searchQuery?: string
- allAuthorsLength?: number
-}
-
-// pagination handling, loadAuthors cached from api, addAuthors to context
-
-export const AuthorsList = (props: Props) => {
- const { t } = useLocalize()
- const { addAuthors } = useAuthors()
- const [authorsByShouts, setAuthorsByShouts] = createSignal()
- const [authorsByFollowers, setAuthorsByFollowers] = createSignal()
- const [loading, setLoading] = createSignal(false)
- const [currentPage, setCurrentPage] = createSignal({ shouts: 0, followers: 0 })
- const [allLoaded, setAllLoaded] = createSignal(false)
-
- const fetchAuthors = async (queryType: Props['query'], page: number) => {
- setLoading(true)
- const offset = AUTHORS_PER_PAGE * page
- const fetcher = await loadAuthors({
- by: { order: queryType },
- limit: AUTHORS_PER_PAGE,
- offset
- })
- const result = await fetcher()
- if (result) {
- addAuthors([...result])
- if (queryType === 'shouts') {
- setAuthorsByShouts((prev) => [...(prev || []), ...result])
- } else if (queryType === 'followers') {
- setAuthorsByFollowers((prev) => [...(prev || []), ...result])
- }
- setLoading(false)
- }
- }
-
- const loadMoreAuthors = () => {
- const nextPage = currentPage()[props.query] + 1
- fetchAuthors(props.query, nextPage).then(() =>
- setCurrentPage({ ...currentPage(), [props.query]: nextPage })
- )
- }
-
- createEffect(
- on(
- () => props.query,
- (query) => {
- const al = query === 'shouts' ? authorsByShouts() : authorsByFollowers()
- if (al?.length === 0 && currentPage()[query] === 0) {
- setCurrentPage((prev) => ({ ...prev, [query]: 0 }))
- fetchAuthors(query, 0).then(() => setCurrentPage((prev) => ({ ...prev, [query]: 1 })))
- }
- }
- )
- )
-
- const authorsList = () => (props.query === 'shouts' ? authorsByShouts() : authorsByFollowers())
- createEffect(() => setAllLoaded(props.allAuthorsLength === authorsList.length))
-
- return (
-
-
- {(author) => (
-
- )}
-
-
-
-
- 0 && !allLoaded()}>
-
-
-
-
-
-
-
-
-
- )
-}
diff --git a/src/components/AuthorsList/index.ts b/src/components/AuthorsList/index.ts
deleted file mode 100644
index 4187ebae..00000000
--- a/src/components/AuthorsList/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { AuthorsList } from './AuthorsList'
diff --git a/src/components/Nav/Header/Header.tsx b/src/components/Nav/Header/Header.tsx
index 776dabbd..aeda0fd1 100644
--- a/src/components/Nav/Header/Header.tsx
+++ b/src/components/Nav/Header/Header.tsx
@@ -7,7 +7,6 @@ import { useTopics } from '~/context/topics'
import { useUI } from '~/context/ui'
import type { Topic } from '../../../graphql/schema/core.gen'
import { getRandomTopicsFromArray } from '../../../lib/getRandomTopicsFromArray'
-import { getArticleDescription } from '../../../utils/meta'
import { SharePopup, getShareUrl } from '../../Article/SharePopup'
import { Icon } from '../../_shared/Icon'
import { Newsletter } from '../../_shared/Newsletter'
@@ -24,7 +23,7 @@ type Props = {
title?: string
slug?: string
isHeaderFixed?: boolean
- articleBody?: string
+ desc?: string
cover?: string
scrollToComments?: (value: boolean) => void
}
@@ -324,10 +323,8 @@ export const Header = (props: Props) => {
title={props.title || ''}
imageUrl={props.cover || ''}
shareUrl={getShareUrl()}
- description={getArticleDescription(props.articleBody?.slice(0, 100) || '')}
- onVisibilityChange={(isVisible) => {
- setIsSharePopupVisible(isVisible)
- }}
+ description={props.desc || ''}
+ onVisibilityChange={setIsSharePopupVisible}
containerCssClass={styles.control}
trigger={
<>
diff --git a/src/components/Nav/Topics/index.ts b/src/components/Nav/Topics/index.ts
deleted file mode 100644
index c6ce8d87..00000000
--- a/src/components/Nav/Topics/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export { Topics } from './Topics'
diff --git a/src/components/Nav/Topics/Topics.module.scss b/src/components/Nav/TopicsNav/TopicsNav.module.scss
similarity index 100%
rename from src/components/Nav/Topics/Topics.module.scss
rename to src/components/Nav/TopicsNav/TopicsNav.module.scss
diff --git a/src/components/Nav/Topics/Topics.tsx b/src/components/Nav/TopicsNav/TopicsNav.tsx
similarity index 95%
rename from src/components/Nav/Topics/Topics.tsx
rename to src/components/Nav/TopicsNav/TopicsNav.tsx
index a5eac959..874e37c5 100644
--- a/src/components/Nav/Topics/Topics.tsx
+++ b/src/components/Nav/TopicsNav/TopicsNav.tsx
@@ -3,9 +3,9 @@ import { Icon } from '~/components/_shared/Icon'
import { useLocalize } from '~/context/localize'
import { A, useMatch } from '@solidjs/router'
-import styles from './Topics.module.scss'
+import styles from './TopicsNav.module.scss'
-export const Topics = () => {
+export const TopicsNav = () => {
const { t } = useLocalize()
const matchExpo = useMatch(() => '/expo')
return (
diff --git a/src/components/Nav/TopicsNav/index.ts b/src/components/Nav/TopicsNav/index.ts
new file mode 100644
index 00000000..37653d78
--- /dev/null
+++ b/src/components/Nav/TopicsNav/index.ts
@@ -0,0 +1 @@
+export { TopicsNav } from './TopicsNav'
diff --git a/src/components/Topic/Full.tsx b/src/components/Topic/Full.tsx
index 15c35d84..09baba15 100644
--- a/src/components/Topic/Full.tsx
+++ b/src/components/Topic/Full.tsx
@@ -1,7 +1,7 @@
import type { Author, Topic } from '~/graphql/schema/core.gen'
import { clsx } from 'clsx'
-import { Show, createEffect, createSignal } from 'solid-js'
+import { Show, createEffect, createMemo, createSignal } from 'solid-js'
import { useFollowing } from '~/context/following'
import { useLocalize } from '~/context/localize'
@@ -9,6 +9,7 @@ import { useSession } from '~/context/session'
import { FollowingEntity } from '~/graphql/schema/core.gen'
import { Button } from '../_shared/Button'
+import { capitalize } from '~/utils/capitalize'
import { FollowingCounters } from '../_shared/FollowingCounters/FollowingCounters'
import { Icon } from '../_shared/Icon'
import styles from './Full.module.scss'
@@ -20,11 +21,21 @@ type Props = {
}
export const FullTopic = (props: Props) => {
- const { t } = useLocalize()
+ const { t, lang } = useLocalize()
const { follows, changeFollowing } = useFollowing()
const { requireAuthentication } = useSession()
const [followed, setFollowed] = createSignal()
+ const title = createMemo(
+ () =>
+ // FIXME: use title translation
+ `#${capitalize(
+ lang() === 'en'
+ ? props.topic.slug.replace(/-/, ' ')
+ : props.topic.title || props.topic.slug.replace(/-/, ' '),
+ true
+ )}`
+ )
createEffect(() => {
if (follows?.topics?.length !== 0) {
const items = follows.topics || []
@@ -42,7 +53,7 @@ export const FullTopic = (props: Props) => {
return (