maintopic-fix
Some checks failed
deploy / test (push) Failing after 53s
deploy / deploy (push) Has been skipped

This commit is contained in:
Untone 2023-12-09 21:35:08 +03:00
parent b7ab62c5ad
commit 44af27d7a5
10 changed files with 35 additions and 12 deletions

View File

@ -29,6 +29,17 @@ img {
font-size: 1.6rem; font-size: 1.6rem;
line-height: 1.6; line-height: 1.6;
details {
text-align: center;
background-color: lightgray;
line-height: 3em;
}
details p {
text-align: left;
line-height: normal;
}
blockquote, blockquote,
blockquote[data-type='punchline'] { blockquote[data-type='punchline'] {
clear: both; clear: both;

View File

@ -38,7 +38,7 @@ export const Comment = (props: Props) => {
const [loading, setLoading] = createSignal(false) const [loading, setLoading] = createSignal(false)
const [editMode, setEditMode] = createSignal(false) const [editMode, setEditMode] = createSignal(false)
const [clearEditor, setClearEditor] = createSignal(false) const [clearEditor, setClearEditor] = createSignal(false)
const { session } = useSession() const { author } = useSession()
const { const {
actions: { createReaction, deleteReaction, updateReaction }, actions: { createReaction, deleteReaction, updateReaction },
@ -52,7 +52,7 @@ export const Comment = (props: Props) => {
actions: { showSnackbar }, actions: { showSnackbar },
} = useSnackbar() } = useSnackbar()
const isCommentAuthor = createMemo(() => props.comment.created_by?.slug === session()?.author?.slug) const isCommentAuthor = createMemo(() => props.comment.created_by?.slug === author().slug)
const comment = createMemo(() => props.comment) const comment = createMemo(() => props.comment)
const body = createMemo(() => (comment().body || '').trim()) const body = createMemo(() => (comment().body || '').trim())
@ -216,7 +216,7 @@ export const Comment = (props: Props) => {
</Show> </Show>
{/*<SharePopup*/} {/*<SharePopup*/}
{/* title={'artile.title'}*/} {/* title={'article.title'}*/}
{/* description={getDescription(body())}*/} {/* description={getDescription(body())}*/}
{/* containerCssClass={stylesHeader.control}*/} {/* containerCssClass={stylesHeader.control}*/}
{/* trigger={*/} {/* trigger={*/}

View File

@ -72,9 +72,14 @@ export const FullArticle = (props: Props) => {
const formattedDate = createMemo(() => formatDate(new Date(props.article.created_at * 1000))) const formattedDate = createMemo(() => formatDate(new Date(props.article.created_at * 1000)))
const mainTopic = createMemo(() => { const mainTopic = createMemo(() => {
const mt = props.article.topics.length > 0 ? props.article.topics[0] : null const main_topic_slug = props.article.topics.length > 0 ? props.article.main_topic : null
const mt = props.article.topics.find((t) => t.slug === main_topic_slug)
if (mt) {
mt.title = lang() == 'en' ? capitalize(mt.slug.replace('-', ' ')) : mt.title mt.title = lang() == 'en' ? capitalize(mt.slug.replace('-', ' ')) : mt.title
return mt return mt
} else {
return props.article.topics[0]
}
}) })
const canEdit = () => props.article.authors?.some((a) => a.slug === author()?.slug) const canEdit = () => props.article.authors?.some((a) => a.slug === author()?.slug)

View File

@ -86,7 +86,10 @@ const getTitleAndSubtitle = (
export const ArticleCard = (props: ArticleCardProps) => { export const ArticleCard = (props: ArticleCardProps) => {
const { t, lang, formatDate } = useLocalize() const { t, lang, formatDate } = useLocalize()
const { author } = useSession() const { author } = useSession()
const mainTopic = props.article.topics[0] const mainTopicSlug = props.article.main_topic
const mainTopic = props.article.topics.find((t) => t.slug === mainTopicSlug)
const mainTopicTitle =
lang() === 'ru' && mainTopic?.title ? mainTopic.title : mainTopicSlug.replace('-', ' ')
const formattedDate = createMemo<string>(() => { const formattedDate = createMemo<string>(() => {
return formatDate(new Date(props.article.created_at * 1000)) return formatDate(new Date(props.article.created_at * 1000))
@ -171,12 +174,10 @@ export const ArticleCard = (props: ArticleCardProps) => {
</div> </div>
</Show> </Show>
<Show when={!props.settings?.isGroup && mainTopic}> <Show when={!props.settings?.isGroup && mainTopicSlug}>
<CardTopic <CardTopic
title={ title={mainTopicTitle}
lang() === 'ru' && mainTopic.title ? mainTopic.title : mainTopic?.slug?.replace('-', ' ') slug={mainTopicSlug}
}
slug={mainTopic.slug}
isFloorImportant={props.settings?.isFloorImportant} isFloorImportant={props.settings?.isFloorImportant}
isFeedMode={true} isFeedMode={true}
class={clsx(styles.shoutTopic, { [styles.shoutTopicTop]: props.settings.isShort })} class={clsx(styles.shoutTopic, { [styles.shoutTopicTop]: props.settings.isShort })}

View File

@ -23,6 +23,7 @@ export default gql`
created_at created_at
} }
# community # community
main_topic
topics { topics {
id id
title title

View File

@ -12,6 +12,7 @@ export default gql`
layout layout
cover cover
lead lead
main_topic
topics { topics {
id id
title title

View File

@ -11,6 +11,7 @@ export default gql`
cover cover
# community # community
media media
main_topic
topics { topics {
id id
title title

View File

@ -10,6 +10,7 @@ export default gql`
layout layout
cover cover
# community # community
main_topic
topics { topics {
id id
title title

View File

@ -9,6 +9,7 @@ export default gql`
slug slug
cover cover
# community # community
main_topic
topics { topics {
# id # id
title title

View File

@ -9,6 +9,7 @@ export default gql`
slug slug
layout layout
cover cover
main_topic
topics { topics {
id id
title title