|
1 | 1 | importReactfrom'react'
|
| 2 | +importdynamicfrom'next/dynamic' |
2 | 3 |
|
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' |
7 | 15 |
|
8 | 16 | import{THREAD}from'../../utils'
|
9 | 17 |
|
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 | +})=>{ |
11 | 46 | switch(thread){
|
12 | 47 | caseTHREAD.JOB:{
|
13 | 48 | return(
|
14 |
| -<JobsList |
| 49 | +<DynamicJobsList |
15 | 50 | entries={entries}
|
| 51 | +active={active} |
16 | 52 | curView={curView}
|
17 | 53 | thread={thread}
|
18 | 54 | community={community}
|
19 | 55 | emptyPrefix={emptyPrefix}
|
| 56 | +onTitleSelect={onTitleSelect} |
20 | 57 | />
|
21 | 58 | )
|
22 | 59 | }
|
23 | 60 | caseTHREAD.VIDEO:{
|
24 | 61 | return(
|
25 |
| -<VideosList |
| 62 | +<DynamicVideosList |
26 | 63 | entries={entries}
|
| 64 | +active={active} |
27 | 65 | curView={curView}
|
28 | 66 | thread={thread}
|
29 | 67 | community={community}
|
30 | 68 | emptyPrefix={emptyPrefix}
|
| 69 | +onTitleSelect={onTitleSelect} |
31 | 70 | />
|
32 | 71 | )
|
33 | 72 | }
|
34 | 73 | caseTHREAD.REPO:{
|
35 | 74 | return(
|
36 |
| -<ReposList |
| 75 | +<DynamicReposList |
37 | 76 | entries={entries}
|
| 77 | +active={active} |
38 | 78 | curView={curView}
|
39 | 79 | thread={thread}
|
40 | 80 | community={community}
|
41 | 81 | emptyPrefix={emptyPrefix}
|
| 82 | +onTitleSelect={onTitleSelect} |
42 | 83 | />
|
43 | 84 | )
|
44 | 85 | }
|
45 | 86 | default:{
|
46 | 87 | return(
|
47 |
| -<PostsList |
| 88 | +<DynamicPostsList |
48 | 89 | entries={entries}
|
| 90 | +active={active} |
49 | 91 | curView={curView}
|
50 | 92 | thread={thread}
|
51 | 93 | community={community}
|
52 | 94 | emptyPrefix={emptyPrefix}
|
| 95 | +onTitleSelect={onTitleSelect} |
53 | 96 | />
|
54 | 97 | )
|
55 | 98 | }
|
|