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.

Commitd288887

Browse files
authored
fix(drawer): fix drawer close error (#1066)
* fix(drawer): event cycle error* chore(drawer): covert js -> ts* chore(drawer): covert js -> ts
1 parent31df66f commitd288887

File tree

23 files changed

+162
-60
lines changed

23 files changed

+162
-60
lines changed

‎src/containers/thread/PostsThread/logic.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const { SR71, $solver, asyncRes, asyncErr } = asyncSuit
2929
constsr71$=newSR71({
3030
receive:[
3131
EVENT.REFRESH_POSTS,
32-
EVENT.DRAWER.CLOSE,
32+
EVENT.DRAWER.AFTER_CLOSE,
3333
EVENT.COMMUNITY_CHANGE,
3434
EVENT.THREAD_CHANGE,
3535
EVENT.C11N_DENSITY_CHANGE,
@@ -215,7 +215,7 @@ const DataSolver = [
215215
},
216216
},
217217
{
218-
match:asyncRes(EVENT.DRAWER.CLOSE),
218+
match:asyncRes(EVENT.DRAWER.AFTER_CLOSE),
219219
action:()=>{
220220
store.setViewing({post:{}})
221221
store.markRoute({ ...store.filtersData, ...store.tagQuery})

‎src/containers/tool/Drawer/AddOn.js‎renamed to ‎src/containers/tool/Drawer/AddOn.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ import {
1313

1414
import{closeDrawer}from'./logic'
1515

16-
constAddOn=({ type, imageUploading})=>{
16+
typeTProps={
17+
type:string
18+
imageUploading?:boolean
19+
}
20+
21+
constAddOn:React.FC<TProps>=({ type, imageUploading=false})=>{
1722
return(
1823
<Wrapper>
19-
<CloseTabtype={type}onClick={closeDrawer}>
24+
<CloseTabtype={type}onClick={()=>closeDrawer()}>
2025
<CloserInner/>
2126
</CloseTab>
2227
<UploadingTabshow={imageUploading}>

‎src/containers/tool/Drawer/Content/DesktopView.js‎renamed to ‎src/containers/tool/Drawer/Content/DesktopView.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,14 @@ import CustomScroller from '@/components/CustomScroller'
55
importrenderContentfrom'./renderContent'
66
import{Wrapper}from'../styles/content'
77

8-
constContent=({ visible, type, attachment, attUser})=>{
8+
typeTProps={
9+
visible:boolean
10+
type:string// TODO:
11+
attachment:any// TODO:
12+
attUser:any// TODO:
13+
}
14+
15+
constContent:React.FC<TProps>=({ visible, type, attachment, attUser})=>{
916
constref=useRef(null)
1017

1118
/*

‎src/containers/tool/Drawer/Content/MobileView.js‎renamed to ‎src/containers/tool/Drawer/Content/MobileView.tsx‎

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,29 @@ import React, { useEffect, useRef, useState } from 'react'
22

33
importCustomScrollerfrom'@/components/CustomScroller'
44

5+
importtype{TSwipeOption}from'../spec'
56
importrenderContentfrom'./renderContent'
6-
7-
import{Wrapper}from'../styles/content'
87
import{getMobileContentHeight}from'../styles/metrics'
8+
import{Wrapper}from'../styles/content'
99
import{toggleSwipeAviliable,toggleHeaderTextVisiable}from'../logic'
1010

11-
constContent=({ visible, options, type, attachment, attUser, mmType})=>{
11+
typeTProps={
12+
visible:boolean
13+
options:TSwipeOption
14+
type:string// TODO
15+
attachment:any// TODO
16+
attUser:any// TODO
17+
mmType:string// TODO
18+
}
19+
20+
constContent:React.FC<TProps>=({
21+
visible,
22+
options,
23+
type,
24+
attachment,
25+
attUser,
26+
mmType,
27+
})=>{
1228
constref=useRef(null)
1329

1430
const[topEnterTimer,setTopEnterTimer]=useState(null)
@@ -48,7 +64,7 @@ const Content = ({ visible, options, type, attachment, attUser, mmType }) => {
4864
* 注意这个值是在桌面浏览器上反复试出的最佳值,过大或过小都不自然
4965
*/
5066
consttopEnterTimer=setTimeout(()=>{
51-
toggleSwipeAviliable('Down',true)
67+
toggleSwipeAviliable('down',true)
5268
},800)
5369

5470
/*
@@ -76,10 +92,10 @@ const Content = ({ visible, options, type, attachment, attUser, mmType }) => {
7692
setTopEnterTimer(null)
7793
}
7894

79-
toggleSwipeAviliable('Down',false)
95+
toggleSwipeAviliable('down',false)
8096
}}
81-
onBottomEnter={()=>toggleSwipeAviliable('Up',true)}
82-
onBottomLeave={()=>toggleSwipeAviliable('Up',false)}
97+
onBottomEnter={()=>toggleSwipeAviliable('up',true)}
98+
onBottomLeave={()=>toggleSwipeAviliable('up',false)}
8399
autoHide
84100
>
85101
<Wrapperref={ref}>

‎src/containers/tool/Drawer/Content/PlaceHolder.js‎renamed to ‎src/containers/tool/Drawer/Content/PlaceHolder.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { ICON_CMD } from '@/config'
44
// import { ICON_CMD } from '../../config'
55
import{Wrapper,SiteLogo,Desc}from'../styles/content/place_holder'
66

7-
constPlaceHolder=()=>{
7+
constPlaceHolder:React.FC=()=>{
88
return(
99
<Wrapper>
1010
<SiteLogosrc={`${ICON_CMD}/barcelona.png`}/>
File renamed without changes.

‎src/containers/tool/Drawer/Content/renderContent.js‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import ModeLineMenu from '@/containers/unit/ModeLineMenu'
55

66
importPlaceHolderfrom'./PlaceHolder'
77

8-
import{closeDrawer}from'../logic'
9-
108
import{
119
PostViewer,
1210
JobViewer,
@@ -33,20 +31,20 @@ const renderContent = (type, attachment, attUser, mmType) => {
3331
return<PostViewerattachment={attachment}/>
3432

3533
caseTYPE.DRAWER.POST_CREATE:
36-
return<PostEditoronClose={closeDrawer}/>
34+
return<PostEditor/>
3735

3836
caseTYPE.DRAWER.POST_EDIT:
39-
return<PostEditoronClose={closeDrawer}attachment={attachment}/>
37+
return<PostEditorattachment={attachment}/>
4038

4139
// job
4240
caseTYPE.DRAWER.JOB_CREATE:
43-
return<JobEditoronClose={closeDrawer}/>
41+
return<JobEditor/>
4442

4543
caseTYPE.DRAWER.JOB_VIEW:
4644
return<JobViewerattachment={attachment}/>
4745

4846
caseTYPE.DRAWER.JOB_EDIT:
49-
return<JobEditoronClose={closeDrawer}attachment={attachment}/>
47+
return<JobEditorattachment={attachment}/>
5048

5149
// repo
5250
caseTYPE.DRAWER.REPO_VIEW:

‎src/containers/tool/Drawer/Header/CloseLine.js‎renamed to ‎src/containers/tool/Drawer/Header/CloseLine.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ import { Wrapper, LeftLine, RightLine } from '../styles/header/close_line'
44

55
import{closeDrawer}from'../logic'
66

7-
constCloseLine=({ curve})=>{
7+
typeTProps={
8+
curve:boolean
9+
}
10+
11+
constCloseLine:React.FC<TProps>=({ curve})=>{
812
return(
9-
<WrapperonClick={closeDrawer}>
13+
<WrapperonClick={()=>closeDrawer()}>
1014
<LeftLinecurve={curve}/>
1115
<RightLinecurve={curve}/>
1216
</Wrapper>

‎src/containers/tool/Drawer/Header/index.js‎renamed to ‎src/containers/tool/Drawer/Header/index.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,23 @@ import React from 'react'
33
import{useSwipe}from'@/hooks'
44
import{nilOrEmpty}from'@/utils'
55

6+
importtype{TSwipeOption}from'../spec'
67
importCloseLinefrom'./CloseLine'
78
import{TopWrapper,BottomWrapper,TextWrapper}from'../styles/header'
89
import{onSwipedYHandler,onSwipingYHandler}from'../logic'
910

1011
/* <TextWrapper>评论共 167 条</TextWrapper> */
1112

12-
constHeader=({
13+
typeTProps={
14+
headerText?:string
15+
options:TSwipeOption
16+
setSwipeUpY:(i:number)=>void
17+
setSwipeDownY:(i:number)=>void
18+
canBeClose:boolean
19+
showHeaderText:boolean
20+
}
21+
22+
constHeader:React.FC<TProps>=({
1323
headerText,
1424
options,
1525
setSwipeUpY,

‎src/containers/tool/Drawer/Viewer/DesktopView.js‎renamed to ‎src/containers/tool/Drawer/Viewer/DesktopView.tsx‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
importReactfrom'react'
22

3+
importtype{TSwipeOption}from'../spec'
34
importAddOnfrom'../AddOn'
45

56
import{DrawerOverlay,DrawerWrapper,DrawerContent}from'../styles'
67
import{closeDrawer}from'../logic'
78

8-
constDesktopView=({
9+
typeTProps={
10+
testid?:string
11+
options:TSwipeOption
12+
visible:boolean
13+
rightOffset:string
14+
type:string
15+
imageUploading:boolean
16+
children:React.ReactNode
17+
}
18+
19+
constDesktopView:React.FC<TProps>=({
20+
testid='drawer-sidebar-panel',
921
options,
1022
visible,
1123
rightOffset,
@@ -15,9 +27,9 @@ const DesktopView = ({
1527
})=>{
1628
return(
1729
<React.Fragment>
18-
<DrawerOverlayvisible={visible}onClick={closeDrawer}/>
30+
<DrawerOverlayvisible={visible}onClick={()=>closeDrawer()}/>
1931
<DrawerWrapper
20-
testid="drawer-sidebar-panel"
32+
testid={testid}
2133
visible={visible}
2234
rightOffset={rightOffset}
2335
type={type}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp