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

Commit 9fbfee0

Browse files
authored
refactor(user-page): Improve profile (#1184)
* refactor(profile): contribuite map title style * refactor(profile): subscribed community with real data * refactor(profile): tmp activity
1 parent 157bcd8 commit 9fbfee0

File tree

23 files changed

+289
-128
lines changed

23 files changed

+289
-128
lines changed

src/containers/content/UserContent/store.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const UserContent = T.model('UserContent', {
2525
following: T.optional(T.boolean, false),
2626

2727
pagedEditableCommunities: T.optional(PagedCommunities, emptyPagi),
28+
subscribedCommunities: T.optional(PagedCommunities, emptyPagi),
2829
pagedWorks: T.optional(PagedWorks, emptyPagi),
2930
})
3031
.views((self) => ({
@@ -50,6 +51,7 @@ const UserContent = T.model('UserContent', {
5051
get pagedEditableCommunitiesData(): TPagedCommunities {
5152
return toJS(self.pagedEditableCommunities)
5253
},
54+
5355
get hasContentBg(): boolean {
5456
const root = getParent(self) as TRootStore
5557

src/containers/user/UserProfile/Activities/BriefInfo.js

Lines changed: 0 additions & 25 deletions
This file was deleted.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { FC, memo } from 'react'
2+
3+
import { TUserActivity } from '@/spec'
4+
import {
5+
Wrapper,
6+
DateInfo,
7+
DayNum,
8+
MonthNum,
9+
Divider,
10+
Desc,
11+
} from '../styles/activities/brief_info'
12+
13+
type TProps = {
14+
activity: TUserActivity
15+
first: boolean
16+
}
17+
18+
const BriefInfo: FC<TProps> = ({ activity, first }) => {
19+
const date = new Date(activity.insertedAt)
20+
const month = date.getMonth() + 1
21+
const day = date.getDate()
22+
23+
return (
24+
<Wrapper first={first}>
25+
<DateInfo>
26+
<DayNum>{day}</DayNum>
27+
<Divider>/</Divider>
28+
<MonthNum>{month}</MonthNum>
29+
</DateInfo>
30+
<Desc>发布帖子</Desc>
31+
</Wrapper>
32+
)
33+
}
34+
35+
export default memo(BriefInfo)

src/containers/user/UserProfile/Activities/DetailInfo.js

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { FC, memo } from 'react'
2+
3+
import type { TUserActivity } from '@/spec'
4+
5+
import {
6+
Wrapper,
7+
IconWrapper,
8+
Icon,
9+
Content,
10+
Title,
11+
Digest,
12+
} from '../styles/activities/detail_info'
13+
14+
type TProps = {
15+
activity: TUserActivity
16+
first: boolean
17+
}
18+
19+
const DetailInfo: FC<TProps> = ({ activity, first }) => {
20+
return (
21+
<Wrapper first={first}>
22+
<IconWrapper first={first}>
23+
<Icon />
24+
</IconWrapper>
25+
<Content>
26+
<Title>{activity.articleTitle}</Title>
27+
<Digest>{activity.digest}</Digest>
28+
</Content>
29+
</Wrapper>
30+
)
31+
}
32+
33+
export default memo(DetailInfo)

src/containers/user/UserProfile/Activities/EventBlock.js

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { FC, memo } from 'react'
2+
3+
import type { TUserActivity } from '@/spec'
4+
5+
import BriefInfo from './BriefInfo'
6+
import DetailInfo from './DetailInfo'
7+
8+
import { Wrapper } from '../styles/activities/event_block'
9+
10+
type TProps = {
11+
activity: TUserActivity
12+
first: boolean
13+
}
14+
15+
const EventBlock: FC<TProps> = ({ activity, first }) => {
16+
return (
17+
<Wrapper>
18+
<BriefInfo activity={activity} first={first} />
19+
<DetailInfo activity={activity} first={first} />
20+
</Wrapper>
21+
)
22+
}
23+
24+
export default memo(EventBlock)

src/containers/user/UserProfile/Activities/index.js

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FC, memo } from 'react'
2+
3+
import type { TUserActivity } from '@/spec'
4+
import EventBlock from './EventBlock'
5+
6+
import { Wrapper, Title, EmptyHint, Divider } from '../styles/activities'
7+
8+
type TProps = {
9+
items: TUserActivity[]
10+
}
11+
12+
const Activities: FC<TProps> = ({ items }) => {
13+
if (items.length === 0) return <EmptyHint>暂无动态</EmptyHint>
14+
15+
return (
16+
<Wrapper>
17+
<Title>最新动态</Title>
18+
<Divider />
19+
{items.map((activity, index) => (
20+
<EventBlock key={activity.id} activity={activity} first={index === 0} />
21+
))}
22+
</Wrapper>
23+
)
24+
}
25+
26+
export default memo(Activities)

src/containers/user/UserProfile/ContributeMap.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { buildLog } from '@/utils/logger'
1313
import {
1414
Wrapper,
1515
Title,
16+
TitleCount,
1617
Header,
1718
Divider,
1819
DotText,
@@ -70,7 +71,10 @@ const UserContributeMap: FC<TProps> = ({ user }) => {
7071
return (
7172
<Wrapper className="banner-heatmap">
7273
<Header>
73-
<Title>过去 1 年共创作 {contributes.totalCount} 次内容</Title>
74+
<Title>
75+
过去 <TitleCount>1</TitleCount> 年共创作{' '}
76+
<TitleCount>{contributes.totalCount}</TitleCount> 次内容
77+
</Title>
7478
<DotList>
7579
<DotText>潜水&nbsp;&nbsp;</DotText>
7680
<ColorDot scale="empty" />

0 commit comments

Comments
 (0)