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.

Commit69d2ff4

Browse files
committed
new route strategies
1 parente3c9966 commit69d2ff4

File tree

32 files changed

+387
-224
lines changed

32 files changed

+387
-224
lines changed

‎components/index.js‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export { default as Navigator } from './Navigator'
2121
export{defaultasThemeSelector}from'./ThemeSelector'
2222

2323
export{defaultasCommunityMatrix}from'./CommunityMatrix'
24+
export{defaultasGAWraper}from'./GAWraper'
25+
export{defaultasFooter}from'./Footer'
2426

2527
// Table cell
2628
export{defaultasAdderCell}from'./AdderCell'

‎containers/Banner/index.js‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
*
3+
* Banner
4+
*
5+
*/
6+
7+
importReactfrom'react'
8+
import{inject,observer}from'mobx-react'
9+
10+
// import Link from 'next/link'
11+
12+
import{CommunityBanner,CommunitiesBanner}from'../../containers'
13+
import{makeDebugger,storePlug,ROUTE}from'../../utils'
14+
import*aslogicfrom'./logic'
15+
16+
/* eslint-disable no-unused-vars */
17+
constdebug=makeDebugger('C:Banner')
18+
/* eslint-enable no-unused-vars */
19+
20+
constDomainBanner=({ curRoute})=>{
21+
switch(curRoute.mainPath){
22+
caseROUTE.COMMUNITIES:{
23+
return<CommunitiesBanner/>
24+
}
25+
default:{
26+
return<CommunityBanner/>
27+
}
28+
}
29+
}
30+
31+
/*
32+
NOTE: this container is only used for dev mode
33+
for some unkown reasion, pages/index will always be the entry in dev mode
34+
*/
35+
classBannerContainerextendsReact.Component{
36+
componentWillMount(){
37+
logic.init(this.props.banner)
38+
}
39+
40+
render(){
41+
const{ curRoute}=this.props.banner
42+
43+
return<DomainBannercurRoute={curRoute}/>
44+
}
45+
}
46+
47+
exportdefaultinject(storePlug('banner'))(observer(BannerContainer))

‎containers/Banner/logic.js‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// import R from 'ramda'
2+
3+
import{makeDebugger,$solver}from'../../utils'
4+
importSR71from'../../utils/network/sr71'
5+
6+
constsr71$=newSR71()
7+
letsub$=null
8+
9+
/* eslint-disable no-unused-vars */
10+
constdebug=makeDebugger('L:Banner')
11+
/* eslint-enable no-unused-vars */
12+
13+
letbanner=null
14+
15+
exportfunctionsomeMethod(){}
16+
17+
// ###############################
18+
// Data & Error handlers
19+
// ###############################
20+
21+
constDataSolver=[]
22+
constErrSolver=[]
23+
24+
exportfunctioninit(selectedStore){
25+
banner=selectedStore
26+
debug(banner)
27+
if(sub$)sub$.unsubscribe()
28+
sub$=sr71$.data().subscribe($solver(DataSolver,ErrSolver))
29+
}

‎containers/Banner/styles/index.js‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// import styled from 'styled-components'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// import React from 'react'
2+
// import { shallow } from 'enzyme'
3+
4+
// import Banner from '../index'
5+
6+
describe('TODO <Banner />',()=>{
7+
it('Expect to have unit tests specified',()=>{
8+
expect(true).toEqual(true)
9+
})
10+
})

‎containers/CommunitiesBanner/index.js‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
importReactfrom'react'
22
import{inject,observer}from'mobx-react'
33

4-
import{storePlug,makeDebugger,ROUTE}from'../../utils'
4+
import{storePlug,makeDebugger,ROUTE,stripMobx}from'../../utils'
55

66
import*aslogicfrom'./logic'
77

@@ -20,7 +20,7 @@ import { BannerContainer } from './styles'
2020
constdebug=makeDebugger('C:CommunitiesBanner')
2121
/* eslint-enable no-unused-vars */
2222

23-
constrenderChildBanner=(route,store)=>{
23+
constChildBanner=({ curRoute, store})=>{
2424
const{
2525
// communities
2626
totalCount,
@@ -42,7 +42,7 @@ const renderChildBanner = (route, store) => {
4242
filteredJobsCount,
4343
}=store
4444

45-
switch(route.subPath){
45+
switch(curRoute.subPath){
4646
caseROUTE.CATEGORIES:{
4747
return(
4848
<CategoryBanner
@@ -61,7 +61,7 @@ const renderChildBanner = (route, store) => {
6161
)
6262
}
6363
caseROUTE.EDITORS:{
64-
return<EditorsBannertotalCount={100}filteredCount={10}/>
64+
return<EditorsBannertotalCount={102}filteredCount={10}/>
6565
}
6666
caseROUTE.THREADS:{
6767
return(
@@ -104,13 +104,12 @@ class CommunitiesBannerContainer extends React.Component {
104104
}
105105
render(){
106106
const{ communitiesBanner}=this.props
107-
const{ route}=communitiesBanner
108-
/* const { detail } = banner */
109-
/* const restProps = { ...this.props.communitiesBanner } */
107+
const{ curRoute}=communitiesBanner
110108

109+
// console.log('totalCount --> ', communitiesBanner.totalCount)
111110
return(
112111
<BannerContainer>
113-
{renderChildBanner(route,communitiesBanner)}
112+
<ChildBannercurRoute={curRoute}store={stripMobx(communitiesBanner)}/>
114113
</BannerContainer>
115114
)
116115
}

‎containers/CommunitiesContent/index.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import * as logic from './logic'
2525
constdebug=makeDebugger('C:CommunitiesContent')
2626
/* eslint-enable no-unused-vars */
2727

28-
constrenderChildContent=(route,store,restProps)=>{
28+
constrenderChildContent=(curRoute,store,restProps)=>{
2929
const{
3030
pagedCommunitiesData,
3131
pagedCategoriesData,
@@ -35,7 +35,7 @@ const renderChildContent = (route, store, restProps) => {
3535
pagedJobsData,
3636
}=store
3737

38-
switch(route.subPath){
38+
switch(curRoute.subPath){
3939
caseROUTE.TAGS:{
4040
return<TagsContentdata={pagedTagsData}restProps={restProps}/>
4141
}
@@ -69,12 +69,12 @@ class CommunitiesContentContainer extends React.Component {
6969

7070
render(){
7171
const{ communitiesContent}=this.props
72-
const{route}=communitiesContent
72+
const{curRoute}=communitiesContent
7373
constrestProps={ ...this.props.communitiesContent}
7474

7575
return(
7676
<Wrapper>
77-
{renderChildContent(route,communitiesContent,restProps)}
77+
{renderChildContent(curRoute,communitiesContent,restProps)}
7878
</Wrapper>
7979
)
8080
}

‎containers/CommunitiesContent/logic.js‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ export function loadCommunities(page = 1) {
4848

4949
communitiesContent.markState({communitiesLoading:true})
5050

51-
/*communitiesContent.markQuery({ page, size }) */
52-
communitiesContent.markQuery({ page})
51+
communitiesContent.markRoute({ page})
52+
communitiesContent.markRoute({ page})
5353
const{ route}=communitiesContent
5454

5555
args.filter=R.merge(args.filter,route.query)
@@ -59,17 +59,16 @@ export function loadCommunities(page = 1) {
5959
exportfunctionloadCategories(page=1){
6060
scrollIntoEle(TYPE.APP_HEADER_ID)
6161
/* const size = PAGE_SIZE.COMMON */
62-
/*communitiesContent.markQuery({ page, size }) */
62+
communitiesContent.markRoute({ page})
6363

6464
communitiesContent.markState({categoriessLoading:true})
6565
sr71$.query(S.pagedCategories,commonFilter(page))
6666
}
6767

6868
exportfunctionloadTags(page=1){
69-
constsize=PAGE_SIZE.COMMON
7069
scrollIntoEle(TYPE.APP_HEADER_ID)
7170

72-
communitiesContent.markQuery({ page, size})
71+
communitiesContent.markRoute({ page})
7372
communitiesContent.markState({tagsLoading:true})
7473

7574
sr71$.query(S.pagedTags,commonFilter(page))
@@ -78,7 +77,7 @@ export function loadTags(page = 1) {
7877
exportfunctionloadThreads(page=1){
7978
/* const size = PAGE_SIZE.COMMON */
8079
scrollIntoEle(TYPE.APP_HEADER_ID)
81-
/*communitiesContent.markQuery({ page, size }) */
80+
communitiesContent.markRoute({ page})
8281
/* */
8382
communitiesContent.markState({tagsLoading:true})
8483
sr71$.query(S.pagedThreads,commonFilter(page))

‎containers/CommunityBanner/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const renderChildBanner = (route, store) => {
5454
)
5555
}
5656
caseROUTE.THREADS:{
57-
return<ThreadsBannertotalCount={200}filteredCount={100}/>
57+
return<ThreadsBannertotalCount={301}filteredCount={100}/>
5858
}
5959
default:{
6060
return<h2>Index of Community</h2>

‎containers/Content/index.js‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
*
3+
* Content
4+
*
5+
*/
6+
7+
importReactfrom'react'
8+
import{inject,observer}from'mobx-react'
9+
10+
// import Link from 'next/link'
11+
import{CommunityContent,CommunitiesContent}from'../../containers'
12+
13+
import{makeDebugger,storePlug,ROUTE}from'../../utils'
14+
import*aslogicfrom'./logic'
15+
16+
/* eslint-disable no-unused-vars */
17+
constdebug=makeDebugger('C:Content')
18+
/* eslint-enable no-unused-vars */
19+
20+
constDomainContent=({ curRoute})=>{
21+
switch(curRoute.mainPath){
22+
caseROUTE.COMMUNITIES:{
23+
return<CommunitiesContent/>
24+
}
25+
default:{
26+
return<CommunityContent/>
27+
}
28+
}
29+
}
30+
31+
/*
32+
NOTE: this container is only used for dev mode
33+
for some unkown reasion, pages/index will always be the entry in dev mode
34+
*/
35+
classContentContainerextendsReact.Component{
36+
componentWillMount(){
37+
logic.init(this.props.content)
38+
}
39+
40+
render(){
41+
const{ curRoute}=this.props.content
42+
43+
return<DomainContentcurRoute={curRoute}/>
44+
}
45+
}
46+
47+
exportdefaultinject(storePlug('content'))(observer(ContentContainer))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp