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.

Commit6fe5989

Browse files
committed
chore: merge branch 'dev'
2 parentsf20cb46 +d485ed7 commit6fe5989

File tree

14 files changed

+129
-50
lines changed

14 files changed

+129
-50
lines changed

‎components/Navigator/index.js‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@ import BriefView from './BriefView'
1616
constdebug=makeDebugger('c:Navigator:index')
1717

1818
constNavigator=({ curCommunity, layout, curRoute})=>{
19+
const{ mainPath, subPath}=curRoute
20+
1921
if(
20-
R.contains(curRoute.mainPath,[ROUTE.USER,ROUTE.COMMUNITIES])||
21-
R.contains(curRoute.subPath,[
22-
ROUTE.POST,
23-
ROUTE.JOB,
24-
ROUTE.VIDEO,
25-
ROUTE.REPO,
26-
])
22+
R.contains(mainPath,[ROUTE.USER,ROUTE.COMMUNITIES])||
23+
R.contains(subPath,[ROUTE.POST,ROUTE.JOB,ROUTE.VIDEO,ROUTE.REPO])
2724
){
2825
return<DigestView/>
2926
}

‎components/Pagi/index.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Pagination } from 'antd'
99
importPropTypesfrom'prop-types'
1010

1111
import{makeDebugger}from'utils'
12-
import{PagiWrapper,BottomMsg}from'./styles'
12+
import{PagiWrapper,CustomText,BottomMsg}from'./styles'
1313

1414
/* eslint-disable-next-line */
1515
constdebug=makeDebugger('c:Pagi:index')
@@ -19,9 +19,9 @@ const hasExtraPage = (totalCount, pageSize) => totalCount > pageSize
1919
exportconstPagiCustomRender=(current,type,originalElement)=>{
2020
/* eslint-disable */
2121
if(type==='prev'){
22-
return<a>上一页</a>
22+
return<CustomText>上一页</CustomText>
2323
}elseif(type==='next'){
24-
return<a>下一页</a>
24+
return<CustomText>下一页</CustomText>
2525
}
2626
/* eslint-enable */
2727
returnoriginalElement

‎components/Pagi/styles/index.js‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
importstyledfrom'styled-components'
2-
import{theme}from'utils'
2+
import{theme,cs}from'utils'
33

44
exportconstPagiWrapper=styled.div`
55
text-align: center;
@@ -8,6 +8,10 @@ export const PagiWrapper = styled.div`
88
margin-left:${({ left})=>left};
99
`
1010

11+
exportconstCustomText=styled.a`
12+
${cs.media.tablet`display: none`};
13+
`
14+
1115
exportconstBottomMsg=styled.div`
1216
font-size: 1.1rem;
1317
color:${theme('thread.articleDigest')};

‎containers/BodyLayout/index.js‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
/*
2-
*
3-
* BodyLayout
4-
*
5-
*/
2+
*
3+
* BodyLayout
4+
*
5+
*/
66

77
importReactfrom'react'
88
importPropTypesfrom'prop-types'
99
import{inject,observer}from'mobx-react'
1010
importkeydownfrom'react-keydown'
1111

1212
// import Link from 'next/link'
13+
import{ICON_CMD}from'config'
1314

1415
import{storePlug}from'utils'
1516

16-
importWrapperfrom'./styles'
17+
import{Wrapper,SubCommunitiesExpander,ExpanderIcon}from'./styles'
1718
import*aslogicfrom'./logic'
1819

1920
classBodyLayoutContainerextendsReact.Component{
@@ -38,6 +39,9 @@ class BodyLayoutContainer extends React.Component {
3839

3940
return(
4041
<WrappersidebarPin={sidebarPin}noSidebar={noSidebar}>
42+
<SubCommunitiesExpanderonClick={logic.queryDoraemon.bind(this,'/')}>
43+
<ExpanderIconsrc={`${ICON_CMD}/expander_more.svg`}/>
44+
</SubCommunitiesExpander>
4145
{children}
4246
</Wrapper>
4347
)

‎containers/BodyLayout/logic.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
import{makeDebugger}from'utils'
1+
import{makeDebugger,dispatchEvent,EVENT}from'utils'
22

33
/* eslint-disable-next-line */
44
constdebug=makeDebugger('L:BodyLayout')
55

66
letstore=null
77

88
exportconstopenDoraemon=()=>store.openDoraemon()
9+
exportconstqueryDoraemon=data=>
10+
dispatchEvent(EVENT.QUERY_DORAMON,{ data})
911

1012
exportconstinit=_store=>{
1113
if(store)returnfalse
Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
importstyledfrom'styled-components'
22
import{theme,cs}from'utils'
33

4+
importImgfrom'components/Img'
5+
46
// transition: background-color 0.2s;
5-
constWrapper=styled.div`
7+
exportconstWrapper=styled.div`
68
${cs.flexColumn()};
79
padding-left:${({ noSidebar})=>(noSidebar ?'0' :'56px')};
810
position: relative;
@@ -12,8 +14,32 @@ const Wrapper = styled.div`
1214
margin-left:${({ sidebarPin})=>(sidebarPin ?'180px' :'0')};
1315
transition: all 0.2s;
1416
overflow-x:${({ sidebarPin})=>(sidebarPin ?'hidden' :'')};
15-
${cs.media.tablet`padding-left: 0`};
17+
${cs.media.tablet`
18+
position: relative;
19+
padding-left: 0;
20+
`};
21+
`
22+
exportconstSubCommunitiesExpander=styled.div`
23+
display: none;
24+
${cs.media.tablet`
25+
${cs.flex('align-both')};
26+
width: 30px;
27+
position: fixed;
28+
top: 10%;
29+
left: 0;
30+
z-index: 100;
31+
border: 1px solid;
32+
border-color:${theme('content.cardBg')};
33+
border-radius: 0 10px 10px 0;
34+
height: 40px;
35+
background-color:${theme('banner.numberHoverBg')};
36+
box-shadow:${theme('preview.shadow')};
37+
`};
1638
`
17-
/* overflow-x: hidden; */
1839

19-
exportdefaultWrapper
40+
// expander_more
41+
exportconstExpanderIcon=styled(Img)`
42+
fill${theme('banner.desc')};
43+
width: 18px;
44+
height: 20px;
45+
`

‎containers/Doraemon/helper/swissArmyKnife.js‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const anyNil = R.any(R.isNil)
1414
exportclassSwissArmyKnife{
1515
constructor(store){
1616
this.store=store
17-
this.communities=R.keys(store.communities)
17+
this.communities=R.pluck('raw',store.subscribedCommunities)
1818
}
1919

2020
completeInput=(into=false)=>{
@@ -71,8 +71,14 @@ export class SwissArmyKnife {
7171
}
7272

7373
// TODO rename to linker
74-
communityLinker=cmdpath=>
75-
R.and(R.contains(R.head(cmdpath),this.communities),lengthE1(cmdpath))
74+
communityLinker=cmdpath=>{
75+
// console.log('communityLinker: ', cmdpath)
76+
// console.log('communityLinker this.communities: ', this.communities)
77+
returnR.and(
78+
R.contains(R.head(cmdpath),this.communities),
79+
lengthE1(cmdpath)
80+
)
81+
}
7682

7783
communityInsideLinker=cmdpath=>
7884
R.and(R.contains(R.head(cmdpath),this.communities),lengthE2(cmdpath))

‎containers/Doraemon/logic.js‎

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ import {
1313
EVENT,
1414
TYPE,
1515
ERR,
16+
ROUTE,
1617
prettyNum,
18+
thread2Subpath,
1719
THREAD,
1820
cutFrom,
1921
errRescue,
@@ -180,17 +182,29 @@ const initSpecCmdResolver = () => {
180182
{
181183
match:SAK.communityLinker,
182184
action:cmdpath=>{
183-
debug('communityLinker: ',cmdpath)
185+
constcommunity=cmdpath[0]
186+
const{ mainPath, subPath}=store.curRoute
187+
188+
if(
189+
R.contains(mainPath,[ROUTE.USER,ROUTE.COMMUNITIES])||
190+
R.contains(subPath,[ROUTE.POST,ROUTE.JOB,ROUTE.VIDEO,ROUTE.REPO])
191+
){
192+
Global.location.href=`/${community}/posts`
193+
returnhidePanel()
194+
}
184195

185-
// Router.push(url, as)
186-
// TODO: use route store method
187-
Router.push(
188-
{
189-
pathname:'/',
190-
query:{main:cmdpath[0]},
191-
},
192-
cmdpath[0]
193-
)
196+
store.setViewing({
197+
community:{raw:community},
198+
activeThread:THREAD.POST,
199+
post:{},
200+
})
201+
202+
store.markRoute({
203+
mainPath:community,
204+
subPath:thread2Subpath(THREAD.POST),
205+
})
206+
207+
dispatchEvent(EVENT.COMMUNITY_CHANGE)
194208
hidePanel()
195209
},
196210
},
@@ -207,6 +221,8 @@ const doSpecCmd = () => {
207221
constcmd=store.curCmdChain
208222
if(!cmd)return
209223

224+
debug('doSpecCmd cmd: ',cmd)
225+
210226
/* Do not use forEach, cause forEach will not break */
211227
for(leti=0;i<cmdResolver.length;i+=1){
212228
if(cmdResolver[i].match(cmd)){
@@ -434,7 +450,11 @@ const DataSolver = [
434450
match:asyncRes(EVENT.QUERY_DORAMON),
435451
action:res=>{
436452
const{ data}=res[EVENT.QUERY_DORAMON]
437-
store.open()
453+
constforcus=false
454+
store.open(forcus)
455+
456+
/* "doraemonInputbar" */
457+
438458
store.markState({inputValue:data})
439459
queryPocket()
440460
},

‎containers/Doraemon/store.js‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ const DoraemonStore = t
7676
getroot(){
7777
returngetParent(self)
7878
},
79+
getcurRoute(){
80+
returnself.root.curRoute
81+
},
7982
getcurCmdChain(){
8083
if(!self.cmdChain&&self.activeRaw){
8184
return[self.activeRaw]
@@ -126,6 +129,9 @@ const DoraemonStore = t
126129
},
127130
}))
128131
.actions(self=>({
132+
markRoute(query){
133+
self.root.markRoute(query)
134+
},
129135
toast(type,options){
130136
self.root.toast(type,options)
131137
},
@@ -184,14 +190,12 @@ const DoraemonStore = t
184190
activeRaw:nextActiveRaw,
185191
})
186192
},
187-
activeTo(raw){
188-
self.markState({
189-
activeRaw:raw,
190-
})
193+
activeTo(activeRaw){
194+
self.markState({ activeRaw})
191195
},
192-
open(){
196+
open(forcus=true){
193197
self.visible=true
194-
focusDoraemonBar()
198+
if(forcus)focusDoraemonBar()
195199
},
196200
handleLogin(){
197201
self.open()
@@ -205,6 +209,9 @@ const DoraemonStore = t
205209
self.clearSuggestions()
206210
hideDoraemonBarRecover()
207211
},
212+
setViewing(sobj){
213+
self.root.setViewing(sobj)
214+
},
208215
markState(sobj){
209216
markStates(sobj,self)
210217
},

‎containers/Footer/MobilBottomInfo.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
ThxTitle,
1414
}from'./styles/mobile_bottom_info'
1515

16-
import{toggleBusBanner,openDoraemon}from'./logic'
16+
import{toggleBusBanner,queryDoraemon}from'./logic'
1717

1818
constMobileBottomInfo=()=>(
1919
<React.Fragment>
@@ -22,9 +22,7 @@ const MobileBottomInfo = () => (
2222
所有社区
2323
</ItemBtn>
2424
<DotDividerradius="4px"/>
25-
<ItemBtnonClick={openDoraemon.bind(this,'/')}>我的关注</ItemBtn>
26-
<DotDividerradius="4px"/>
27-
<ItemBtnonClick={openDoraemon.bind(this,'/theme/')}>切换主题</ItemBtn>
25+
<ItemBtnonClick={queryDoraemon.bind(this,'/theme/')}>切换主题</ItemBtn>
2826
</LinkInfoWrapper>
2927

3028
<SiteInfoWrapper>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp