This commit is contained in:
parent
5bd7483e4e
commit
605d510e54
|
@ -281,7 +281,7 @@ export const AuthorCard = (props: Props) => {
|
||||||
</li>
|
</li>
|
||||||
<li class={clsx({ 'view-switcher__item--selected': subscriptionFilter() === 'users' })}>
|
<li class={clsx({ 'view-switcher__item--selected': subscriptionFilter() === 'users' })}>
|
||||||
<button type="button" onClick={() => setSubscriptionFilter('users')}>
|
<button type="button" onClick={() => setSubscriptionFilter('users')}>
|
||||||
{t('Users')}
|
{t('Authors')}
|
||||||
</button>
|
</button>
|
||||||
<span class="view-switcher__counter">
|
<span class="view-switcher__counter">
|
||||||
{props.following.filter((s) => 'name' in s).length}
|
{props.following.filter((s) => 'name' in s).length}
|
||||||
|
|
25
src/components/Author/AuthorShoutsRating.tsx
Normal file
25
src/components/Author/AuthorShoutsRating.tsx
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import type { Author } from '../../graphql/schema/core.gen'
|
||||||
|
|
||||||
|
import { clsx } from 'clsx'
|
||||||
|
import { createMemo } from 'solid-js'
|
||||||
|
|
||||||
|
import styles from './AuthorRatingControl.module.scss'
|
||||||
|
|
||||||
|
interface AuthorShoutsRating {
|
||||||
|
author: Author
|
||||||
|
class?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const AuthorShoutsRating = (props: AuthorShoutsRating) => {
|
||||||
|
const isUpvoted = createMemo(() => props.author?.stat?.rating_shouts > 0)
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
class={clsx(styles.rating, props.class, {
|
||||||
|
[styles.isUpvoted]: isUpvoted(),
|
||||||
|
[styles.isDownvoted]: !isUpvoted(),
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<span class={styles.ratingValue}>{props.author?.stat?.rating_shouts}</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
|
@ -17,7 +17,7 @@ import { splitToPages } from '../../../utils/splitToPages'
|
||||||
import { Loading } from '../../_shared/Loading'
|
import { Loading } from '../../_shared/Loading'
|
||||||
import { Comment } from '../../Article/Comment'
|
import { Comment } from '../../Article/Comment'
|
||||||
import { AuthorCard } from '../../Author/AuthorCard'
|
import { AuthorCard } from '../../Author/AuthorCard'
|
||||||
import { AuthorRatingControl } from '../../Author/AuthorRatingControl'
|
import { AuthorShoutsRating } from '../../Author/AuthorShoutsRating'
|
||||||
import { Row1 } from '../../Feed/Row1'
|
import { Row1 } from '../../Feed/Row1'
|
||||||
import { Row2 } from '../../Feed/Row2'
|
import { Row2 } from '../../Feed/Row2'
|
||||||
import { Row3 } from '../../Feed/Row3'
|
import { Row3 } from '../../Feed/Row3'
|
||||||
|
@ -187,10 +187,10 @@ export const AuthorView = (props: Props) => {
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class={clsx('col-md-8', styles.additionalControls)}>
|
<div class={clsx('col-md-8', styles.additionalControls)}>
|
||||||
<Show when={props.author?.stat?.rating}>
|
<Show when={props.author?.stat?.rating || props.author?.stat?.rating === 0}>
|
||||||
<div class={styles.ratingContainer}>
|
<div class={styles.ratingContainer}>
|
||||||
{t('Karma')}
|
{t('Karma')}
|
||||||
<AuthorRatingControl author={props.author} class={styles.ratingControl} />
|
<AuthorShoutsRating author={props.author} class={styles.ratingControl} />
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user