Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/components/CommunityFaceLogo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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 (
<Logo
src={`${ICON_BASE}/site_logo.svg`}
Expand Down Expand Up @@ -49,7 +50,7 @@ CommunityFaceLogo.propTypes = {

CommunityFaceLogo.defaultProps = {
src: '',
raw: 'home',
raw: HCN,
noFill: false,
className: 'community-facelogo-class',
loading: null,
Expand Down
4 changes: 2 additions & 2 deletions src/components/JobItem/JobInfo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react'
import TimeAgo from 'timeago-react'

// import { ICON_CMD } from '@/config'
import { HCN } from '@/constant'
import { cutFrom } from '@/utils'
import InlineCommunities from '@/components/InlineCommunities'
import InlineTags from '@/components/InlineTags'
Expand Down Expand Up @@ -46,7 +46,7 @@ const JobInfo = ({
<Header>
<Title onClick={onPreview}>{cutFrom(title, 30)}</Title>
<CommunitiesWrapper>
<InlineCommunities data={communities} show={community === 'home'} />
<InlineCommunities data={communities} show={community === HCN} />
</CommunitiesWrapper>
</Header>
<Middle onClick={onPreview}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/PostItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -99,7 +99,7 @@ PostItem.defaultProps = {
onAuthorSelect: log,
active: {},
cover: 'avatar',
community: 'home',
community: HCN,
accountInfo: {
isLogin: false,
customization: T.shape({
Expand Down
4 changes: 2 additions & 2 deletions src/components/TabBar/DesktopView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -63,7 +63,7 @@ TabBar.defaultProps = {
active: THREAD.POST,
onChange: log,
layout: C11N.DIGEST,
communityRaw: 'home',
communityRaw: HCN,
size: SIZE.MEDIUM,
}

Expand Down
3 changes: 2 additions & 1 deletion src/containers/content/DiscoveryContent/SubscribeBtn.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -11,7 +12,7 @@ import { subscribe, unSubscribe } from './logic'

const AlreadySubedBtn = ({ community }) => (
<>
{community.raw !== 'home' ? (
{community.raw !== HCN ? (
<Tooltip
content={
<Hinter title="退出" desc="之后该社区将不会出现在左侧订阅列表中" />
Expand Down
4 changes: 2 additions & 2 deletions src/containers/content/RecipesContent/Snippets/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -73,7 +73,7 @@ const Content = ({ galleryType }) => {
}

Content.getInitialProps = async () => ({
namespacesRequired: ['home'],
namespacesRequired: [HCN],
})

export default React.memo(Content)
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 (
Expand All @@ -67,7 +67,7 @@ const CommunityBrief = ({ content, descExpand }) => {
</TitleWrapper>
{/* <Desc>{content.desc}</Desc> */}
<ExpandTexts descExpand={descExpand} />
{content.raw !== 'home' && <SocialList />}
{content.raw !== HCN && <SocialList />}
</CommunityInfo>
</CommunityWrapper>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled from 'styled-components'

import { HCN } from '@/constant'
import { theme, css, WIDTH } from '@/utils'

import Img from '@/Img'
Expand Down Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions src/containers/thread/JobsThread/logic.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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 })
}

Expand Down
4 changes: 3 additions & 1 deletion src/containers/tool/CommunityJoinBadge/SubscribeBtn.js
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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 (
<Wrapper>
<Button
Expand Down
3 changes: 2 additions & 1 deletion src/containers/unit/Sidebar/MenuList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react'
import dynamic from 'next/dynamic'
import { reject, propEq } from 'ramda'

import { HCN } from '@/constant'
import NormalMenuList from './NormalMenuList'
// import SortableMenuList from './SortableMenuList'

Expand All @@ -14,7 +15,7 @@ export const SortableMenuList = dynamic(() => import('./SortableMenuList'), {
})

const MenuList = ({ items, pin, sortOptActive, activeRaw, forceRerender }) => {
const sortableCommunities = reject(propEq('raw', 'home'), items)
const sortableCommunities = reject(propEq('raw', HCN), items)

return (
<Wrapper>
Expand Down
4 changes: 2 additions & 2 deletions src/containers/unit/Sidebar/RealSidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import React from 'react'
import { filter, propEq } from 'ramda'

import { ANCHOR } from '@/constant'
import { HCN, ANCHOR } from '@/constant'
import { pluggedIn, buildLog } from '@/utils'

import Header from './Header'
Expand Down Expand Up @@ -37,7 +37,7 @@ const SidebarContainer = ({ sidebar: store }) => {
// onMouseLeave={logic.leaveSidebar}
// onMouseLeave is not unreliable in chrome: https://github.com/facebook/react/issues/4492
const activeRaw = curCommunity.raw
const homeCommunity = filter(propEq('raw', 'home'), communitiesData)[0]
const homeCommunity = filter(propEq('raw', HCN), communitiesData)[0]

return (
<MainWrapper
Expand Down
4 changes: 2 additions & 2 deletions src/containers/unit/Sidebar/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect } from 'react'
import { arrayMove } from 'react-sortable-hoc'
import { addIndex, map, reject, propEq, contains } from 'ramda'

import { EVENT, ERR, THREAD, ROUTE } from '@/constant'
import { HCN, EVENT, ERR, THREAD, ROUTE } from '@/constant'
import {
asyncSuit,
buildLog,
Expand Down Expand Up @@ -74,7 +74,7 @@ export const onSortMenuEnd = ({ oldIndex, newIndex }) => {
const setC11N = (sortedCommunities) => {
if (!store.isLogin) return store.authWarning()

sortedCommunities = reject(propEq('raw', 'home'), sortedCommunities)
sortedCommunities = reject(propEq('raw', HCN), sortedCommunities)
const sidebarCommunitiesIndex = mapIndexed(
(c, index) => ({ community: c.raw, index }),
sortedCommunities,
Expand Down
3 changes: 3 additions & 0 deletions utils/constant/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// a.k.a for HOME COMMUNITY NAME
export const HCN = 'home'

export { default as TYPE } from './type'
export { default as EVENT } from './event'
export { default as ERR } from './err'
Expand Down
6 changes: 4 additions & 2 deletions utils/ssr.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ import {
findIndex,
propEq,
} from 'ramda'

import { DEFAULT_THEME } from '@/config'
import { TYPE, THREAD } from '@/constant'
import { HCN, TYPE, THREAD } from '@/constant'

import { P } from '@/schemas'

import BStore from './bstore'
Expand Down Expand Up @@ -55,7 +57,7 @@ export const ssrPagedFilter = (community, thread, filter, userHasLogin) => {
return { community }
}

if (community === 'home' && thread === THREAD.JOB) {
if (community === HCN && thread === THREAD.JOB) {
filter = omit(['community'], filter)
return { filter, userHasLogin }
}
Expand Down