Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit157bcd8

Browse files
authored
refactor: user page reorg (#1183)
* refactor(user-page): basic setup* refactor(user-page): UserProfile Tab UI/UX improve* refactor(user-page): adjust styles* refactor(user-page): re-org inputs* refactor(user-page): editor basic UX* refactor(user-page): UserProfile Tab UI/UX improve* refactor(user-page): sidebar add works & re-org* refactor(sponsor-page): improve & adjust* refactor(user-page): user digest footer with real data* refactor(user-page): published articles workflow* refactor(user-page): published articles workflow* refactor(user-page): content bg edge case* refactor(comments): add user_published mode* refactor(comments): links for publish mode* refactor(user-page): add publisheComments tab & re-org
1 parentfdffd7c commit157bcd8

File tree

212 files changed

+2965
-4817
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

212 files changed

+2965
-4817
lines changed

‎docs/js/graphql.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const pagedCommunities = gql`
3030
        contributesDigest
3131
        subscribersCount
3232
      }
33-
      ${F.pagedCounts}
33+
      ${F.pagi}
3434
    }
3535
  }
3636
`

‎docs/js/graphql.zh-CN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const pagedCommunities = gql`
3030
contributesDigest
3131
subscribersCount
3232
}
33-
${F.pagedCounts}
33+
${F.pagi}
3434
}
3535
}
3636
`

‎server/routes.js‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,15 @@ router.route('/works/:id').get((req, res) => {
7979
})
8080

8181
// 用户页
82-
router.route('/user/:userId').get((req,res)=>{
83-
returnrenderAndCache({ req, res,path:'/user'})
82+
router.route('/u/:login').get((req,res)=>{
83+
const{ login}=req.params
84+
returnrenderAndCache({ req, res,path:`/user/${login}`})
85+
})
86+
87+
router.route('/user/:login').get((req,res)=>{
88+
const{ login}=req.params
89+
console.log('hello user ?: ',login)
90+
returnrenderAndCache({ req, res,path:`/user/${login}`})
8491
})
8592

8693
// 帖子页

‎src/containers/content/ExploreContent/schema.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const pagedCommunities = gql`
1010
subscribersCount
1111
viewerHasSubscribed @include(if: $userHasLogin)
1212
}
13-
${F.pagedCounts}
13+
${F.pagi}
1414
}
1515
}
1616
`
@@ -24,7 +24,7 @@ const searchCommunities = gql`
2424
subscribersCount
2525
viewerHasSubscribed @include(if: $userHasLogin)
2626
}
27-
${F.pagedCounts}
27+
${F.pagi}
2828
}
2929
}
3030
`
@@ -42,14 +42,14 @@ const subscribeCommunity = gql`
4242
}
4343
`
4444
constunsubscribeCommunity=gql`
45-
mutation($communityId: ID!) {
45+
mutation($communityId: ID!) {
4646
unsubscribeCommunity(communityId: $communityId) {
4747
id
4848
}
4949
}
5050
`
5151
constpagedCategories=gql`
52-
query($filter: PagedFilter!) {
52+
query($filter: PagedFilter!) {
5353
pagedCategories(filter: $filter) {
5454
entries {
5555
id

‎src/containers/content/UserContent/AchieveCard.js‎

Lines changed: 0 additions & 30 deletions
This file was deleted.

‎src/containers/content/UserContent/DigestBoard.js‎

Lines changed: 0 additions & 74 deletions
This file was deleted.

‎src/containers/content/UserContent/Sidebar/index.tsx‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
import{FC,memo}from'react'
22

3-
importtype{TUser}from'@/spec'
4-
import{VIEW}from'@/constant'
3+
importtype{TUser,TPagedWorks,TPagedCommunities}from'@/spec'
54
importUserBrieffrom'@/widgets/UserBrief'
65
import{Wrapper}from'../styles/sidebar'
76

87
typeTProps={
9-
viewingUser:TUser
8+
user:TUser
109
isSelfViewing?:boolean
10+
works:TPagedWorks
11+
editableCommunities:TPagedCommunities
1112
}
1213

13-
constSidebar:FC<TProps>=({ viewingUser, isSelfViewing=false})=>{
14+
constSidebar:FC<TProps>=({
15+
user,
16+
works,
17+
editableCommunities,
18+
isSelfViewing=false,
19+
})=>{
1420
return(
1521
<Wrapper>
16-
<UserBriefuser={viewingUser}view={VIEW.DESKTOP}/>
22+
<UserBrief
23+
user={user}
24+
works={works}
25+
editableCommunities={editableCommunities}
26+
/>
1727
</Wrapper>
1828
)
1929
}

‎src/containers/content/UserContent/SourceContributeInfo.js‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎src/containers/content/UserContent/index.tsx‎

Lines changed: 42 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,24 @@ import { USER_THREAD } from '@/constant'
1111
import{buildLog}from'@/utils/logger'
1212
import{pluggedIn}from'@/utils/mobx'
1313

14+
import{Comments}from'@/containers/dynamic'
1415
importUserProfilefrom'@/containers/user/UserProfile'
15-
importUserPublishedfrom'@/containers/user/UserPublished'
16-
importUserPublishedCommentsfrom'@/containers/user/UserPublishedComments'
17-
importUserBillingfrom'@/containers/user/UserBilling'
16+
importUserPublishedArticlesfrom'@/containers/user/UserPublishedArticles'
17+
// import UserBilling from '@/containers/user/UserBilling'
1818
importUserSettingsfrom'@/containers/user/UserSettings'
19-
importUserStaredfrom'@/containers/user/UserStared'
20-
importUserFavoritedfrom'@/containers/user/UserFavorited'
2119

2220
importTabBarfrom'@/widgets/TabBar'
2321

2422
importtype{TStore}from'./store'
2523
importSidebarfrom'./Sidebar'
26-
// import DigestBoard from './DigestBoard'
2724

2825
import{
2926
Wrapper,
3027
InnerWrapper,
3128
BannerWrapper,
3229
ContentWrapper,
3330
TabBarWrapper,
34-
// MobileBottom,
31+
PublishedCommentsWrapper,
3532
}from'./styles'
3633

3734
import{useInit,tabOnChange}from'./logic'
@@ -52,22 +49,22 @@ const BaseTaberThreads = [
5249
title:'讨论',
5350
raw:'comments',
5451
},
55-
{
56-
title:'收藏',
57-
raw:'favorites',
58-
},
59-
{
60-
title:'喜欢',
61-
raw:'likes',
62-
},
52+
//{
53+
// title: '收藏',
54+
// raw: 'favorites',
55+
//},
56+
//{
57+
// title: '喜欢',
58+
// raw: 'likes',
59+
//},
6360
]
6461

6562
constFullTaberThreads=[
6663
...BaseTaberThreads,
67-
{
68-
title:'账单',
69-
raw:'billing',
70-
},
64+
//{
65+
// title: '账单',
66+
// raw: 'billing',
67+
//},
7168
{
7269
title:'设置',
7370
raw:'settings',
@@ -80,22 +77,20 @@ const TabberContent = ({ active }) => {
8077
return<UserProfile/>
8178

8279
caseUSER_THREAD.COMMENTS:
83-
return<UserPublishedComments/>
84-
85-
caseUSER_THREAD.FAVORITES:
86-
return<UserFavorited/>
80+
return(
81+
<PublishedCommentsWrapper>
82+
<CommentsapiMode="user_published"/>
83+
</PublishedCommentsWrapper>
84+
)
8785

88-
caseUSER_THREAD.LINKS:
89-
return<UserStared/>
90-
91-
caseUSER_THREAD.BILLING:
92-
return<UserBilling/>
86+
// case USER_THREAD.BILLING:
87+
// return <UserBilling />
9388

9489
caseUSER_THREAD.SETTINGS:
9590
return<UserSettings/>
9691

9792
default:
98-
return<UserPublished/>
93+
return<UserPublishedArticles/>
9994
}
10095
}
10196

@@ -110,33 +105,32 @@ const UserContentContainer: FC<TProps> = ({ userContent: store, metric }) => {
110105
const{
111106
activeThread,
112107
viewingUser,
113-
// accountInfo,
114108
isSelfViewing,
115-
// following,
109+
pagedWorksData,
110+
pagedEditableCommunitiesData,
111+
hasContentBg,
116112
}=store
117-
118113
consttaberSource=isSelfViewing ?FullTaberThreads :BaseTaberThreads
119114

120115
return(
121116
<Wrapper>
122-
<BannerWrappermetric={metric}>
123-
<TabBarWrapperclassName="tabs-with-bottom">
124-
<TabBar
125-
source={taberSource}
126-
onChange={tabOnChange}
127-
active={activeThread}
128-
/>
129-
</TabBarWrapper>
130-
</BannerWrapper>
117+
<BannerWrappermetric={metric}/>
131118
<InnerWrappermetric={metric}>
132-
<SidebarviewingUser={viewingUser}isSelfViewing={isSelfViewing}/>
133-
<ContentWrapper>
119+
<Sidebar
120+
user={viewingUser}
121+
isSelfViewing={isSelfViewing}
122+
works={pagedWorksData}
123+
editableCommunities={pagedEditableCommunitiesData}
124+
/>
125+
<ContentWrapperhasContentBg={hasContentBg}>
126+
<TabBarWrapperclassName="tabs-with-bottom">
127+
<TabBar
128+
source={taberSource}
129+
onChange={tabOnChange}
130+
active={activeThread}
131+
/>
132+
</TabBarWrapper>
134133
<TabberContentactive={activeThread}/>
135-
{/* <DigestBoard
136-
user={viewingUser}
137-
accountId={accountInfo.id}
138-
following={following}
139-
/> */}
140134
</ContentWrapper>
141135
</InnerWrapper>
142136
</Wrapper>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp