Skip to content
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commit 56f9b1c

Browse files
committed
refactor(footer): add real logic to mobile footer
1 parent 28f1f23 commit 56f9b1c

File tree

4 files changed

+29
-18
lines changed

4 files changed

+29
-18
lines changed

containers/Doraemon/logic.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import { SwissArmyKnife } from './helper/swissArmyKnife'
2525
import githubLoginHandler from './oauth/github_handler'
2626

2727
const debug = makeDebugger('L:Doraemon')
28-
const sr71$ = new SR71()
28+
const sr71$ = new SR71({
29+
resv_event: [EVENT.QUERY_DORAMON],
30+
})
2931

3032
let sub$ = null
3133
let store = null
@@ -428,6 +430,15 @@ const DataSolver = [
428430
convert2Sugguestions(data, totalCount)
429431
},
430432
},
433+
{
434+
match: asyncRes(EVENT.QUERY_DORAMON),
435+
action: res => {
436+
const { data } = res[EVENT.QUERY_DORAMON]
437+
store.open()
438+
store.markState({ inputValue: data })
439+
queryPocket()
440+
},
441+
},
431442
]
432443

433444
const ErrSolver = [

containers/Footer/MobilBottomInfo.js

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

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

1818
const MobileBottomInfo = () => (
1919
<React.Fragment>
2020
<LinkInfoWrapper>
21-
<ItemBtn href="/communities" rel="noopener noreferrer" target="_blank">
21+
<ItemBtn as="a" href="/communities" rel="noopener noreferrer">
2222
所有社区
2323
</ItemBtn>
2424
<DotDivider radius="4px" />
25-
<ItemBtn href="/communities" rel="noopener noreferrer" target="_blank">
26-
我的关注
27-
</ItemBtn>
28-
<DotDivider radius="4px" />
29-
<ItemBtn
30-
href={`${GITHUB_WEB_ADDR}`}
31-
rel="noopener noreferrer"
32-
target="_blank"
33-
>
34-
主题
35-
</ItemBtn>
25+
<ItemBtn onClick={openDoraemon.bind(this, '/')}>我的关注</ItemBtn>
3626
<DotDivider radius="4px" />
37-
<ItemBtn href={`${ISSUE_ADDR}`} rel="noopener noreferrer" target="_blank">
38-
打赏
39-
</ItemBtn>
27+
<ItemBtn onClick={openDoraemon.bind(this, '/theme/')}>切换主题</ItemBtn>
4028
</LinkInfoWrapper>
4129

4230
<SiteInfoWrapper>

containers/Footer/logic.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
// import R from 'ramda'
22

3-
import { makeDebugger, $solver, PAYMENT_USAGE } from 'utils'
3+
import {
4+
makeDebugger,
5+
$solver,
6+
dispatchEvent,
7+
EVENT,
8+
PAYMENT_USAGE,
9+
} from 'utils'
410
import SR71 from 'utils/async/sr71'
511

612
// import S from './schema'
@@ -27,6 +33,9 @@ export const onPay = num => {
2733
if (!store.isLogin) return store.authWarning()
2834
store.cashierHelper({ paymentUsage: PAYMENT_USAGE.DONATE, amount: num })
2935
}
36+
37+
export const openDoraemon = data => dispatchEvent(EVENT.QUERY_DORAMON, { data })
38+
3039
// ###############################
3140
// Data & Error handlers
3241
// ###############################

utils/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export const EVENT = {
4949
// upload
5050
UPLOAD_IMG_START: 'UPLOAD_IMG_START',
5151
UPLOAD_IMG_FINISH: 'UPLOAD_IMG_FINISH',
52+
53+
// doramon
54+
QUERY_DORAMON: 'QUERY_DORAMON',
5255
}
5356

5457
export const TYPE = {

0 commit comments

Comments
 (0)