maintopic-fix
This commit is contained in:
parent
b7ab62c5ad
commit
44af27d7a5
|
@ -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;
|
||||||
|
|
|
@ -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={*/}
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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 })}
|
||||||
|
|
|
@ -23,6 +23,7 @@ export default gql`
|
||||||
created_at
|
created_at
|
||||||
}
|
}
|
||||||
# community
|
# community
|
||||||
|
main_topic
|
||||||
topics {
|
topics {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|
|
@ -12,6 +12,7 @@ export default gql`
|
||||||
layout
|
layout
|
||||||
cover
|
cover
|
||||||
lead
|
lead
|
||||||
|
main_topic
|
||||||
topics {
|
topics {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|
|
@ -11,6 +11,7 @@ export default gql`
|
||||||
cover
|
cover
|
||||||
# community
|
# community
|
||||||
media
|
media
|
||||||
|
main_topic
|
||||||
topics {
|
topics {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|
|
@ -10,6 +10,7 @@ export default gql`
|
||||||
layout
|
layout
|
||||||
cover
|
cover
|
||||||
# community
|
# community
|
||||||
|
main_topic
|
||||||
topics {
|
topics {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|
|
@ -9,6 +9,7 @@ export default gql`
|
||||||
slug
|
slug
|
||||||
cover
|
cover
|
||||||
# community
|
# community
|
||||||
|
main_topic
|
||||||
topics {
|
topics {
|
||||||
# id
|
# id
|
||||||
title
|
title
|
||||||
|
|
|
@ -9,6 +9,7 @@ export default gql`
|
||||||
slug
|
slug
|
||||||
layout
|
layout
|
||||||
cover
|
cover
|
||||||
|
main_topic
|
||||||
topics {
|
topics {
|
||||||
id
|
id
|
||||||
title
|
title
|
||||||
|
|
Loading…
Reference in New Issue
Block a user