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 1, 2021. It is now read-only.

Commit7f43729

Browse files
committed
refactor(tables): add reposTable to community & ssr
1 parentc60c453 commit7f43729

File tree

8 files changed

+113
-4
lines changed

8 files changed

+113
-4
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
importReactfrom'react'
2+
3+
import{ICON_CMD}from'../../config'
4+
import{Popover,BannerCountBrief}from'../../components'
5+
6+
import{
7+
BannerContentWrapper,
8+
Operation,
9+
OperationItem,
10+
OperationDivider,
11+
OperationTitle,
12+
OperationIcon,
13+
OperationIconChart,
14+
}from'./styles/common_banner'
15+
16+
import*aslogicfrom'./logic'
17+
18+
constReposBanner=({ filteredCount, totalCount})=>(
19+
<BannerContentWrapper>
20+
<BannerCountBrieffilteredCount={filteredCount}totalCount={totalCount}/>
21+
<Operation>
22+
<OperationItemonClick={console.log}>
23+
<OperationIconChartsrc={`${ICON_CMD}/refresh.svg`}/>
24+
刷新
25+
</OperationItem>
26+
<OperationDivider/>
27+
<OperationItem>
28+
<OperationIconsrc={`${ICON_CMD}/filter2.svg`}/>
29+
<Popover
30+
content={<div>兼容各个页面的 Filter 菜单</div>}
31+
trigger="hover"
32+
>
33+
<OperationTitle>过滤</OperationTitle>
34+
</Popover>
35+
</OperationItem>
36+
<OperationDivider/>
37+
<OperationItemonClick={logic.onAdd}>
38+
<OperationIconChartsrc={`${ICON_CMD}/plus.svg`}/>
39+
添加
40+
</OperationItem>
41+
<OperationDivider/>
42+
<OperationItem>
43+
<OperationIconsrc={`${ICON_CMD}/chart.svg`}/>
44+
图表
45+
</OperationItem>
46+
</Operation>
47+
</BannerContentWrapper>
48+
)
49+
50+
exportdefaultReposBanner

‎containers/CommunityBanner/index.js‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import * as logic from './logic'
1515
importPostsBannerfrom'./PostsBanner'
1616
importJobsBannerfrom'./JobsBanner'
1717
importVideosBannerfrom'./VideosBanner'
18+
importReposBannerfrom'./ReposBanner'
1819
importTagsBannerfrom'./TagsBanner'
1920
importThreadsBannerfrom'./ThreadsBanner'
2021
importSubscribersBannerfrom'./SubscribersBanner'
@@ -30,13 +31,15 @@ const ChildBanner = ({
3031
postsTotalCount,
3132
jobsTotalCount,
3233
videosTotalCount,
34+
reposTotalCount,
3335
tagsTotalCount,
3436
restProps,
3537
})=>{
3638
const{
3739
filteredPostsCount,
3840
filteredJobsCount,
3941
filteredVideosCount,
42+
filteredReposCount,
4043
}=restProps
4144

4245
switch(curRoute.subPath){
@@ -64,6 +67,14 @@ const ChildBanner = ({
6467
/>
6568
)
6669
}
70+
caseROUTE.REPOS:{
71+
return(
72+
<ReposBanner
73+
totalCount={reposTotalCount}
74+
filteredCount={filteredReposCount}
75+
/>
76+
)
77+
}
6778
caseROUTE.SUBSCRIBERS:{
6879
return<SubscribersBannertotalCount={100}filteredCount={10}/>
6980
}
@@ -97,6 +108,7 @@ class CommunityBannerContainer extends React.Component {
97108
postsTotalCount,
98109
jobsTotalCount,
99110
videosTotalCount,
111+
reposTotalCount,
100112
tagsTotalCount,
101113
}=communityBanner
102114

@@ -107,6 +119,7 @@ class CommunityBannerContainer extends React.Component {
107119
postsTotalCount={postsTotalCount}
108120
jobsTotalCount={jobsTotalCount}
109121
videosTotalCount={videosTotalCount}
122+
reposTotalCount={reposTotalCount}
110123
tagsTotalCount={tagsTotalCount}
111124
restProps={stripMobx(communityBanner)}
112125
/>

‎containers/CommunityBanner/store.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const CommunityBannerStore = t
1717
filteredPostsCount:t.maybeNull(t.number),
1818
filteredJobsCount:t.maybeNull(t.number),
1919
filteredVideosCount:t.maybeNull(t.number),
20+
filteredReposCount:t.maybeNull(t.number),
2021
// tagsTotalCount: t.optional(t.number, 0),
2122
})
2223
.views(self=>({
@@ -32,6 +33,9 @@ const CommunityBannerStore = t
3233
getvideosTotalCount(){
3334
returnself.root.communityContent.pagedVideos.totalCount
3435
},
36+
getreposTotalCount(){
37+
returnself.root.communityContent.pagedRepos.totalCount
38+
},
3539
gettagsTotalCount(){
3640
returnself.root.communityContent.pagedTags.length
3741
},
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
importReactfrom'react'
2+
3+
importReposTablefrom'../../components/ReposTable'
4+
5+
// import { OperationWrapper } from './styles'
6+
import*aslogicfrom'./logic'
7+
8+
/* eslint-disable react/display-name */
9+
constReposContent=({ data,restProps:{ reposLoading}})=>(
10+
<ReposTable
11+
data={data}
12+
loading={reposLoading}
13+
onDelete={logic.onDelete}
14+
onEdit={logic.onEdit}
15+
/>
16+
)
17+
18+
exportdefaultReposContent

‎containers/CommunityContent/index.js‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import PostsContent from './PostsContent'
1515
importJobsContentfrom'./JobsContent'
1616
importTagsContentfrom'./TagsContent'
1717
importVideosContentfrom'./VideosContent'
18+
importReposContentfrom'./ReposContent'
1819

1920
import{Wrapper}from'./styles'
2021
import*aslogicfrom'./logic'
@@ -28,6 +29,7 @@ const ChildContent = ({
2829
pagedPostsData,
2930
pagedJobsData,
3031
pagedVideosData,
32+
pagedReposData,
3133
pagedTagsData,
3234
restProps,
3335
})=>{
@@ -39,7 +41,7 @@ const ChildContent = ({
3941
return<JobsContentdata={pagedJobsData}restProps={restProps}/>
4042
}
4143
caseROUTE.REPOS:{
42-
return<h3>ROUTE.REPOS</h3>
44+
return<ReposContentdata={pagedReposData}restProps={restProps}/>
4345
}
4446
caseROUTE.VIDEOS:{
4547
return<VideosContentdata={pagedVideosData}restProps={restProps}/>
@@ -73,19 +75,19 @@ class CommunityContentContainer extends React.Component {
7375
pagedPostsData,
7476
pagedJobsData,
7577
pagedVideosData,
78+
pagedReposData,
7679
pagedTagsData,
7780
}=communityContent
7881
constrestProps={ ...communityContent}
7982

80-
console.log('the fuck pagedVideosData: ',pagedVideosData)
81-
8283
return(
8384
<Wrapper>
8485
<ChildContent
8586
curRoute={curRoute}
8687
pagedPostsData={pagedPostsData}
8788
pagedJobsData={pagedJobsData}
8889
pagedVideosData={pagedVideosData}
90+
pagedReposData={pagedReposData}
8991
pagedTagsData={pagedTagsData}
9092
restProps={restProps}
9193
/>

‎containers/CommunityContent/logic.js‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ export function loadVideos(page = 1) {
5757
sr71$.query(S.pagedVideos,commonFilter(page,community))
5858
}
5959

60+
exportfunctionloadRepos(page=1){
61+
scrollIntoEle(TYPE.APP_HEADER_ID)
62+
store.markState({reposLoading:true})
63+
const{mainPath:community}=store.curRoute
64+
sr71$.query(S.pagedRepos,commonFilter(page,community))
65+
}
66+
6067
exportfunctionloadTags(){
6168
scrollIntoEle(TYPE.APP_HEADER_ID)
6269
store.markState({tagsLoading:true})
@@ -104,6 +111,13 @@ const DataSolver = [
104111
store.markState({ pagedVideos})
105112
},
106113
},
114+
{
115+
match:asyncRes('pagedRepos'),
116+
action:({ pagedRepos})=>{
117+
cancleLoading()
118+
store.markState({ pagedRepos})
119+
},
120+
},
107121
{
108122
match:asyncRes('partialTags'),
109123
action:({ partialTags})=>{
@@ -131,7 +145,7 @@ const DataSolver = [
131145
returnloadJobs()
132146
}
133147
caseROUTE.REPOS:{
134-
returnconsole.log('todo')
148+
returnloadRepos()
135149
}
136150
caseROUTE.VIDEOS:{
137151
returnloadVideos()

‎containers/CommunityContent/store.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ const CommunityContentStore = t
6060
getpagedVideosData(){
6161
returnstripMobx(self.pagedVideos)
6262
},
63+
getpagedReposData(){
64+
returnstripMobx(self.pagedRepos)
65+
},
6366
getpagedTagsData(){
6467
return{entries:stripMobx(self.pagedTags)}
6568
},

‎utils/ssr_helper.js‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ const ssrCommunityContents = (subPath, resp) => {
6464
communityContent:{pagedVideos:resp.pagedVideos},
6565
}
6666
}
67+
caseROUTE.REPOS:{
68+
return{
69+
communityContent:{pagedRepos:resp.pagedRepos},
70+
}
71+
}
6772
caseROUTE.TAGS:{
6873
return{
6974
communityContent:{pagedTags:resp.partialTags},

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp