From 605d510e54d1e89422fda9e137d8b4851896346d Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 28 Dec 2023 02:35:43 +0300 Subject: [PATCH] rating-view-fix --- .../Author/AuthorCard/AuthorCard.tsx | 2 +- src/components/Author/AuthorShoutsRating.tsx | 25 +++++++++++++++++++ src/components/Views/Author/Author.tsx | 6 ++--- 3 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 src/components/Author/AuthorShoutsRating.tsx diff --git a/src/components/Author/AuthorCard/AuthorCard.tsx b/src/components/Author/AuthorCard/AuthorCard.tsx index 040e0054..ef7bfa87 100644 --- a/src/components/Author/AuthorCard/AuthorCard.tsx +++ b/src/components/Author/AuthorCard/AuthorCard.tsx @@ -281,7 +281,7 @@ export const AuthorCard = (props: Props) => {
  • {props.following.filter((s) => 'name' in s).length} diff --git a/src/components/Author/AuthorShoutsRating.tsx b/src/components/Author/AuthorShoutsRating.tsx new file mode 100644 index 00000000..1d36e493 --- /dev/null +++ b/src/components/Author/AuthorShoutsRating.tsx @@ -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 ( +
    + {props.author?.stat?.rating_shouts} +
    + ) +} diff --git a/src/components/Views/Author/Author.tsx b/src/components/Views/Author/Author.tsx index f9f8a49b..cd81ff8d 100644 --- a/src/components/Views/Author/Author.tsx +++ b/src/components/Views/Author/Author.tsx @@ -17,7 +17,7 @@ import { splitToPages } from '../../../utils/splitToPages' import { Loading } from '../../_shared/Loading' import { Comment } from '../../Article/Comment' import { AuthorCard } from '../../Author/AuthorCard' -import { AuthorRatingControl } from '../../Author/AuthorRatingControl' +import { AuthorShoutsRating } from '../../Author/AuthorShoutsRating' import { Row1 } from '../../Feed/Row1' import { Row2 } from '../../Feed/Row2' import { Row3 } from '../../Feed/Row3' @@ -187,10 +187,10 @@ export const AuthorView = (props: Props) => {
    - +
    {t('Karma')} - +