From 9848e5174aa78d79d9b5cc19c0dc1eb3e6373ac0 Mon Sep 17 00:00:00 2001 From: mydearxym Date: Sat, 6 Mar 2021 17:51:03 +0800 Subject: [PATCH] chore(constant): use HCN stands for 'home' --- src/components/CommunityFaceLogo/index.js | 5 +++-- src/components/JobItem/JobInfo.js | 4 ++-- src/components/PostItem/index.js | 4 ++-- src/components/TabBar/DesktopView/index.js | 4 ++-- src/containers/content/DiscoveryContent/SubscribeBtn.js | 3 ++- src/containers/content/RecipesContent/Snippets/index.js | 4 ++-- .../digest/CommunityDigest/DigestView/ColumnView/index.js | 6 +++--- .../digest/CommunityDigest/DigestView/RowView/index.js | 4 ++-- .../CommunityDigest/styles/digest_view/column_view/index.js | 5 +++-- src/containers/thread/JobsThread/logic.js | 4 ++-- src/containers/tool/CommunityJoinBadge/SubscribeBtn.js | 4 +++- src/containers/unit/Sidebar/MenuList/index.js | 3 ++- src/containers/unit/Sidebar/RealSidebar.js | 4 ++-- src/containers/unit/Sidebar/logic.js | 4 ++-- utils/constant/index.js | 3 +++ utils/ssr.js | 6 ++++-- 16 files changed, 39 insertions(+), 28 deletions(-) diff --git a/src/components/CommunityFaceLogo/index.js b/src/components/CommunityFaceLogo/index.js index 3c871b83c..5742dfe7e 100755 --- a/src/components/CommunityFaceLogo/index.js +++ b/src/components/CommunityFaceLogo/index.js @@ -8,6 +8,7 @@ import React from 'react' import T from 'prop-types' import { isEmpty } from 'ramda' +import { HCN } from '@/constant' import { ICON_BASE } from '@/config' import { buildLog } from '@/utils' @@ -17,7 +18,7 @@ import { Logo } from './styles' const log = buildLog('c:CommunityFaceLogo:index') const CommunityFaceLogo = ({ noFill, src, raw, loading, className }) => { - if (raw === 'home' || isEmpty(src)) { + if (raw === HCN || isEmpty(src)) { return ( {cutFrom(title, 30)} - + diff --git a/src/components/PostItem/index.js b/src/components/PostItem/index.js index 7fc33e42f..c38dc5c59 100755 --- a/src/components/PostItem/index.js +++ b/src/components/PostItem/index.js @@ -7,7 +7,7 @@ import React from 'react' import T from 'prop-types' -import { C11N } from '@/constant' +import { HCN, C11N } from '@/constant' import { buildLog } from '@/utils' import ArticleItemPrefixLabel from '@/components/ArticleItemPrefixLabel' @@ -99,7 +99,7 @@ PostItem.defaultProps = { onAuthorSelect: log, active: {}, cover: 'avatar', - community: 'home', + community: HCN, accountInfo: { isLogin: false, customization: T.shape({ diff --git a/src/components/TabBar/DesktopView/index.js b/src/components/TabBar/DesktopView/index.js index 5ba159233..0c40a787f 100644 --- a/src/components/TabBar/DesktopView/index.js +++ b/src/components/TabBar/DesktopView/index.js @@ -5,7 +5,7 @@ import React from 'react' import T from 'prop-types' -import { ANCHOR, THREAD, C11N, SIZE } from '@/constant' +import { HCN, ANCHOR, THREAD, C11N, SIZE } from '@/constant' import { buildLog, sortByIndex } from '@/utils' import NormalView from './NormalView' @@ -63,7 +63,7 @@ TabBar.defaultProps = { active: THREAD.POST, onChange: log, layout: C11N.DIGEST, - communityRaw: 'home', + communityRaw: HCN, size: SIZE.MEDIUM, } diff --git a/src/containers/content/DiscoveryContent/SubscribeBtn.js b/src/containers/content/DiscoveryContent/SubscribeBtn.js index f14f56f9c..b151daa9e 100755 --- a/src/containers/content/DiscoveryContent/SubscribeBtn.js +++ b/src/containers/content/DiscoveryContent/SubscribeBtn.js @@ -1,6 +1,7 @@ import React from 'react' import { ICON_CMD } from '@/config' +import { HCN } from '@/constant' import { Button } from '@/components/Buttons' import Tooltip from '@/components/Tooltip' @@ -11,7 +12,7 @@ import { subscribe, unSubscribe } from './logic' const AlreadySubedBtn = ({ community }) => ( <> - {community.raw !== 'home' ? ( + {community.raw !== HCN ? ( diff --git a/src/containers/content/RecipesContent/Snippets/index.js b/src/containers/content/RecipesContent/Snippets/index.js index 62d8854af..7296d91b8 100644 --- a/src/containers/content/RecipesContent/Snippets/index.js +++ b/src/containers/content/RecipesContent/Snippets/index.js @@ -6,7 +6,7 @@ import React from 'react' -import { GALLERY } from '@/constant' +import { HCN, GALLERY } from '@/constant' import Pagi from '@/components/Pagi' import { PagiOptionSwitcher } from '@/components/Switcher' @@ -73,7 +73,7 @@ const Content = ({ galleryType }) => { } Content.getInitialProps = async () => ({ - namespacesRequired: ['home'], + namespacesRequired: [HCN], }) export default React.memo(Content) diff --git a/src/containers/digest/CommunityDigest/DigestView/ColumnView/index.js b/src/containers/digest/CommunityDigest/DigestView/ColumnView/index.js index 2671c502f..cdb26e902 100644 --- a/src/containers/digest/CommunityDigest/DigestView/ColumnView/index.js +++ b/src/containers/digest/CommunityDigest/DigestView/ColumnView/index.js @@ -3,7 +3,7 @@ import { contains } from 'ramda' import { Waypoint } from 'react-waypoint' import { ICON_CMD } from '@/config' -import { NON_FILL_COMMUNITY } from '@/constant' +import { HCN, NON_FILL_COMMUNITY } from '@/constant' import { useDevice } from '@/hooks' import VerifiedSign from '@/components/VerifiedSign' @@ -40,7 +40,7 @@ import { const CommunityLogoHolder = `${ICON_CMD}/community_logo_holder.svg` // 没有各种外链接,打赏信息等的官方社区 -const NON_STANDARD_COMMUNITIES = ['home', 'feedback'] +const NON_STANDARD_COMMUNITIES = [HCN, 'feedback'] const CommunityBrief = ({ content, descExpand }) => { return ( @@ -67,7 +67,7 @@ const CommunityBrief = ({ content, descExpand }) => { {/* {content.desc} */} - {content.raw !== 'home' && } + {content.raw !== HCN && } ) diff --git a/src/containers/digest/CommunityDigest/DigestView/RowView/index.js b/src/containers/digest/CommunityDigest/DigestView/RowView/index.js index aa7fc29e8..cfd7a953e 100644 --- a/src/containers/digest/CommunityDigest/DigestView/RowView/index.js +++ b/src/containers/digest/CommunityDigest/DigestView/RowView/index.js @@ -1,7 +1,7 @@ import React from 'react' import { contains } from 'ramda' -import { THREAD, NON_FILL_COMMUNITY, VIEW } from '@/constant' +import { HCN, THREAD, NON_FILL_COMMUNITY, VIEW } from '@/constant' import { ICON_CMD } from '@/config' import CustomScroller from '@/components/CustomScroller' @@ -47,7 +47,7 @@ import { tabOnChange } from '../../logic' const CommunityLogoHolder = `${ICON_CMD}/community_logo_holder.svg` // 没有各种外链接,打赏信息等的官方社区 -const NON_STANDARD_COMMUNITIES = ['home', 'feedback'] +const NON_STANDARD_COMMUNITIES = [HCN, 'feedback'] const CommunityBrief = ({ content, descExpand }) => { return ( diff --git a/src/containers/digest/CommunityDigest/styles/digest_view/column_view/index.js b/src/containers/digest/CommunityDigest/styles/digest_view/column_view/index.js index 428823a82..1fd057fb0 100644 --- a/src/containers/digest/CommunityDigest/styles/digest_view/column_view/index.js +++ b/src/containers/digest/CommunityDigest/styles/digest_view/column_view/index.js @@ -1,5 +1,6 @@ import styled from 'styled-components' +import { HCN } from '@/constant' import { theme, css, WIDTH } from '@/utils' import Img from '@/Img' @@ -73,10 +74,10 @@ export const LogoWrapper = styled.div` position: relative; width: 55px; /* TODO: use new logo */ - margin-top: ${({ raw }) => (raw === 'home' ? '-10px' : 0)}; + margin-top: ${({ raw }) => (raw === HCN ? '-10px' : 0)}; @media (max-height: 800px) { - margin-top: ${({ raw }) => (raw === 'home' ? '-8px' : 0)}; + margin-top: ${({ raw }) => (raw === HCN ? '-8px' : 0)}; } ${css.media.mobile` diff --git a/src/containers/thread/JobsThread/logic.js b/src/containers/thread/JobsThread/logic.js index 68948edde..4e790e853 100755 --- a/src/containers/thread/JobsThread/logic.js +++ b/src/containers/thread/JobsThread/logic.js @@ -1,7 +1,7 @@ import { useEffect } from 'react' import { merge, pickBy } from 'ramda' -import { TYPE, EVENT, ERR, THREAD, ROUTE } from '@/constant' +import { HCN, TYPE, EVENT, ERR, THREAD, ROUTE } from '@/constant' import { asyncSuit, buildLog, @@ -86,7 +86,7 @@ export const onPreview = (data) => { export const onContentCreate = () => { if (!store.isLogin) return store.authWarning() - if (store.curCommunity.raw === 'home') { + if (store.curCommunity.raw === HCN) { return store.mark({ showPublishNote: true }) } diff --git a/src/containers/tool/CommunityJoinBadge/SubscribeBtn.js b/src/containers/tool/CommunityJoinBadge/SubscribeBtn.js index 73f390a62..fedf5b582 100644 --- a/src/containers/tool/CommunityJoinBadge/SubscribeBtn.js +++ b/src/containers/tool/CommunityJoinBadge/SubscribeBtn.js @@ -1,5 +1,7 @@ import React from 'react' +import { HCN } from '@/constant' + import Button from '@/components/Buttons/Button' import { Wrapper, Text } from './styles/subscribe_btn' @@ -8,7 +10,7 @@ import { onSubscribe, onCancleSubscribe } from './logic' const SubscribeButton = ({ community, subscribeLoading }) => { const { viewerHasSubscribed } = community - if (community.raw === 'home') { + if (community.raw === HCN) { return (