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
2 changes: 1 addition & 1 deletion docs/js/graphql.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const pagedCommunities = gql`
        contributesDigest
        subscribersCount
      }
      ${F.pagedCounts}
      ${F.pagi}
    }
  }
`
Expand Down
2 changes: 1 addition & 1 deletion docs/js/graphql.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const pagedCommunities = gql`
contributesDigest
subscribersCount
}
${F.pagedCounts}
${F.pagi}
}
}
`
Expand Down
11 changes: 9 additions & 2 deletions server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,15 @@ router.route('/works/:id').get((req, res) => {
})

// 用户页
router.route('/user/:userId').get((req, res) => {
return renderAndCache({ req, res, path: '/user' })
router.route('/u/:login').get((req, res) => {
const { login } = req.params
return renderAndCache({ req, res, path: `/user/${login}` })
})

router.route('/user/:login').get((req, res) => {
const { login } = req.params
console.log('hello user ?: ', login)
return renderAndCache({ req, res, path: `/user/${login}` })
})

// 帖子页
Expand Down
8 changes: 4 additions & 4 deletions src/containers/content/ExploreContent/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const pagedCommunities = gql`
subscribersCount
viewerHasSubscribed @include(if: $userHasLogin)
}
${F.pagedCounts}
${F.pagi}
}
}
`
Expand All @@ -24,7 +24,7 @@ const searchCommunities = gql`
subscribersCount
viewerHasSubscribed @include(if: $userHasLogin)
}
${F.pagedCounts}
${F.pagi}
}
}
`
Expand All @@ -42,14 +42,14 @@ const subscribeCommunity = gql`
}
`
const unsubscribeCommunity = gql`
mutation($communityId: ID!) {
mutation ($communityId: ID!) {
unsubscribeCommunity(communityId: $communityId) {
id
}
}
`
const pagedCategories = gql`
query($filter: PagedFilter!) {
query ($filter: PagedFilter!) {
pagedCategories(filter: $filter) {
entries {
id
Expand Down
30 changes: 0 additions & 30 deletions src/containers/content/UserContent/AchieveCard.js

This file was deleted.

74 changes: 0 additions & 74 deletions src/containers/content/UserContent/DigestBoard.js

This file was deleted.

20 changes: 15 additions & 5 deletions src/containers/content/UserContent/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import { FC, memo } from 'react'

import type { TUser } from '@/spec'
import { VIEW } from '@/constant'
import type { TUser, TPagedWorks, TPagedCommunities } from '@/spec'
import UserBrief from '@/widgets/UserBrief'
import { Wrapper } from '../styles/sidebar'

type TProps = {
viewingUser: TUser
user: TUser
isSelfViewing?: boolean
works: TPagedWorks
editableCommunities: TPagedCommunities
}

const Sidebar: FC<TProps> = ({ viewingUser, isSelfViewing = false }) => {
const Sidebar: FC<TProps> = ({
user,
works,
editableCommunities,
isSelfViewing = false,
}) => {
return (
<Wrapper>
<UserBrief user={viewingUser} view={VIEW.DESKTOP} />
<UserBrief
user={user}
works={works}
editableCommunities={editableCommunities}
/>
</Wrapper>
)
}
Expand Down
37 changes: 0 additions & 37 deletions src/containers/content/UserContent/SourceContributeInfo.js

This file was deleted.

90 changes: 42 additions & 48 deletions src/containers/content/UserContent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,24 @@ import { USER_THREAD } from '@/constant'
import { buildLog } from '@/utils/logger'
import { pluggedIn } from '@/utils/mobx'

import { Comments } from '@/containers/dynamic'
import UserProfile from '@/containers/user/UserProfile'
import UserPublished from '@/containers/user/UserPublished'
import UserPublishedComments from '@/containers/user/UserPublishedComments'
import UserBilling from '@/containers/user/UserBilling'
import UserPublishedArticles from '@/containers/user/UserPublishedArticles'
// import UserBilling from '@/containers/user/UserBilling'
import UserSettings from '@/containers/user/UserSettings'
import UserStared from '@/containers/user/UserStared'
import UserFavorited from '@/containers/user/UserFavorited'

import TabBar from '@/widgets/TabBar'

import type { TStore } from './store'
import Sidebar from './Sidebar'
// import DigestBoard from './DigestBoard'

import {
Wrapper,
InnerWrapper,
BannerWrapper,
ContentWrapper,
TabBarWrapper,
// MobileBottom,
PublishedCommentsWrapper,
} from './styles'

import { useInit, tabOnChange } from './logic'
Expand All @@ -52,22 +49,22 @@ const BaseTaberThreads = [
title: '讨论',
raw: 'comments',
},
{
title: '收藏',
raw: 'favorites',
},
{
title: '喜欢',
raw: 'likes',
},
// {
// title: '收藏',
// raw: 'favorites',
// },
// {
// title: '喜欢',
// raw: 'likes',
// },
]

const FullTaberThreads = [
...BaseTaberThreads,
{
title: '账单',
raw: 'billing',
},
// {
// title: '账单',
// raw: 'billing',
// },
{
title: '设置',
raw: 'settings',
Expand All @@ -80,22 +77,20 @@ const TabberContent = ({ active }) => {
return <UserProfile />

case USER_THREAD.COMMENTS:
return <UserPublishedComments />

case USER_THREAD.FAVORITES:
return <UserFavorited />
return (
<PublishedCommentsWrapper>
<Comments apiMode="user_published" />
</PublishedCommentsWrapper>
)

case USER_THREAD.LINKS:
return <UserStared />

case USER_THREAD.BILLING:
return <UserBilling />
// case USER_THREAD.BILLING:
// return <UserBilling />

case USER_THREAD.SETTINGS:
return <UserSettings />

default:
return <UserPublished />
return <UserPublishedArticles />
}
}

Expand All @@ -110,33 +105,32 @@ const UserContentContainer: FC<TProps> = ({ userContent: store, metric }) => {
const {
activeThread,
viewingUser,
// accountInfo,
isSelfViewing,
// following,
pagedWorksData,
pagedEditableCommunitiesData,
hasContentBg,
} = store

const taberSource = isSelfViewing ? FullTaberThreads : BaseTaberThreads

return (
<Wrapper>
<BannerWrapper metric={metric}>
<TabBarWrapper className="tabs-with-bottom">
<TabBar
source={taberSource}
onChange={tabOnChange}
active={activeThread}
/>
</TabBarWrapper>
</BannerWrapper>
<BannerWrapper metric={metric} />
<InnerWrapper metric={metric}>
<Sidebar viewingUser={viewingUser} isSelfViewing={isSelfViewing} />
<ContentWrapper>
<Sidebar
user={viewingUser}
isSelfViewing={isSelfViewing}
works={pagedWorksData}
editableCommunities={pagedEditableCommunitiesData}
/>
<ContentWrapper hasContentBg={hasContentBg}>
<TabBarWrapper className="tabs-with-bottom">
<TabBar
source={taberSource}
onChange={tabOnChange}
active={activeThread}
/>
</TabBarWrapper>
<TabberContent active={activeThread} />
{/* <DigestBoard
user={viewingUser}
accountId={accountInfo.id}
following={following}
/> */}
</ContentWrapper>
</InnerWrapper>
</Wrapper>
Expand Down
Loading