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.

Commit6202c64

Browse files
committed
Merge branch 'community' into dev
2 parents53e77a6 +28ada5a commit6202c64

File tree

10 files changed

+111
-205
lines changed

10 files changed

+111
-205
lines changed

‎components/PagedContents/ContentList.js‎

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,98 @@
11
importReactfrom'react'
2+
importdynamicfrom'next/dynamic'
23

3-
importPostsListfrom'./PostsList'
4-
importJobsListfrom'./JobsList'
5-
importReposListfrom'./ReposList'
6-
importVideosListfrom'./VideosList'
4+
import{
5+
PostItemLoading,
6+
JobItemLoading,
7+
VideoItemLoading,
8+
RepoItemLoading,
9+
}from'../LoadingEffects'
10+
11+
/* import PostsList from './PostsList' */
12+
// import JobsList from './JobsList'
13+
// import VideosList from './VideosList'
14+
// import ReposList from './ReposList'
715

816
import{THREAD}from'../../utils'
917

10-
constContentList=({ entries, curView, community, thread, emptyPrefix})=>{
18+
/* eslint-disable */
19+
constDynamicPostsList=dynamic({
20+
loader:()=>import('./PostsList'),
21+
loading:()=><PostItemLoadingnum={4}/>,
22+
})
23+
constDynamicJobsList=dynamic({
24+
loader:()=>import('./JobsList'),
25+
loading:()=><JobItemLoadingnum={4}/>,
26+
})
27+
constDynamicVideosList=dynamic({
28+
loader:()=>import('./VideosList'),
29+
loading:()=><VideoItemLoadingnum={4}/>,
30+
})
31+
constDynamicReposList=dynamic({
32+
loader:()=>import('./ReposList'),
33+
loading:()=><RepoItemLoadingnum={4}/>,
34+
})
35+
/* eslint-enable */
36+
37+
constContentList=({
38+
entries,
39+
active,
40+
curView,
41+
community,
42+
thread,
43+
emptyPrefix,
44+
onTitleSelect,
45+
})=>{
1146
switch(thread){
1247
caseTHREAD.JOB:{
1348
return(
14-
<JobsList
49+
<DynamicJobsList
1550
entries={entries}
51+
active={active}
1652
curView={curView}
1753
thread={thread}
1854
community={community}
1955
emptyPrefix={emptyPrefix}
56+
onTitleSelect={onTitleSelect}
2057
/>
2158
)
2259
}
2360
caseTHREAD.VIDEO:{
2461
return(
25-
<VideosList
62+
<DynamicVideosList
2663
entries={entries}
64+
active={active}
2765
curView={curView}
2866
thread={thread}
2967
community={community}
3068
emptyPrefix={emptyPrefix}
69+
onTitleSelect={onTitleSelect}
3170
/>
3271
)
3372
}
3473
caseTHREAD.REPO:{
3574
return(
36-
<ReposList
75+
<DynamicReposList
3776
entries={entries}
77+
active={active}
3878
curView={curView}
3979
thread={thread}
4080
community={community}
4181
emptyPrefix={emptyPrefix}
82+
onTitleSelect={onTitleSelect}
4283
/>
4384
)
4485
}
4586
default:{
4687
return(
47-
<PostsList
88+
<DynamicPostsList
4889
entries={entries}
90+
active={active}
4991
curView={curView}
5092
thread={thread}
5193
community={community}
5294
emptyPrefix={emptyPrefix}
95+
onTitleSelect={onTitleSelect}
5396
/>
5497
)
5598
}

‎components/PagedContents/JobsList.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const JobsList = ({
1616
thread,
1717
emptyPrefix,
1818
active,
19+
onTitleSelect,
1920
})=>{
2021
switch(curView){
2122
caseTYPE.RESULT:{
@@ -26,7 +27,7 @@ const JobsList = ({
2627
key={uid.gen()}
2728
entry={entry}
2829
active={active}
29-
onTitleSelect={console.log}
30+
onTitleSelect={onTitleSelect.bind(this,entry)}
3031
/>
3132
))}
3233
</React.Fragment>

‎components/PagedContents/PostsList.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const PostsList = ({
1616
thread,
1717
emptyPrefix,
1818
active,
19+
onTitleSelect,
1920
})=>{
2021
switch(curView){
2122
caseTYPE.RESULT:{
@@ -26,7 +27,7 @@ const PostsList = ({
2627
key={uid.gen()}
2728
entry={entry}
2829
active={active}
29-
onTitleSelect={console.log}
30+
onTitleSelect={onTitleSelect.bind(this,entry)}
3031
/>
3132
))}
3233
</React.Fragment>

‎components/PagedContents/ReposList.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const ReposList = ({
1616
thread,
1717
emptyPrefix,
1818
active,
19+
onTitleSelect,
1920
})=>{
2021
switch(curView){
2122
caseTYPE.RESULT:{
@@ -26,7 +27,7 @@ const ReposList = ({
2627
key={uid.gen()}
2728
entry={entry}
2829
active={active}
29-
onTitleSelect={console.log}
30+
onTitleSelect={onTitleSelect.bind(this,entry)}
3031
/>
3132
))}
3233
</React.Fragment>

‎components/PagedContents/VideosList.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const VideosList = ({
1616
thread,
1717
emptyPrefix,
1818
active,
19+
onTitleSelect,
1920
})=>{
2021
switch(curView){
2122
caseTYPE.RESULT:{
@@ -26,7 +27,7 @@ const VideosList = ({
2627
key={uid.gen()}
2728
entry={entry}
2829
active={active}
29-
onTitleSelect={console.log}
30+
onTitleSelect={onTitleSelect.bind(this,entry)}
3031
/>
3132
))}
3233
</React.Fragment>

‎components/PagedContents/index.js‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@ const debug = makeDebugger('c:PagedContents:index')
1818

1919
constPagedContents=({
2020
thread,
21+
active,
2122
data:{ entries, pageNumber, pageSize, totalCount},
2223
curView,
2324
onPageChange,
25+
onTitleSelect,
2426
emptyPrefix,
2527
community,
2628
})=>(
2729
<React.Fragment>
2830
<ContentList
2931
thread={thread}
32+
active={active}
3033
entries={entries}
3134
curView={curView}
3235
emptyPrefix={emptyPrefix}
3336
community={community}
37+
onTitleSelect={onTitleSelect}
3438
/>
3539

3640
<Pagi
@@ -45,6 +49,7 @@ const PagedContents = ({
4549

4650
PagedContents.propTypes={
4751
thread:PropTypes.oneOf([THREAD.POST,THREAD.JOB,THREAD.VIDEO,THREAD.REPO]),
52+
active:PropTypes.object,
4853
data:PropTypes.shape({
4954
entries:PropTypes.array.isRequired,
5055
totalPages:PropTypes.number.isRequired,
@@ -58,17 +63,20 @@ PagedContents.propTypes = {
5863
TYPE.NOT_FOUND,
5964
TYPE.RESULT_EMPTY,
6065
]),
61-
onPageChange:PropTypes.func,
6266
emptyPrefix:PropTypes.string,
6367
community:PropTypes.string,
68+
onPageChange:PropTypes.func,
69+
onTitleSelect:PropTypes.func,
6470
}
6571

6672
PagedContents.defaultProps={
6773
thread:THREAD.POST,
74+
active:{},
6875
curView:TYPE.LOADING,
69-
onPageChange:debug,
7076
emptyPrefix:'',
7177
community:'javascript',
78+
onPageChange:debug,
79+
onTitleSelect:debug,
7280
}
7381

7482
exportdefaultPagedContents

‎containers/JobsThread/index.js‎

Lines changed: 9 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@ import TagsBar from '../TagsBar'
1414

1515
import{
1616
Affix,
17-
JobItemLoading,
18-
Pagi,
19-
EmptyThread,
2017
ContentFilter,
2118
BuyMeChuanChuan,
2219
Maybe,
23-
JobItem,
2420
PublishLabel,
21+
PagedContents,
2522
}from'../../components'
2623

2724
import{
@@ -35,41 +32,13 @@ import {
3532
PublishBtn,
3633
}from'./styles'
3734

38-
import{uid,makeDebugger,storePlug,TYPE,THREAD}from'../../utils'
35+
import{makeDebugger,storePlug,TYPE,THREAD}from'../../utils'
3936
import*aslogicfrom'./logic'
4037

4138
/* eslint-disable no-unused-vars */
4239
constdebug=makeDebugger('C:JobsThread')
4340
/* eslint-enable no-unused-vars */
4441

45-
constView=({ community, thread, entries, curView, active})=>{
46-
switch(curView){
47-
caseTYPE.RESULT:{
48-
return(
49-
<React.Fragment>
50-
{entries.map(entry=>(
51-
<JobItem
52-
entry={entry}
53-
key={uid.gen()}
54-
active={active}
55-
onTitleSelect={logic.onTitleSelect.bind(this,entry)}
56-
/>
57-
))}
58-
</React.Fragment>
59-
)
60-
}
61-
caseTYPE.RESULT_EMPTY:{
62-
return(
63-
<React.Fragment>
64-
<EmptyThreadcommunity={community}thread={thread}/>
65-
</React.Fragment>
66-
)
67-
}
68-
default:
69-
return<JobItemLoadingnum={3}/>
70-
}
71-
}
72-
7342
classJobsThreadContainerextendsReact.Component{
7443
componentWillMount(){
7544
const{ jobsThread}=this.props
@@ -92,8 +61,8 @@ class JobsThreadContainer extends React.Component {
9261
curRoute,
9362
}=jobsThread
9463

95-
const{ mainPath, subPath}=curRoute
96-
const{entries,totalCount, pageNumber, pageSize}=pagedJobsData
64+
const{ mainPath}=curRoute
65+
const{ totalCount}=pagedJobsData
9766

9867
return(
9968
<Wrapper>
@@ -112,20 +81,14 @@ class JobsThreadContainer extends React.Component {
11281
</FilterWrapper>
11382
</Maybe>
11483

115-
<View
84+
<PagedContents
85+
data={pagedJobsData}
11686
community={mainPath}
117-
thread={subPath}
118-
entries={entries}
87+
thread={THREAD.JOB}
11988
curView={curView}
12089
active={activeJob}
121-
/>
122-
123-
<Pagi
124-
left="-10px"
125-
pageNumber={pageNumber}
126-
pageSize={pageSize}
127-
totalCount={totalCount}
128-
onChange={logic.loadJobs}
90+
onTitleSelect={logic.onTitleSelect}
91+
onPageChange={logic.loadJobs}
12992
/>
13093
</LeftPart>
13194

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp