Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 20c0657

Browse files
authored
chore(constant): use HCN stands for 'home' (#1009)
1 parent 6a94f78 commit 20c0657

File tree

16 files changed

+39
-28
lines changed

16 files changed

+39
-28
lines changed

src/components/CommunityFaceLogo/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import React from 'react'
88
import T from 'prop-types'
99
import { isEmpty } from 'ramda'
1010

11+
import { HCN } from '@/constant'
1112
import { ICON_BASE } from '@/config'
1213
import { buildLog } from '@/utils'
1314

@@ -17,7 +18,7 @@ import { Logo } from './styles'
1718
const log = buildLog('c:CommunityFaceLogo:index')
1819

1920
const CommunityFaceLogo = ({ noFill, src, raw, loading, className }) => {
20-
if (raw === 'home' || isEmpty(src)) {
21+
if (raw === HCN || isEmpty(src)) {
2122
return (
2223
<Logo
2324
src={`${ICON_BASE}/site_logo.svg`}
@@ -49,7 +50,7 @@ CommunityFaceLogo.propTypes = {
4950

5051
CommunityFaceLogo.defaultProps = {
5152
src: '',
52-
raw: 'home',
53+
raw: HCN,
5354
noFill: false,
5455
className: 'community-facelogo-class',
5556
loading: null,

src/components/JobItem/JobInfo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import TimeAgo from 'timeago-react'
33

4-
// import { ICON_CMD } from '@/config'
4+
import { HCN } from '@/constant'
55
import { cutFrom } from '@/utils'
66
import InlineCommunities from '@/components/InlineCommunities'
77
import InlineTags from '@/components/InlineTags'
@@ -46,7 +46,7 @@ const JobInfo = ({
4646
<Header>
4747
<Title onClick={onPreview}>{cutFrom(title, 30)}</Title>
4848
<CommunitiesWrapper>
49-
<InlineCommunities data={communities} show={community === 'home'} />
49+
<InlineCommunities data={communities} show={community === HCN} />
5050
</CommunitiesWrapper>
5151
</Header>
5252
<Middle onClick={onPreview}>

src/components/PostItem/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import React from 'react'
88
import T from 'prop-types'
99

10-
import { C11N } from '@/constant'
10+
import { HCN, C11N } from '@/constant'
1111
import { buildLog } from '@/utils'
1212

1313
import ArticleItemPrefixLabel from '@/components/ArticleItemPrefixLabel'
@@ -99,7 +99,7 @@ PostItem.defaultProps = {
9999
onAuthorSelect: log,
100100
active: {},
101101
cover: 'avatar',
102-
community: 'home',
102+
community: HCN,
103103
accountInfo: {
104104
isLogin: false,
105105
customization: T.shape({

src/components/TabBar/DesktopView/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import React from 'react'
66
import T from 'prop-types'
77

8-
import { ANCHOR, THREAD, C11N, SIZE } from '@/constant'
8+
import { HCN, ANCHOR, THREAD, C11N, SIZE } from '@/constant'
99
import { buildLog, sortByIndex } from '@/utils'
1010

1111
import NormalView from './NormalView'
@@ -63,7 +63,7 @@ TabBar.defaultProps = {
6363
active: THREAD.POST,
6464
onChange: log,
6565
layout: C11N.DIGEST,
66-
communityRaw: 'home',
66+
communityRaw: HCN,
6767
size: SIZE.MEDIUM,
6868
}
6969

src/containers/content/DiscoveryContent/SubscribeBtn.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react'
22

33
import { ICON_CMD } from '@/config'
4+
import { HCN } from '@/constant'
45

56
import { Button } from '@/components/Buttons'
67
import Tooltip from '@/components/Tooltip'
@@ -11,7 +12,7 @@ import { subscribe, unSubscribe } from './logic'
1112

1213
const AlreadySubedBtn = ({ community }) => (
1314
<>
14-
{community.raw !== 'home' ? (
15+
{community.raw !== HCN ? (
1516
<Tooltip
1617
content={
1718
<Hinter title="退出" desc="之后该社区将不会出现在左侧订阅列表中" />

src/containers/content/RecipesContent/Snippets/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import React from 'react'
88

9-
import { GALLERY } from '@/constant'
9+
import { HCN, GALLERY } from '@/constant'
1010

1111
import Pagi from '@/components/Pagi'
1212
import { PagiOptionSwitcher } from '@/components/Switcher'
@@ -73,7 +73,7 @@ const Content = ({ galleryType }) => {
7373
}
7474

7575
Content.getInitialProps = async () => ({
76-
namespacesRequired: ['home'],
76+
namespacesRequired: [HCN],
7777
})
7878

7979
export default React.memo(Content)

src/containers/digest/CommunityDigest/DigestView/ColumnView/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { contains } from 'ramda'
33
import { Waypoint } from 'react-waypoint'
44

55
import { ICON_CMD } from '@/config'
6-
import { NON_FILL_COMMUNITY } from '@/constant'
6+
import { HCN, NON_FILL_COMMUNITY } from '@/constant'
77
import { useDevice } from '@/hooks'
88

99
import VerifiedSign from '@/components/VerifiedSign'
@@ -40,7 +40,7 @@ import {
4040
const CommunityLogoHolder = `${ICON_CMD}/community_logo_holder.svg`
4141

4242
// 没有各种外链接,打赏信息等的官方社区
43-
const NON_STANDARD_COMMUNITIES = ['home', 'feedback']
43+
const NON_STANDARD_COMMUNITIES = [HCN, 'feedback']
4444

4545
const CommunityBrief = ({ content, descExpand }) => {
4646
return (
@@ -67,7 +67,7 @@ const CommunityBrief = ({ content, descExpand }) => {
6767
</TitleWrapper>
6868
{/* <Desc>{content.desc}</Desc> */}
6969
<ExpandTexts descExpand={descExpand} />
70-
{content.raw !== 'home' && <SocialList />}
70+
{content.raw !== HCN && <SocialList />}
7171
</CommunityInfo>
7272
</CommunityWrapper>
7373
)

src/containers/digest/CommunityDigest/DigestView/RowView/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { contains } from 'ramda'
33

4-
import { THREAD, NON_FILL_COMMUNITY, VIEW } from '@/constant'
4+
import { HCN, THREAD, NON_FILL_COMMUNITY, VIEW } from '@/constant'
55
import { ICON_CMD } from '@/config'
66

77
import CustomScroller from '@/components/CustomScroller'
@@ -47,7 +47,7 @@ import { tabOnChange } from '../../logic'
4747
const CommunityLogoHolder = `${ICON_CMD}/community_logo_holder.svg`
4848

4949
// 没有各种外链接,打赏信息等的官方社区
50-
const NON_STANDARD_COMMUNITIES = ['home', 'feedback']
50+
const NON_STANDARD_COMMUNITIES = [HCN, 'feedback']
5151

5252
const CommunityBrief = ({ content, descExpand }) => {
5353
return (

src/containers/digest/CommunityDigest/styles/digest_view/column_view/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import styled from 'styled-components'
22

3+
import { HCN } from '@/constant'
34
import { theme, css, WIDTH } from '@/utils'
45

56
import Img from '@/Img'
@@ -73,10 +74,10 @@ export const LogoWrapper = styled.div`
7374
position: relative;
7475
width: 55px;
7576
/* TODO: use new logo */
76-
margin-top: ${({ raw }) => (raw === 'home' ? '-10px' : 0)};
77+
margin-top: ${({ raw }) => (raw === HCN ? '-10px' : 0)};
7778
7879
@media (max-height: 800px) {
79-
margin-top: ${({ raw }) => (raw === 'home' ? '-8px' : 0)};
80+
margin-top: ${({ raw }) => (raw === HCN ? '-8px' : 0)};
8081
}
8182
8283
${css.media.mobile`

src/containers/thread/JobsThread/logic.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { useEffect } from 'react'
22
import { merge, pickBy } from 'ramda'
33

4-
import { TYPE, EVENT, ERR, THREAD, ROUTE } from '@/constant'
4+
import { HCN, TYPE, EVENT, ERR, THREAD, ROUTE } from '@/constant'
55
import {
66
asyncSuit,
77
buildLog,
@@ -86,7 +86,7 @@ export const onPreview = (data) => {
8686
export const onContentCreate = () => {
8787
if (!store.isLogin) return store.authWarning()
8888

89-
if (store.curCommunity.raw === 'home') {
89+
if (store.curCommunity.raw === HCN) {
9090
return store.mark({ showPublishNote: true })
9191
}
9292

0 commit comments

Comments
 (0)