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

Commit 0e1e419

Browse files
committed
feat(UserPage): add previewer for starred/favroted contents
1 parent ef3ce45 commit 0e1e419

File tree

4 files changed

+30
-4
lines changed

4 files changed

+30
-4
lines changed

containers/UserFavorited/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,9 @@ class UserFavoritesContainer extends React.Component {
5656
data={pagedData}
5757
thread={curThread}
5858
curView={curView}
59-
onPageChange={debug}
6059
emptyPrefix={`未找到 ${viewingUser.nickname} 收藏的`}
60+
onPageChange={logic.reload}
61+
onTitleSelect={logic.onTitleSelect}
6162
/>
6263
</React.Fragment>
6364
)}

containers/UserFavorited/logic.js

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

33
import {
44
makeDebugger,
5+
dispatchEvent,
56
$solver,
67
asyncRes,
78
TYPE,
89
pagedFilter,
910
THREAD,
11+
EVENT,
1012
} from '../../utils'
1113
import SR71 from '../../utils/network/sr71'
1214

@@ -83,6 +85,16 @@ export const changeFavoriteThread = curThread => {
8385
reload()
8486
}
8587

88+
export function onTitleSelect(data) {
89+
const { curThread: thread } = store
90+
91+
dispatchEvent(EVENT.PREVIEW_OPEN, {
92+
type: TYPE[`PREVIEW_${R.toUpper(thread)}_VIEW`],
93+
thread,
94+
data,
95+
})
96+
}
97+
8698
// ###############################
8799
// Data & Error handlers
88100
// ###############################

containers/UserStared/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ class UserStaredContainer extends React.Component {
4444
data={pagedData}
4545
thread={curThread}
4646
curView={curView}
47-
onPageChange={logic.reload}
4847
emptyPrefix={`未找到 ${viewingUser.nickname} 喜欢的`}
48+
onPageChange={logic.reload}
49+
onTitleSelect={logic.onTitleSelect}
4950
/>
5051
</React.Fragment>
5152
)

containers/UserStared/logic.js

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

33
import {
44
makeDebugger,
5+
dispatchEvent,
56
$solver,
67
asyncRes,
78
asyncErr,
89
ERR,
910
TYPE,
11+
EVENT,
1012
THREAD,
1113
pagedFilter,
1214
} from '../../utils'
@@ -67,6 +69,16 @@ export function onThreadChange(curThread) {
6769
reload()
6870
}
6971

72+
export function onTitleSelect(data) {
73+
const { curThread: thread } = store
74+
75+
dispatchEvent(EVENT.PREVIEW_OPEN, {
76+
type: TYPE[`PREVIEW_${R.toUpper(thread)}_VIEW`],
77+
thread,
78+
data,
79+
})
80+
}
81+
7082
// ###############################
7183
// Data & Error handlers
7284
// ###############################

0 commit comments

Comments
 (0)