banner image url fix
This commit is contained in:
parent
9b0fa22a1c
commit
b7ab62c5ad
|
@ -23,11 +23,7 @@ export default () => {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class={clsx(styles.discoursBannerImage, 'col-lg-12 offset-lg-2')}>
|
<div class={clsx(styles.discoursBannerImage, 'col-lg-12 offset-lg-2')}>
|
||||||
<Image
|
<Image src="production/image/discours-banner.jpg" alt={t('Discours')} width={600} />
|
||||||
src="https://cdn.discours.io/production/image/discours-banner.jpg"
|
|
||||||
alt={t('Discours')}
|
|
||||||
width={600}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -96,7 +96,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
|
|
||||||
const canEdit = () =>
|
const canEdit = () =>
|
||||||
props.article.authors?.some((a) => a.slug === author()?.slug) ||
|
props.article.authors?.some((a) => a.slug === author()?.slug) ||
|
||||||
props.article.created_by.id === author().id
|
props.article.created_by?.id === author().id
|
||||||
|
|
||||||
const { changeSearchParam } = useRouter()
|
const { changeSearchParam } = useRouter()
|
||||||
const scrollToComments = (event) => {
|
const scrollToComments = (event) => {
|
||||||
|
|
|
@ -221,8 +221,8 @@ export const HeaderAuth = (props: Props) => {
|
||||||
<div classList={{ entered: page().path === `/${author()?.slug}` }}>
|
<div classList={{ entered: page().path === `/${author()?.slug}` }}>
|
||||||
<Userpic
|
<Userpic
|
||||||
size={'M'}
|
size={'M'}
|
||||||
name={author().name}
|
name={author()?.name}
|
||||||
userpic={author().pic}
|
userpic={author()?.pic}
|
||||||
class={styles.userpic}
|
class={styles.userpic}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -35,7 +35,7 @@ interface TopicProps {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TopicCard = (props: TopicProps) => {
|
export const TopicCard = (props: TopicProps) => {
|
||||||
const { t } = useLocalize()
|
const { t, lang } = useLocalize()
|
||||||
const {
|
const {
|
||||||
subscriptions,
|
subscriptions,
|
||||||
isSessionLoaded,
|
isSessionLoaded,
|
||||||
|
@ -83,6 +83,10 @@ export const TopicCard = (props: TopicProps) => {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const title = createMemo(() =>
|
||||||
|
capitalize(lang() == 'en' ? props.topic.slug.replace(/-/, ' ') : props.topic.title || ''),
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={styles.topicContainer}>
|
<div class={styles.topicContainer}>
|
||||||
<div
|
<div
|
||||||
|
@ -101,9 +105,9 @@ export const TopicCard = (props: TopicProps) => {
|
||||||
!props.subscribeButtonBottom && !props.isNarrow && !props.compact,
|
!props.subscribeButtonBottom && !props.isNarrow && !props.compact,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Show when={props.topic.title && !props.isCardMode}>
|
<Show when={title() && !props.isCardMode}>
|
||||||
<h3 class={styles.topicTitle}>
|
<h3 class={styles.topicTitle}>
|
||||||
<a href={`/topic/${props.topic.slug}`}>{capitalize(props.topic.title || '')}</a>
|
<a href={`/topic/${props.topic.slug}`}>{title()}</a>
|
||||||
</h3>
|
</h3>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
|
@ -114,7 +118,7 @@ export const TopicCard = (props: TopicProps) => {
|
||||||
<Show when={props.topic.pic}>
|
<Show when={props.topic.pic}>
|
||||||
<div class={styles.topicAvatar}>
|
<div class={styles.topicAvatar}>
|
||||||
<a href={`/topic/${props.topic.slug}`}>
|
<a href={`/topic/${props.topic.slug}`}>
|
||||||
<img src={props.topic.pic} alt={props.topic.title} />
|
<img src={props.topic.pic} alt={title()} />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
|
@ -10,6 +10,7 @@ import { Button } from '../../_shared/Button'
|
||||||
import { CheckButton } from '../../_shared/CheckButton'
|
import { CheckButton } from '../../_shared/CheckButton'
|
||||||
|
|
||||||
import styles from './TopicBadge.module.scss'
|
import styles from './TopicBadge.module.scss'
|
||||||
|
import { capitalize } from '../../../utils/capitalize'
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
topic: Topic
|
topic: Topic
|
||||||
|
@ -18,7 +19,7 @@ type Props = {
|
||||||
|
|
||||||
export const TopicBadge = (props: Props) => {
|
export const TopicBadge = (props: Props) => {
|
||||||
const [isSubscribing, setIsSubscribing] = createSignal(false)
|
const [isSubscribing, setIsSubscribing] = createSignal(false)
|
||||||
const { t } = useLocalize()
|
const { t, lang } = useLocalize()
|
||||||
const {
|
const {
|
||||||
isAuthenticated,
|
isAuthenticated,
|
||||||
subscriptions,
|
subscriptions,
|
||||||
|
@ -52,7 +53,9 @@ export const TopicBadge = (props: Props) => {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<a href={`/topic/${props.topic.slug}`} class={styles.info}>
|
<a href={`/topic/${props.topic.slug}`} class={styles.info}>
|
||||||
<span class={styles.title}>{props.topic.title}</span>
|
<span class={styles.title}>
|
||||||
|
{lang() == 'en' ? capitalize(props.topic.slug.replace(/-/, ' ')) : props.topic.title}
|
||||||
|
</span>
|
||||||
<Show
|
<Show
|
||||||
when={props.topic.body}
|
when={props.topic.body}
|
||||||
fallback={
|
fallback={
|
||||||
|
|
|
@ -13,6 +13,7 @@ import { SearchField } from '../_shared/SearchField'
|
||||||
import { TopicCard } from '../Topic/Card'
|
import { TopicCard } from '../Topic/Card'
|
||||||
|
|
||||||
import styles from './AllTopics.module.scss'
|
import styles from './AllTopics.module.scss'
|
||||||
|
import { capitalize } from '../../utils/capitalize'
|
||||||
|
|
||||||
type AllTopicsPageSearchParams = {
|
type AllTopicsPageSearchParams = {
|
||||||
by: 'shouts' | 'authors' | 'title' | ''
|
by: 'shouts' | 'authors' | 'title' | ''
|
||||||
|
@ -23,12 +24,13 @@ type AllTopicsViewProps = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const PAGE_SIZE = 20
|
const PAGE_SIZE = 20
|
||||||
const ALPHABET = [...'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ#']
|
|
||||||
|
|
||||||
export const AllTopicsView = (props: AllTopicsViewProps) => {
|
export const AllTopicsView = (props: AllTopicsViewProps) => {
|
||||||
const { t, lang } = useLocalize()
|
const { t, lang } = useLocalize()
|
||||||
const { searchParams, changeSearchParam } = useRouter<AllTopicsPageSearchParams>()
|
const { searchParams, changeSearchParam } = useRouter<AllTopicsPageSearchParams>()
|
||||||
const [limit, setLimit] = createSignal(PAGE_SIZE)
|
const [limit, setLimit] = createSignal(PAGE_SIZE)
|
||||||
|
const ALPHABET =
|
||||||
|
lang() === 'ru' ? [...'АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ#'] : [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ#']
|
||||||
|
|
||||||
const { sortedTopics } = useTopicsStore({
|
const { sortedTopics } = useTopicsStore({
|
||||||
topics: props.topics,
|
topics: props.topics,
|
||||||
|
@ -52,8 +54,9 @@ export const AllTopicsView = (props: AllTopicsViewProps) => {
|
||||||
const byLetter = createMemo<{ [letter: string]: Topic[] }>(() => {
|
const byLetter = createMemo<{ [letter: string]: Topic[] }>(() => {
|
||||||
return sortedTopics().reduce(
|
return sortedTopics().reduce(
|
||||||
(acc, topic) => {
|
(acc, topic) => {
|
||||||
let letter = topic.title[0].toUpperCase()
|
let letter = lang() == 'en' ? topic.slug[0].toUpperCase() : topic.title[0].toUpperCase()
|
||||||
if (/[^ËА-яё]/.test(letter) && lang() === 'ru') letter = '#'
|
if (/[^ËА-яё]/.test(letter) && lang() === 'ru') letter = '#'
|
||||||
|
if (/[^A-z]/.test(letter) && lang() === 'en') letter = '#'
|
||||||
if (!acc[letter]) acc[letter] = []
|
if (!acc[letter]) acc[letter] = []
|
||||||
acc[letter].push(topic)
|
acc[letter].push(topic)
|
||||||
return acc
|
return acc
|
||||||
|
@ -143,7 +146,9 @@ export const AllTopicsView = (props: AllTopicsViewProps) => {
|
||||||
<For each={byLetter()[letter]}>
|
<For each={byLetter()[letter]}>
|
||||||
{(topic) => (
|
{(topic) => (
|
||||||
<div class={clsx(styles.topic, 'topic col-sm-12 col-md-8')}>
|
<div class={clsx(styles.topic, 'topic col-sm-12 col-md-8')}>
|
||||||
<a href={`/topic/${topic.slug}`}>{topic.title}</a>
|
<a href={`/topic/${topic.slug}`}>
|
||||||
|
{lang() == 'en' ? capitalize(topic.slug.replace(/-/, ' ')) : topic.title}
|
||||||
|
</a>
|
||||||
<span class={styles.articlesCounter}>{topic.stat.shouts}</span>
|
<span class={styles.articlesCounter}>{topic.stat.shouts}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -48,7 +48,7 @@ type Props = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FeedView = (props: Props) => {
|
export const FeedView = (props: Props) => {
|
||||||
const { t } = useLocalize()
|
const { t, lang } = useLocalize()
|
||||||
const { page, searchParams } = useRouter<FeedSearchParams>()
|
const { page, searchParams } = useRouter<FeedSearchParams>()
|
||||||
const [isLoading, setIsLoading] = createSignal(false)
|
const [isLoading, setIsLoading] = createSignal(false)
|
||||||
|
|
||||||
|
@ -227,7 +227,9 @@ export const FeedView = (props: Props) => {
|
||||||
<For each={topTopics().slice(0, 7)}>
|
<For each={topTopics().slice(0, 7)}>
|
||||||
{(topic) => (
|
{(topic) => (
|
||||||
<span class={clsx(stylesTopic.shoutTopic, styles.topic)}>
|
<span class={clsx(stylesTopic.shoutTopic, styles.topic)}>
|
||||||
<a href={`/topic/${topic.slug}`}>{topic.title}</a>{' '}
|
<a href={`/topic/${topic.slug}`}>
|
||||||
|
{lang() == 'en' ? topic.slug.replace(/-/, ' ') : topic.title}
|
||||||
|
</a>{' '}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
|
|
|
@ -59,16 +59,16 @@ export const ConnectProvider = (props: { children: JSX.Element }) => {
|
||||||
setConnected(false)
|
setConnected(false)
|
||||||
},
|
},
|
||||||
onerror(err) {
|
onerror(err) {
|
||||||
console.error('[context.connect] sse connection closed by error', err)
|
console.error('[context.connect] sse connection error', err)
|
||||||
setConnected(false)
|
setConnected(false)
|
||||||
throw new Error(err) // NOTE: simple hack to close the connection
|
throw new Error(err) // NOTE: simple hack to close the connection
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
if (retried() < 4) {
|
||||||
setRetried((r) => r + 1)
|
setRetried((r) => r + 1)
|
||||||
if (retried() + 1 > 3) {
|
} else {
|
||||||
console.warn('not trying to reconnect anymore, listen() should be called again')
|
console.warn('Not trying to reconnect anymore; listen() should be called again.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default gql`
|
||||||
slug
|
slug
|
||||||
layout
|
layout
|
||||||
cover
|
cover
|
||||||
|
cover_caption
|
||||||
body
|
body
|
||||||
media
|
media
|
||||||
updated_by {
|
updated_by {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user