From cada98f135ca21c4942cd29b614d6264f9d840af Mon Sep 17 00:00:00 2001 From: Untone Date: Thu, 6 Jun 2024 08:44:59 +0300 Subject: [PATCH] refactoring: subscribe-term separated to newsletter and following --- src/components/Article/Comment/Comment.tsx | 2 +- .../Author/AuthorCard/AuthorCard.tsx | 4 +- src/components/Discours/Footer.tsx | 4 +- src/components/Nav/Header/Header.tsx | 4 +- src/components/Nav/ProfilePopup.tsx | 6 +- src/components/Topic/Full.tsx | 4 +- src/components/Views/Author/Author.tsx | 87 +++++++------------ .../FollowingCounters.module.scss} | 0 .../FollowingCounters.tsx} | 4 +- .../_shared/FollowingCounters/index.ts | 1 + .../Newsletter.module.scss} | 0 .../Newsletter.tsx} | 4 +- src/components/_shared/Newsletter/index.ts | 1 + src/components/_shared/Subscribe/index.ts | 1 - src/components/_shared/Subscribers/index.ts | 1 - src/context/session.tsx | 52 ++++++----- src/graphql/query/core/author-followers.ts | 2 +- src/pages/about/manifest.page.tsx | 4 +- 18 files changed, 84 insertions(+), 97 deletions(-) rename src/components/_shared/{Subscribers/Subscribers.module.scss => FollowingCounters/FollowingCounters.module.scss} (100%) rename src/components/_shared/{Subscribers/Subscribers.tsx => FollowingCounters/FollowingCounters.tsx} (94%) create mode 100644 src/components/_shared/FollowingCounters/index.ts rename src/components/_shared/{Subscribe/Subscribe.module.scss => Newsletter/Newsletter.module.scss} (100%) rename src/components/_shared/{Subscribe/Subscribe.tsx => Newsletter/Newsletter.tsx} (97%) create mode 100644 src/components/_shared/Newsletter/index.ts delete mode 100644 src/components/_shared/Subscribe/index.ts delete mode 100644 src/components/_shared/Subscribers/index.ts diff --git a/src/components/Article/Comment/Comment.tsx b/src/components/Article/Comment/Comment.tsx index 5e94c4a8..a8854832 100644 --- a/src/components/Article/Comment/Comment.tsx +++ b/src/components/Article/Comment/Comment.tsx @@ -48,7 +48,7 @@ export const Comment = (props: Props) => { const canEdit = createMemo( () => Boolean(author()?.id) && - (props.comment?.created_by?.slug === author().slug || session()?.user?.roles.includes('editor')), + (props.comment?.created_by?.slug === author()?.slug || session()?.user?.roles.includes('editor')), ) const body = createMemo(() => (editedBody() ? editedBody().trim() : props.comment.body.trim() || '')) diff --git a/src/components/Author/AuthorCard/AuthorCard.tsx b/src/components/Author/AuthorCard/AuthorCard.tsx index 5df81631..9804b6e3 100644 --- a/src/components/Author/AuthorCard/AuthorCard.tsx +++ b/src/components/Author/AuthorCard/AuthorCard.tsx @@ -17,8 +17,8 @@ import { SharePopup, getShareUrl } from '../../Article/SharePopup' import { Modal } from '../../Nav/Modal' import { TopicBadge } from '../../Topic/TopicBadge' import { Button } from '../../_shared/Button' +import { FollowingCounters } from '../../_shared/FollowingCounters' import { ShowOnlyOnClient } from '../../_shared/ShowOnlyOnClient' -import { Subscribers } from '../../_shared/Subscribers' import { AuthorBadge } from '../AuthorBadge' import { Userpic } from '../Userpic' @@ -195,7 +195,7 @@ export const AuthorCard = (props: Props) => { 0 || props.flatFollows?.length > 0}>
- {
{t('Subscription')}

{t('Join our maillist')}

- +
diff --git a/src/components/Nav/Header/Header.tsx b/src/components/Nav/Header/Header.tsx index 680dd886..f161364d 100644 --- a/src/components/Nav/Header/Header.tsx +++ b/src/components/Nav/Header/Header.tsx @@ -11,7 +11,7 @@ import { useModalStore } from '../../../stores/ui' import { getDescription } from '../../../utils/meta' import { SharePopup, getShareUrl } from '../../Article/SharePopup' import { Icon } from '../../_shared/Icon' -import { Subscribe } from '../../_shared/Subscribe' +import { Newsletter } from '../../_shared/Newsletter' import { AuthModal } from '../AuthModal' import { ConfirmModal } from '../ConfirmModal' import { HeaderAuth } from '../HeaderAuth' @@ -301,7 +301,7 @@ export const Header = (props: Props) => {

{t('Newsletter')}

- +

{t('Language')}