ArticleCard undefined in props error
This commit is contained in:
parent
f73a834f35
commit
09098ff307
|
@ -72,113 +72,109 @@ export const ArticleCard = (props: ArticleCardProps) => {
|
||||||
'shout-card--feed': props.settings?.isFeedMode
|
'shout-card--feed': props.settings?.isFeedMode
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Show when={mainTopic}>
|
<Show when={!props.settings?.noimage && cover}>
|
||||||
<Show when={!props.settings?.noimage && cover}>
|
<div class="shout-card__cover-container">
|
||||||
<div class="shout-card__cover-container">
|
<div class="shout-card__cover">
|
||||||
<div class="shout-card__cover">
|
<img src={cover || ''} alt={title || ''} loading="lazy" />
|
||||||
<img src={cover || ''} alt={title || ''} loading="lazy" />
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
|
<div class="shout-card__content">
|
||||||
|
<Show when={layout && layout !== 'article' && !(props.settings?.noicon || props.settings?.noimage)}>
|
||||||
|
<div class="shout-card__type">
|
||||||
|
<a href={`/topic/${mainTopic.slug}`}>
|
||||||
|
<Icon name={layout} />
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<div class="shout-card__content">
|
<Show when={!props.settings?.isGroup}>
|
||||||
<Show
|
<div class="shout__topic">
|
||||||
when={layout && layout !== 'article' && !(props.settings?.noicon || props.settings?.noimage)}
|
<a href={`/topic/${mainTopic.slug}`}>
|
||||||
>
|
{locale() === 'ru' && mainTopic.title ? mainTopic.title : mainTopic.slug.replace('-', ' ')}
|
||||||
<div class="shout-card__type">
|
|
||||||
<a href={`/topic/${mainTopic.slug}`}>
|
|
||||||
<Icon name={layout} />
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={!props.settings?.isGroup}>
|
|
||||||
<div class="shout__topic">
|
|
||||||
<a href={`/topic/${mainTopic.slug}`}>
|
|
||||||
{locale() === 'ru' && mainTopic.title ? mainTopic.title : mainTopic.slug.replace('-', ' ')}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<div class="shout-card__titles-container">
|
|
||||||
<a href={`/${slug || ''}`} onClick={handleClientRouteLinkClick}>
|
|
||||||
<div class="shout-card__title">
|
|
||||||
<span class="shout-card__link-container">{title}</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Show when={!props.settings?.nosubtitle && subtitle}>
|
|
||||||
<div class="shout-card__subtitle">
|
|
||||||
<span class="shout-card__link-container">{subtitle}</span>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
<Show when={!props.settings?.noauthor || !props.settings?.nodate}>
|
<div class="shout-card__titles-container">
|
||||||
<div class="shout__details">
|
<a href={`/${slug || ''}`} onClick={handleClientRouteLinkClick}>
|
||||||
<Show when={!props.settings?.noauthor}>
|
<div class="shout-card__title">
|
||||||
<div class="shout__author">
|
<span class="shout-card__link-container">{title}</span>
|
||||||
<For each={authors}>
|
|
||||||
{(author, index) => {
|
|
||||||
const name =
|
|
||||||
author.name === 'Дискурс' && locale() !== 'ru'
|
|
||||||
? 'Discours'
|
|
||||||
: translit(author.name || '', locale() || 'ru')
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Show when={index() > 0}>, </Show>
|
|
||||||
<a href={`/author/${author.slug}`}>{name}</a>
|
|
||||||
</>
|
|
||||||
)
|
|
||||||
}}
|
|
||||||
</For>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={!props.settings?.nodate}>
|
|
||||||
<div class="shout__date">{formattedDate()}</div>
|
|
||||||
</Show>
|
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
|
||||||
|
|
||||||
<Show when={props.settings?.isFeedMode}>
|
<Show when={!props.settings?.nosubtitle && subtitle}>
|
||||||
<section class="shout-card__details">
|
<div class="shout-card__subtitle">
|
||||||
<div class="shout-card__details-content">
|
<span class="shout-card__link-container">{subtitle}</span>
|
||||||
<div class="shout-card__details-item rating">
|
</div>
|
||||||
<button class="rating__control">−</button>
|
</Show>
|
||||||
<span class="rating__value">{stat?.rating || ''}</span>
|
</a>
|
||||||
<button class="rating__control">+</button>
|
</div>
|
||||||
</div>
|
|
||||||
<div class="shout-card__details-item shout-card__comments">
|
|
||||||
<Icon name="eye" />
|
|
||||||
{stat?.viewed}
|
|
||||||
</div>
|
|
||||||
<div class="shout-card__details-item shout-card__comments">
|
|
||||||
<a href={`/${slug + '#comments' || ''}`}>
|
|
||||||
<Icon name="comment" />
|
|
||||||
{stat?.commented || ''}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="shout-card__details-item">
|
<Show when={!props.settings?.noauthor || !props.settings?.nodate}>
|
||||||
<button>
|
<div class="shout__details">
|
||||||
<Icon name="bookmark" />
|
<Show when={!props.settings?.noauthor}>
|
||||||
</button>
|
<div class="shout__author">
|
||||||
</div>
|
<For each={authors}>
|
||||||
|
{(author, index) => {
|
||||||
|
const name =
|
||||||
|
author.name === 'Дискурс' && locale() !== 'ru'
|
||||||
|
? 'Discours'
|
||||||
|
: translit(author.name || '', locale() || 'ru')
|
||||||
|
|
||||||
<div class="shout-card__details-item">
|
return (
|
||||||
<button>
|
<>
|
||||||
<Icon name="ellipsis" />
|
<Show when={index() > 0}>, </Show>
|
||||||
</button>
|
<a href={`/author/${author.slug}`}>{name}</a>
|
||||||
</div>
|
</>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</For>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
|
<Show when={!props.settings?.nodate}>
|
||||||
|
<div class="shout__date">{formattedDate()}</div>
|
||||||
|
</Show>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
|
||||||
|
<Show when={props.settings?.isFeedMode}>
|
||||||
|
<section class="shout-card__details">
|
||||||
|
<div class="shout-card__details-content">
|
||||||
|
<div class="shout-card__details-item rating">
|
||||||
|
<button class="rating__control">−</button>
|
||||||
|
<span class="rating__value">{stat?.rating || ''}</span>
|
||||||
|
<button class="rating__control">+</button>
|
||||||
|
</div>
|
||||||
|
<div class="shout-card__details-item shout-card__comments">
|
||||||
|
<Icon name="eye" />
|
||||||
|
{stat?.viewed}
|
||||||
|
</div>
|
||||||
|
<div class="shout-card__details-item shout-card__comments">
|
||||||
|
<a href={`/${slug + '#comments' || ''}`}>
|
||||||
|
<Icon name="comment" />
|
||||||
|
{stat?.commented || ''}
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="button--light shout-card__edit-control">{t('Collaborate')}</button>
|
<div class="shout-card__details-item">
|
||||||
</section>
|
<button>
|
||||||
</Show>
|
<Icon name="bookmark" />
|
||||||
</div>
|
</button>
|
||||||
</Show>
|
</div>
|
||||||
|
|
||||||
|
<div class="shout-card__details-item">
|
||||||
|
<button>
|
||||||
|
<Icon name="ellipsis" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button class="button--light shout-card__edit-control">{t('Collaborate')}</button>
|
||||||
|
</section>
|
||||||
|
</Show>
|
||||||
|
</div>
|
||||||
</section>
|
</section>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -217,12 +217,10 @@ type InitialState = {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useArticlesStore = (initialState: InitialState = {}) => {
|
export const useArticlesStore = (initialState: InitialState = {}) => {
|
||||||
const sortedArticles = [...(initialState.sortedArticles || [])]
|
addArticles(initialState.sortedArticles || [])
|
||||||
|
|
||||||
addArticles(sortedArticles)
|
if (initialState.sortedArticles) {
|
||||||
|
setSortedArticles([...initialState.sortedArticles])
|
||||||
if (sortedArticles) {
|
|
||||||
addSortedArticles(sortedArticles)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const getArticleEntities = useStore(articleEntitiesStore)
|
const getArticleEntities = useStore(articleEntitiesStore)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user