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

Commit 605aa7a

Browse files
committed
refactor(media-query): jump to user page on mobile/tablet view
1 parent 8c2ff6a commit 605aa7a

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

containers/Preview/logic.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
$solver,
44
makeDebugger,
55
EVENT,
6+
TYPE,
67
holdPage,
78
unholdPage,
89
dispatchEvent,
@@ -44,16 +45,21 @@ const DataResolver = [
4445
match: asyncRes(EVENT.PREVIEW_OPEN),
4546
action: res => {
4647
const payload = res[EVENT.PREVIEW_OPEN]
47-
4848
/*
4949
debug('should open payload thread: ', payload.thread)
5050
debug('should open payload id: ', payload.data.id)
5151
debug('payload curCommunity: ', store.curCommunity.raw)
5252
*/
53-
Global.innerWidth <= cs.mediaBreakPoints.mobile
53+
5454
if (Global.innerWidth <= cs.mediaBreakPoints.tablet) {
55-
const { thread, data } = payload
56-
const targetUrl = `/${store.curCommunity.raw}/${thread}/${data.id}`
55+
const { thread, data, type } = payload
56+
let targetUrl
57+
if (type === TYPE.PREVIEW_USER_VIEW) {
58+
targetUrl = `/user/${data.login}`
59+
} else {
60+
targetUrl = `/${store.curCommunity.raw}/${thread}/${data.id}`
61+
}
62+
5763
Global.location.href = targetUrl
5864
return false
5965
}

0 commit comments

Comments
 (0)