From ff72695529b38fb792c2bfd10ca844f27f6d3316 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 8 Sep 2021 14:23:37 +0800 Subject: [PATCH 01/19] refactor(article-thread): extract ReadableDate Comp --- .../BlogItem/DesktopView/ActiveBadge.tsx | 31 ---------------- src/components/BlogItem/DesktopView/Body.tsx | 4 -- src/components/DigestSentence/styles/index.ts | 2 +- .../DigestSentence/styles/metric.ts | 2 +- .../PostItem/DesktopView/ActiveBadge.tsx | 19 +++++++--- .../styles/desktop_view/active_badge.ts | 10 ++++- .../PostItem/styles/desktop_view/header.ts | 6 +-- .../PostItem/styles/desktop_view/index.ts | 2 +- .../ReadableDate/AbsoluteFmt.tsx} | 24 ++++++------ src/components/ReadableDate/index.tsx | 37 +++++++++++++++++++ .../ReadableDate/styles/absolute_fmt.tsx} | 4 +- src/components/ReadableDate/styles/index.ts | 12 ++++++ .../ReadableDate/tests/index.test.ts | 10 +++++ .../Switcher/styles/tabs/tab_item.ts | 2 + .../TheAvatar/styles/post_item_avatar.ts | 2 +- .../DesktopView/PostLayout/index.tsx | 7 +++- .../digest/ArticleDigest/MobileView/index.tsx | 16 ++++---- .../styles/desktop_view/post_layout/index.ts | 4 ++ .../ArticleDigest/styles/mobile_view/index.ts | 4 ++ src/spec/article.ts | 1 + src/stores/Model/helper/article.ts | 1 + 21 files changed, 128 insertions(+), 72 deletions(-) delete mode 100644 src/components/BlogItem/DesktopView/ActiveBadge.tsx rename src/{containers/digest/ArticleDigest/DesktopView/PostLayout/PublishDate.tsx => components/ReadableDate/AbsoluteFmt.tsx} (56%) create mode 100755 src/components/ReadableDate/index.tsx rename src/{containers/digest/ArticleDigest/styles/desktop_view/post_layout/publish_date.ts => components/ReadableDate/styles/absolute_fmt.tsx} (70%) create mode 100755 src/components/ReadableDate/styles/index.ts create mode 100755 src/components/ReadableDate/tests/index.test.ts diff --git a/src/components/BlogItem/DesktopView/ActiveBadge.tsx b/src/components/BlogItem/DesktopView/ActiveBadge.tsx deleted file mode 100644 index abf84607b..000000000 --- a/src/components/BlogItem/DesktopView/ActiveBadge.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { FC } from 'react' - -import type { TArticle } from '@/spec' -import IconButton from '@/components/Buttons/IconButton' - -import { Wrapper, Hint } from '../styles/desktop_view/active_badge' - -type TProps = { - item: TArticle -} - -const ActiveBadge: FC = ({ item }) => { - const isArchived = item.commentsCount === 24 - const path = isArchived ? 'article/archived.svg' : 'shape/activity.svg' - - return ( - 0}> - 最后回复: 2020-03-11 14:33} - mRight={6} - hintPlacement="bottom" - hintDelay={0} - /> -
4天前
-
- ) -} - -export default ActiveBadge diff --git a/src/components/BlogItem/DesktopView/Body.tsx b/src/components/BlogItem/DesktopView/Body.tsx index af3fd66b5..12def1f25 100644 --- a/src/components/BlogItem/DesktopView/Body.tsx +++ b/src/components/BlogItem/DesktopView/Body.tsx @@ -12,8 +12,6 @@ import CommunityCard from '@/components/Cards/CommunityCard' import UserCard from '@/components/Cards/UserCard' import Tooltip from '@/components/Tooltip' -import ActiveBadge from './ActiveBadge' - import { Wrapper, Dot, @@ -66,8 +64,6 @@ const Body: FC = ({ item }) => { - - { } default: - return '13.5px' + return '13px' } } diff --git a/src/components/PostItem/DesktopView/ActiveBadge.tsx b/src/components/PostItem/DesktopView/ActiveBadge.tsx index abf84607b..1c9020e30 100644 --- a/src/components/PostItem/DesktopView/ActiveBadge.tsx +++ b/src/components/PostItem/DesktopView/ActiveBadge.tsx @@ -1,9 +1,11 @@ -import { FC } from 'react' +import { FC, memo } from 'react' +import TimeAgo from 'timeago-react' import type { TArticle } from '@/spec' import IconButton from '@/components/Buttons/IconButton' +import ReadableDate from '@/components/ReadableDate' -import { Wrapper, Hint } from '../styles/desktop_view/active_badge' +import { Wrapper, Hint, TimeStr } from '../styles/desktop_view/active_badge' type TProps = { item: TArticle @@ -18,14 +20,21 @@ const ActiveBadge: FC = ({ item }) => { 最后回复: 2020-03-11 14:33} + hint={ + +
最后回复时间:
+ + + +
+ } mRight={6} hintPlacement="bottom" hintDelay={0} /> -
4天前
+ ) } -export default ActiveBadge +export default memo(ActiveBadge) diff --git a/src/components/PostItem/styles/desktop_view/active_badge.ts b/src/components/PostItem/styles/desktop_view/active_badge.ts index dd32fe78f..2e95b963b 100644 --- a/src/components/PostItem/styles/desktop_view/active_badge.ts +++ b/src/components/PostItem/styles/desktop_view/active_badge.ts @@ -10,7 +10,7 @@ export const Wrapper = styled.div<{ hasComments: boolean }>` position: absolute; top: 6px; right: 0; - color: ${theme('thread.articleTitle')}; + color: ${theme('thread.articleDigest')}; margin-right: 1px; margin-top: 8px; @@ -20,6 +20,12 @@ export const Wrapper = styled.div<{ hasComments: boolean }>` transition: opacity 0.2s; ` export const Hint = styled.div` + ${css.flexColumn('align-start')}; + color: ${theme('thread.articleDigest')}; + width: 180px; + padding-left: 5px; + font-size: 13px; +` +export const TimeStr = styled.div` color: ${theme('thread.articleTitle')}; - width: 200px; ` diff --git a/src/components/PostItem/styles/desktop_view/header.ts b/src/components/PostItem/styles/desktop_view/header.ts index 561742a7d..e0a0e76d3 100644 --- a/src/components/PostItem/styles/desktop_view/header.ts +++ b/src/components/PostItem/styles/desktop_view/header.ts @@ -18,13 +18,13 @@ export const Title = styled.a` color: ${theme('thread.articleTitle')}; text-decoration: none; @media (max-width: 1450px) { - max-width: 500px; + ${css.cutRest('500px')}; } @media (max-width: 1250px) { - max-width: 450px; + ${css.cutRest('450px')}; } @media (max-width: 1100px) { - max-width: 350px; + ${css.cutRest('350px')}; } &:hover { diff --git a/src/components/PostItem/styles/desktop_view/index.ts b/src/components/PostItem/styles/desktop_view/index.ts index f060ca78a..b04466950 100644 --- a/src/components/PostItem/styles/desktop_view/index.ts +++ b/src/components/PostItem/styles/desktop_view/index.ts @@ -12,7 +12,7 @@ export const AvatarWrapper = styled.div` ${css.flexColumn('align-both')}; ` export const UpvoteWrapper = styled.div` - margin-top: 10px; + margin-top: 12px; margin-left: 3px; ` export const Avatar = styled(Img)` diff --git a/src/containers/digest/ArticleDigest/DesktopView/PostLayout/PublishDate.tsx b/src/components/ReadableDate/AbsoluteFmt.tsx similarity index 56% rename from src/containers/digest/ArticleDigest/DesktopView/PostLayout/PublishDate.tsx rename to src/components/ReadableDate/AbsoluteFmt.tsx index 8f86f90b7..bf62f7a3c 100644 --- a/src/containers/digest/ArticleDigest/DesktopView/PostLayout/PublishDate.tsx +++ b/src/components/ReadableDate/AbsoluteFmt.tsx @@ -1,28 +1,32 @@ import { FC, memo } from 'react' import { Space } from '@/components/Common' -import { Wrapper } from '../../styles/desktop_view/post_layout/publish_date' +import { Wrapper } from './styles/absolute_fmt' const calcRange = (hours) => { if (hours >= 0 && hours <= 6) return '凌晨' - return hours >= 12 ? '下午' : '上午' + return hours > 12 ? '下午' : '上午' } type TProps = { - insertedAt: string + datetime: string + className: string } -const PublishDate: FC = ({ insertedAt }) => { - const DateObj = new Date(insertedAt) +const AbsoluteFmt: FC = ({ datetime, className }) => { + const DateObj = new Date(datetime) const [month, date, year] = DateObj.toLocaleDateString().split('/') const hours = DateObj.getHours() const range = calcRange(hours) - const hour = hours >= 12 ? hours - 12 : hours + const hour = hours > 12 ? hours - 12 : hours return ( - + + {year} + + 年, {month} @@ -32,11 +36,9 @@ const PublishDate: FC = ({ insertedAt }) => { {range} {hour} - - 点,{year} - 年 + ) } -export default memo(PublishDate) +export default memo(AbsoluteFmt) diff --git a/src/components/ReadableDate/index.tsx b/src/components/ReadableDate/index.tsx new file mode 100755 index 000000000..1feffc09c --- /dev/null +++ b/src/components/ReadableDate/index.tsx @@ -0,0 +1,37 @@ +/* + * + * ReadableDate + * + */ + +import { FC, memo } from 'react' + +import { buildLog } from '@/utils/logger' + +import AbsoluteFmt from './AbsoluteFmt' +import { Wrapper } from './styles' + +/* eslint-disable-next-line */ +const log = buildLog('c:ReadableDate:index') + +type TProps = { + testid?: string + date: string + fmt?: 'relative' | 'absolute' + className?: string +} + +const ReadableDate: FC = ({ + testid = 'readable-date', + fmt = 'relative', + className = 'readable-date', + date, +}) => { + return ( + + + + ) +} + +export default memo(ReadableDate) diff --git a/src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/publish_date.ts b/src/components/ReadableDate/styles/absolute_fmt.tsx similarity index 70% rename from src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/publish_date.ts rename to src/components/ReadableDate/styles/absolute_fmt.tsx index 888856291..97399f8d4 100644 --- a/src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/publish_date.ts +++ b/src/components/ReadableDate/styles/absolute_fmt.tsx @@ -1,12 +1,10 @@ import styled from 'styled-components' -import { theme } from '@/utils/themes' +// import { theme } from '@/utils/themes' import css from '@/utils/css' export const Wrapper = styled.div` ${css.flex('align-center')}; - color: ${theme('thread.articleDigest')}; - font-size: 14px; ${css.media.mobile` font-size: 12px; diff --git a/src/components/ReadableDate/styles/index.ts b/src/components/ReadableDate/styles/index.ts new file mode 100755 index 000000000..74680fc67 --- /dev/null +++ b/src/components/ReadableDate/styles/index.ts @@ -0,0 +1,12 @@ +import styled from 'styled-components' + +import type { TTestable } from '@/spec' + +// import Img from '@/Img' +// import { theme } from '@/utils/themes' + +export const Wrapper = styled.div.attrs(({ testid }: TTestable) => ({ + 'data-test-id': testid, +}))`` + +export const Title = styled.div`` diff --git a/src/components/ReadableDate/tests/index.test.ts b/src/components/ReadableDate/tests/index.test.ts new file mode 100755 index 000000000..d8517ed24 --- /dev/null +++ b/src/components/ReadableDate/tests/index.test.ts @@ -0,0 +1,10 @@ +// import React from 'react' +// import { shallow } from 'enzyme' + +// import ReadableDate from '../index' + +describe('TODO ', () => { + it('Expect to have unit tests specified', () => { + expect(true).toEqual(true) + }) +}) diff --git a/src/components/Switcher/styles/tabs/tab_item.ts b/src/components/Switcher/styles/tabs/tab_item.ts index 0c86dd1c4..dc582eac7 100644 --- a/src/components/Switcher/styles/tabs/tab_item.ts +++ b/src/components/Switcher/styles/tabs/tab_item.ts @@ -71,6 +71,8 @@ export const Label = styled.span` active ? theme('thread.articleTitle') : theme('thread.articleDigest')}; margin-bottom: ${({ bottomSpace }) => `${bottomSpace}px`}; + opacity: ${({ active }) => (active ? 1 : 0.9)}; + &:hover { color: ${theme('thread.articleTitle')}; svg { diff --git a/src/components/TheAvatar/styles/post_item_avatar.ts b/src/components/TheAvatar/styles/post_item_avatar.ts index bf32a3834..8d364089b 100644 --- a/src/components/TheAvatar/styles/post_item_avatar.ts +++ b/src/components/TheAvatar/styles/post_item_avatar.ts @@ -10,7 +10,7 @@ export const Wrapper = styled.div` cursor: pointer; ${css.circle(32)}; position: relative; - margin-top: 6px; + margin-top: 3px; ` export const InnerShadow = styled.div` position: absolute; diff --git a/src/containers/digest/ArticleDigest/DesktopView/PostLayout/index.tsx b/src/containers/digest/ArticleDigest/DesktopView/PostLayout/index.tsx index 4f913acc1..dd10a7b84 100644 --- a/src/containers/digest/ArticleDigest/DesktopView/PostLayout/index.tsx +++ b/src/containers/digest/ArticleDigest/DesktopView/PostLayout/index.tsx @@ -13,13 +13,14 @@ import ArticleBaseStats from '@/components/ArticleBaseStats' import DotDivider from '@/components/DotDivider' import ArchivedSign from '@/components/ArchivedSign' import ArticleMenu from '@/components/ArticleMenu' +import ReadableDate from '@/components/ReadableDate' import OriginalCommunity from './OriginalCommunity' -import PublishDate from './PublishDate' import { Main, Header, + PublishDateInfo, Title, AuthorName, BottomInfo, @@ -39,7 +40,9 @@ const PostLayout: FC = ({ metric = METRIC.ARTICLE, article }) => {
- + + + {article.isArchived && ( diff --git a/src/containers/digest/ArticleDigest/MobileView/index.tsx b/src/containers/digest/ArticleDigest/MobileView/index.tsx index 4dabaa33f..58e50fbae 100644 --- a/src/containers/digest/ArticleDigest/MobileView/index.tsx +++ b/src/containers/digest/ArticleDigest/MobileView/index.tsx @@ -14,14 +14,14 @@ import { pluggedIn } from '@/utils/mobx' import ArticleBaseStats from '@/components/ArticleBaseStats' import ViewportTracker from '@/components/ViewportTracker' - -import PublishDate from '../DesktopView/PostLayout/PublishDate' +import ReadableDate from '@/components/ReadableDate' import type { TStore } from '../store' import { Wrapper, InnerWrapper, BannerContent, + PublishDateInfo, Title, Brief, } from '../styles/mobile_view/index' @@ -38,18 +38,20 @@ const ArticleDigestContainer: FC = ({ articleDigest: store }) => { const { direction: scrollDirection } = useScroll() useInit(store, scrollDirection as TScrollDirection) - const { viewingArticle } = store + const { viewingArticle: article } = store - if (isNil(viewingArticle.id)) return null + if (isNil(article.id)) return null return ( - - {viewingArticle.title} - + + + + {article.title} + diff --git a/src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/index.ts b/src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/index.ts index 64a23b8f6..aac64da06 100644 --- a/src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/index.ts +++ b/src/containers/digest/ArticleDigest/styles/desktop_view/post_layout/index.ts @@ -13,6 +13,10 @@ export const Header = styled.div` ${css.flex('align-center')}; margin-bottom: 8px; ` +export const PublishDateInfo = styled.div` + font-size: 14px; + color: ${theme('thread.articleDigest')}; +` export const CommunityInfo = styled.div` ${css.flex('align-start', 'justify-center')}; margin-top: 5px; diff --git a/src/containers/digest/ArticleDigest/styles/mobile_view/index.ts b/src/containers/digest/ArticleDigest/styles/mobile_view/index.ts index a0d6d2dbe..4195019aa 100644 --- a/src/containers/digest/ArticleDigest/styles/mobile_view/index.ts +++ b/src/containers/digest/ArticleDigest/styles/mobile_view/index.ts @@ -22,6 +22,10 @@ export const Title = styled.div` color: ${theme('thread.articleTitle')}; margin-bottom: 10px; ` +export const PublishDateInfo = styled.div` + font-size: 12px; + color: ${theme('thread.articleDigest')}; +` export const BannerContent = styled.div` ${css.flex()}; height: 100%; diff --git a/src/spec/article.ts b/src/spec/article.ts index a626a2fe4..37db4262c 100644 --- a/src/spec/article.ts +++ b/src/spec/article.ts @@ -43,6 +43,7 @@ type TBaseArticle = { linkAddr?: string isArchived?: boolean archivedAt?: string + activeAt?: string } export type TPost = TBaseArticle & { diff --git a/src/stores/Model/helper/article.ts b/src/stores/Model/helper/article.ts index dfd102ea0..3da6a2dc3 100644 --- a/src/stores/Model/helper/article.ts +++ b/src/stores/Model/helper/article.ts @@ -64,6 +64,7 @@ export const articleFields = () => { insertedAt: T.optional(T.string, ''), updatedAt: T.optional(T.string, ''), + activeAt: T.optional(T.string, ''), } } From f7f5a0a3708061a8ea364fa1d75ac4115cebb3f9 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Wed, 8 Sep 2021 21:27:29 +0800 Subject: [PATCH 02/19] refactor(comments): debug wip --- .../{ArticleBody => ArtimentBody}/FoldBox.tsx | 7 +- .../{ArticleBody => ArtimentBody}/index.tsx | 13 ++- .../styles/fold_box.ts | 4 +- .../styles/index.ts | 1 + .../tests/index.test.ts | 4 +- src/components/PostItem/DesktopView/Body.tsx | 2 +- .../styles/desktop_view/active_badge.ts | 6 -- .../ArticleContent/DesktopView/index.tsx | 4 +- .../ArticleDigest/DesktopView/FixedHeader.tsx | 4 +- .../Comment/DesktopView/DefaultLayout.tsx | 9 +- .../Comment/DesktopView/FoldLayout.tsx | 2 +- .../unit/Comments/Comment/Header.tsx | 20 +++- .../unit/Comments/Comment/ReplyBar.tsx | 3 +- src/containers/unit/Comments/ReplyToBar.tsx | 2 +- src/containers/unit/Comments/index.tsx | 33 +++--- src/containers/unit/Comments/logic.ts | 16 ++- src/containers/unit/Comments/schema.ts | 26 ++--- .../unit/Comments/styles/comment/header.ts | 5 +- .../user/UserPublishedComments/logic.js | 52 +-------- .../user/UserPublishedComments/schema.ts | 32 ------ .../user/UserPublishedComments/store.js | 36 +------ .../ArticleViewer/BlogViewer/FixedHeader.tsx | 4 +- .../viewer/ArticleViewer/BlogViewer/index.tsx | 2 +- .../ArticleViewer/PostViewer/FixedHeader.tsx | 4 +- .../viewer/ArticleViewer/PostViewer/index.tsx | 2 +- .../ArticleViewer/WorksViewer/FixedHeader.tsx | 4 +- .../ArticleViewer/WorksViewer/index.tsx | 2 +- src/containers/viewer/ArticleViewer/index.tsx | 5 +- src/schemas/fragments/base.ts | 36 +++++-- src/spec/article.ts | 7 +- src/stores/Model/Comment.ts | 101 ++++-------------- src/stores/Model/index.ts | 8 +- 32 files changed, 164 insertions(+), 292 deletions(-) rename src/components/{ArticleBody => ArtimentBody}/FoldBox.tsx (79%) rename src/components/{ArticleBody => ArtimentBody}/index.tsx (87%) rename src/components/{ArticleBody => ArtimentBody}/styles/fold_box.ts (86%) rename src/components/{ArticleBody => ArtimentBody}/styles/index.ts (97%) rename src/components/{ArticleBody => ArtimentBody}/tests/index.test.ts (66%) diff --git a/src/components/ArticleBody/FoldBox.tsx b/src/components/ArtimentBody/FoldBox.tsx similarity index 79% rename from src/components/ArticleBody/FoldBox.tsx rename to src/components/ArtimentBody/FoldBox.tsx index 200519321..5a81d39f4 100644 --- a/src/components/ArticleBody/FoldBox.tsx +++ b/src/components/ArtimentBody/FoldBox.tsx @@ -5,21 +5,22 @@ import { Wrapper, Hint, FoldHint, ArrowIcon } from './styles/fold_box' type TProps = { fold: boolean + mode: 'article' | 'comment' onFold: () => void onExpand: () => void } -const FoldBox: FC = ({ fold, onFold, onExpand }) => { +const FoldBox: FC = ({ fold, onFold, onExpand, mode }) => { return ( (fold ? onExpand() : onFold())}> {!fold && ( - + 折叠 )} {fold && ( - + 展开全部 diff --git a/src/components/ArticleBody/index.tsx b/src/components/ArtimentBody/index.tsx similarity index 87% rename from src/components/ArticleBody/index.tsx rename to src/components/ArtimentBody/index.tsx index daf8da938..0a1aa97b0 100755 --- a/src/components/ArticleBody/index.tsx +++ b/src/components/ArtimentBody/index.tsx @@ -1,6 +1,6 @@ /* eslint-disable react/no-danger */ /* - * ArticleBody + * ArtimentBody */ import { FC, memo, useRef, useState, useEffect } from 'react' @@ -13,19 +13,21 @@ import { Br } from '@/components/Common' import { Wrapper, Body, HTML } from './styles' /* eslint-disable-next-line */ -const log = buildLog('c:ArticleBody:index') +const log = buildLog('c:ArtimentBody:index') type TProps = { testid?: string document: TDocument // 超过多行就默认折叠 initLineClampNum?: number + mode?: 'article' | 'comment' } -const ArticleBody: FC = ({ +const ArtimentBody: FC = ({ testid = 'article-body', document, initLineClampNum = 5, + mode = 'article', }) => { const bodyRef = useRef(null) const [fold, setFold] = useState(false) @@ -61,6 +63,7 @@ const ArticleBody: FC = ({ {needFold ? ( { setLineClampNum(initLineClampNum) setFold(true) @@ -71,10 +74,10 @@ const ArticleBody: FC = ({ }} /> ) : ( -
+
)}
) } -export default memo(ArticleBody) +export default memo(ArtimentBody) diff --git a/src/components/ArticleBody/styles/fold_box.ts b/src/components/ArtimentBody/styles/fold_box.ts similarity index 86% rename from src/components/ArticleBody/styles/fold_box.ts rename to src/components/ArtimentBody/styles/fold_box.ts index 0b2adec32..d81c90901 100755 --- a/src/components/ArticleBody/styles/fold_box.ts +++ b/src/components/ArtimentBody/styles/fold_box.ts @@ -20,10 +20,10 @@ export const Wrapper = styled.div<{ fold: boolean }>` transition: all 0.2s; ` -export const Hint = styled.div` +export const Hint = styled.div<{ mode: 'article' | 'comment' }>` ${css.flex('align-center')}; color: #139c9e; - font-size: 15px; + font-size: ${({ mode }) => (mode === 'article' ? '15px' : '13px')}; opacity: 0.8; ${Wrapper}:hover & { diff --git a/src/components/ArticleBody/styles/index.ts b/src/components/ArtimentBody/styles/index.ts similarity index 97% rename from src/components/ArticleBody/styles/index.ts rename to src/components/ArtimentBody/styles/index.ts index 51b191999..052e70af5 100755 --- a/src/components/ArticleBody/styles/index.ts +++ b/src/components/ArtimentBody/styles/index.ts @@ -21,4 +21,5 @@ export const Body = styled.div<{ lineClampNum: number }>` ` export const HTML = styled.div` color: ${theme('thread.articleTitle')}; + opacity: 0.9; ` diff --git a/src/components/ArticleBody/tests/index.test.ts b/src/components/ArtimentBody/tests/index.test.ts similarity index 66% rename from src/components/ArticleBody/tests/index.test.ts rename to src/components/ArtimentBody/tests/index.test.ts index dd1b0538f..526d09e05 100755 --- a/src/components/ArticleBody/tests/index.test.ts +++ b/src/components/ArtimentBody/tests/index.test.ts @@ -1,9 +1,9 @@ // import React from 'react' // import { shallow } from 'enzyme' -// import ArticleBody from '../index' +// import ArtimentBody from '../index' -describe('TODO ', () => { +describe('TODO ', () => { it('Expect to have unit tests specified', () => { expect(true).toEqual(true) }) diff --git a/src/components/PostItem/DesktopView/Body.tsx b/src/components/PostItem/DesktopView/Body.tsx index 11e4bd342..9d36be621 100644 --- a/src/components/PostItem/DesktopView/Body.tsx +++ b/src/components/PostItem/DesktopView/Body.tsx @@ -71,7 +71,7 @@ const Body: FC = ({ item }) => { send(EVENT.PREVIEW_ARTICLE, { article: item })} > diff --git a/src/components/PostItem/styles/desktop_view/active_badge.ts b/src/components/PostItem/styles/desktop_view/active_badge.ts index 2e95b963b..f4423c683 100644 --- a/src/components/PostItem/styles/desktop_view/active_badge.ts +++ b/src/components/PostItem/styles/desktop_view/active_badge.ts @@ -2,7 +2,6 @@ import styled from 'styled-components' import { theme } from '@/utils/themes' import css from '@/utils/css' -import { Main } from './index' export const Wrapper = styled.div<{ hasComments: boolean }>` ${css.flex('align-center')}; @@ -13,11 +12,6 @@ export const Wrapper = styled.div<{ hasComments: boolean }>` color: ${theme('thread.articleDigest')}; margin-right: 1px; margin-top: 8px; - - ${Main}:hover & { - color: ${theme('thread.articleTitle')}; - } - transition: opacity 0.2s; ` export const Hint = styled.div` ${css.flexColumn('align-start')}; diff --git a/src/containers/content/ArticleContent/DesktopView/index.tsx b/src/containers/content/ArticleContent/DesktopView/index.tsx index d073a96c6..5fc18e2d3 100644 --- a/src/containers/content/ArticleContent/DesktopView/index.tsx +++ b/src/containers/content/ArticleContent/DesktopView/index.tsx @@ -12,7 +12,7 @@ import { buildLog } from '@/utils/logger' import { pluggedIn } from '@/utils/mobx' import ArticleSticker from '@/containers/tool/ArticleSticker' -import ArticleBody from '@/components/ArticleBody' +import ArtimentBody from '@/components/ArtimentBody' // import ArticleFooter from '@/containers/unit/ArticleFooter' import ViewportTracker from '@/components/ViewportTracker' @@ -74,7 +74,7 @@ const ArticleContentContainer: FC = ({ /> - + diff --git a/src/containers/digest/ArticleDigest/DesktopView/FixedHeader.tsx b/src/containers/digest/ArticleDigest/DesktopView/FixedHeader.tsx index d6cea34c7..64f2c10e2 100644 --- a/src/containers/digest/ArticleDigest/DesktopView/FixedHeader.tsx +++ b/src/containers/digest/ArticleDigest/DesktopView/FixedHeader.tsx @@ -50,6 +50,8 @@ const FixedHeader: FC = ({ metric = METRIC.ARTICLE, testid = 'article-fixed-header', }) => { + const { upvotesCount, meta } = article + return ( @@ -57,7 +59,7 @@ const FixedHeader: FC = ({ - + diff --git a/src/containers/unit/Comments/Comment/DesktopView/DefaultLayout.tsx b/src/containers/unit/Comments/Comment/DesktopView/DefaultLayout.tsx index d0ff542b6..152f3c5b4 100644 --- a/src/containers/unit/Comments/Comment/DesktopView/DefaultLayout.tsx +++ b/src/containers/unit/Comments/Comment/DesktopView/DefaultLayout.tsx @@ -5,9 +5,9 @@ import type { TAccount, TComment } from '@/spec' import { Global } from '@/utils/helper' import { ICON } from '@/config' -import MarkDownRender from '@/components/MarkDownRender' import Tooltip from '@/components/Tooltip' import Upvote from '@/components/Upvote' +import ArtimentBody from '@/components/ArtimentBody' import Header from '../Header' import ReplyBar from '../ReplyBar' @@ -66,7 +66,7 @@ const DefaultLayout: FC = ({ - + {isAuthorUpvoted && ( 作者顶过} @@ -95,7 +95,10 @@ const DefaultLayout: FC = ({
{data.replyTo && } - +