Added noAuthorLink props, restore author links on the main page

This commit is contained in:
kvakazyambra 2023-07-26 23:40:14 +03:00
parent 1f501a971d
commit d1b92a5f11
6 changed files with 42 additions and 20 deletions

View File

@ -457,7 +457,7 @@
} }
.shoutTopic a { .shoutTopic a {
&, &:link,
&:visited { &:visited {
&:hover { &:hover {
background: #fff !important; background: #fff !important;
@ -775,3 +775,7 @@
.shoutTopicTop { .shoutTopicTop {
margin-bottom: 0.4rem !important; margin-bottom: 0.4rem !important;
} }
.shoutCardNoImage {
background: rgb(0 0 0 / 50%);
}

View File

@ -38,6 +38,7 @@ interface ArticleCardProps {
isSingle?: boolean isSingle?: boolean
isBeside?: boolean isBeside?: boolean
withViewed?: boolean withViewed?: boolean
noAuthorLink?: boolean
} }
article: Shout article: Shout
} }
@ -176,7 +177,7 @@ export const ArticleCard = (props: ArticleCardProps) => {
hideWriteButton={true} hideWriteButton={true}
hideFollow={true} hideFollow={true}
isFeedMode={true} isFeedMode={true}
hasLink={props.settings?.isFeedMode} hasLink={!props.settings?.noAuthorLink}
/> />
) )
}} }}

View File

@ -2,13 +2,16 @@ import { Show } from 'solid-js'
import type { Shout } from '../../graphql/types.gen' import type { Shout } from '../../graphql/types.gen'
import { ArticleCard } from './ArticleCard' import { ArticleCard } from './ArticleCard'
export const Row1 = (props: { article: Shout; nodate?: boolean }) => ( export const Row1 = (props: { article: Shout; nodate?: boolean; noAuthorLink?: boolean }) => (
<Show when={!!props.article}> <Show when={!!props.article}>
<div class="floor floor--one-article"> <div class="floor floor--one-article">
<div class="wide-container"> <div class="wide-container">
<div class="row"> <div class="row">
<div class="col-24"> <div class="col-24">
<ArticleCard article={props.article} settings={{ isSingle: true, nodate: props.nodate }} /> <ArticleCard
article={props.article}
settings={{ isSingle: true, nodate: props.nodate, noAuthorLink: props.noAuthorLink }}
/>
</div> </div>
</div> </div>
</div> </div>

View File

@ -8,7 +8,12 @@ const x = [
['16', '8'] ['16', '8']
] ]
export const Row2 = (props: { articles: Shout[]; isEqual?: boolean; nodate?: boolean }) => { export const Row2 = (props: {
articles: Shout[]
isEqual?: boolean
nodate?: boolean
noAuthorLink?: boolean
}) => {
const [y, setY] = createSignal(0) const [y, setY] = createSignal(0)
createComputed(() => setY(Math.floor(Math.random() * x.length))) createComputed(() => setY(Math.floor(Math.random() * x.length)))
@ -26,7 +31,8 @@ export const Row2 = (props: { articles: Shout[]; isEqual?: boolean; nodate?: boo
article={a} article={a}
settings={{ settings={{
isWithCover: props.isEqual || x[y()][i()] === '16', isWithCover: props.isEqual || x[y()][i()] === '16',
nodate: props.isEqual || props.nodate nodate: props.isEqual || props.nodate,
noAuthorLink: props.noAuthorLink
}} }}
/> />
</div> </div>

View File

@ -3,7 +3,12 @@ import { For } from 'solid-js'
import type { Shout } from '../../graphql/types.gen' import type { Shout } from '../../graphql/types.gen'
import { ArticleCard } from './ArticleCard' import { ArticleCard } from './ArticleCard'
export const Row3 = (props: { articles: Shout[]; header?: JSX.Element; nodate?: boolean }) => { export const Row3 = (props: {
articles: Shout[]
header?: JSX.Element
nodate?: boolean
noAuthorLink?: boolean
}) => {
return ( return (
<div class="floor"> <div class="floor">
<div class="wide-container"> <div class="wide-container">
@ -12,7 +17,10 @@ export const Row3 = (props: { articles: Shout[]; header?: JSX.Element; nodate?:
<For each={props.articles}> <For each={props.articles}>
{(a) => ( {(a) => (
<div class="col-md-8"> <div class="col-md-8">
<ArticleCard article={a} settings={{ nodate: props.nodate }} /> <ArticleCard
article={a}
settings={{ nodate: props.nodate, noAuthorLink: props.noAuthorLink }}
/>
</div> </div>
)} )}
</For> </For>

View File

@ -285,22 +285,22 @@ export const AuthorView = (props: AuthorProps) => {
</div> </div>
</Match> </Match>
<Match when={searchParams().by === 'rating'}> <Match when={searchParams().by === 'rating'}>
<Row1 article={sortedArticles()[0]} /> <Row1 article={sortedArticles()[0]} noAuthorLink={true} />
<Row2 articles={sortedArticles().slice(1, 3)} isEqual={true} /> <Row2 articles={sortedArticles().slice(1, 3)} isEqual={true} noAuthorLink={true} />
<Row1 article={sortedArticles()[3]} /> <Row1 article={sortedArticles()[3]} noAuthorLink={true} />
<Row2 articles={sortedArticles().slice(4, 6)} isEqual={true} /> <Row2 articles={sortedArticles().slice(4, 6)} isEqual={true} noAuthorLink={true} />
<Row1 article={sortedArticles()[6]} /> <Row1 article={sortedArticles()[6]} noAuthorLink={true} />
<Row2 articles={sortedArticles().slice(7, 9)} isEqual={true} /> <Row2 articles={sortedArticles().slice(7, 9)} isEqual={true} noAuthorLink={true} />
<For each={pages()}> <For each={pages()}>
{(page) => ( {(page) => (
<> <>
<Row1 article={page[0]} /> <Row1 article={page[0]} noAuthorLink={true} />
<Row2 articles={page.slice(1, 3)} isEqual={true} /> <Row2 articles={page.slice(1, 3)} isEqual={true} noAuthorLink={true} />
<Row1 article={page[3]} /> <Row1 article={page[3]} noAuthorLink={true} />
<Row2 articles={page.slice(4, 6)} isEqual={true} /> <Row2 articles={page.slice(4, 6)} isEqual={true} noAuthorLink={true} />
<Row1 article={page[6]} /> <Row1 article={page[6]} noAuthorLink={true} />
<Row2 articles={page.slice(7, 9)} isEqual={true} /> <Row2 articles={page.slice(7, 9)} isEqual={true} noAuthorLink={true} />
</> </>
)} )}
</For> </For>