Code style fixes

This commit is contained in:
kvakazyambra 2024-05-11 20:33:40 +03:00
parent 0664b5c933
commit 7d69c55963
3 changed files with 28 additions and 19 deletions

View File

@ -3,11 +3,11 @@ import { For, Show } from 'solid-js'
import { useLocalize } from '../../../context/localize'
import { useSession } from '../../../context/session'
import { Icon } from '../../_shared/Icon'
import styles from './Placeholder.module.scss'
import {Icon} from "../../_shared/Icon";
export type PlaceholderProps = {
type: string,
type: string
mode: 'feed' | 'profile'
}
@ -46,9 +46,9 @@ export const Placeholder = (props: PlaceholderProps) => {
profileLinks: [
{
href: '/how-to-write-a-good-article',
label: t('How to write a good article')
}
]
label: t('How to write a good article'),
},
],
},
authorComments: {
image: 'placeholder-discussions.webp',
@ -59,25 +59,31 @@ export const Placeholder = (props: PlaceholderProps) => {
profileLinks: [
{
href: '/about/discussion-rules',
label: t('Discussion rules')
label: t('Discussion rules'),
},
{
href: '/about/discussion-rules#ban',
label: t('Block rules')
}
]
label: t('Block rules'),
},
],
},
}
return (
<div class={clsx(styles.placeholder, styles[`placeholder--${props.type}`], styles[`placeholder--${props.mode}-mode`])}>
<div
class={clsx(
styles.placeholder,
styles[`placeholder--${props.type}`],
styles[`placeholder--${props.mode}-mode`],
)}
>
<div class={styles.placeholderCover}>
<img src={`/public/${data[props.type].image}`} />
</div>
<div class={styles.placeholderContent}>
<div>
<h3 innerHTML={data[props.type].header}/>
<p innerHTML={data[props.type].text}/>
<h3 innerHTML={data[props.type].header} />
<p innerHTML={data[props.type].text} />
</div>
<Show when={data[props.type].profileLinks}>
@ -85,7 +91,7 @@ export const Placeholder = (props: PlaceholderProps) => {
<For each={data[props.type].profileLinks}>
{(link) => (
<a href={link.href}>
<Icon name="link-white" class={styles.icon}/>
<Icon name="link-white" class={styles.icon} />
{link.label}
</a>
)}
@ -104,7 +110,7 @@ export const Placeholder = (props: PlaceholderProps) => {
<a class={styles.button} href={data[props.type].href}>
{data[props.type].buttonLabel}
<Show when={props.mode === 'profile'}>
<Icon name="arrow-right-2" class={styles.icon}/>
<Icon name="arrow-right-2" class={styles.icon} />
</Show>
</a>
</Show>

View File

@ -27,8 +27,8 @@ import { Loading } from '../../_shared/Loading'
import { MODALS, hideModal } from '../../../stores/ui'
import { byCreated } from '../../../utils/sortby'
import stylesArticle from '../../Article/Article.module.scss'
import { Placeholder } from '../../Feed/Placeholder'
import styles from './Author.module.scss'
import {Placeholder} from "../../Feed/Placeholder";
type Props = {
authorSlug: string
@ -264,7 +264,6 @@ export const AuthorView = (props: Props) => {
<Placeholder type={getPage().route} mode="profile" />
</div>
<div class="wide-container">
<div class="row">
<div class="col-md-20 col-lg-18">
@ -285,7 +284,9 @@ export const AuthorView = (props: Props) => {
</div>
</Match>
<Match when={getPage().route === 'author'}>
<Show when={session()?.user?.app_data?.profile?.slug === props.authorSlug && !sortedArticles().length}>
<Show
when={session()?.user?.app_data?.profile?.slug === props.authorSlug && !sortedArticles().length}
>
<div class="wide-container">
<Placeholder type={getPage().route} mode="profile" />
</div>

View File

@ -235,8 +235,10 @@ export const FeedView = (props: Props) => {
</div>
<div class="col-md-12 offset-xl-1">
<Show when={author() || !sortedArticles().length}
fallback={<Placeholder type={page().route} mode="feed" />}>
<Show
when={author() || !sortedArticles().length}
fallback={<Placeholder type={page().route} mode="feed" />}
>
<div class={styles.filtersContainer}>
<ul class={clsx('view-switcher', styles.feedFilter)}>
<li