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

Commit85f11a4

Browse files
committed
update tutorials loading for new api
1 parenta5da2d2 commit85f11a4

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

‎web-app/src/containers/New/TutorialList/index.tsx

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,26 @@ interface Props {
99
}
1010

1111
constTutorialList=(props:Props)=>{
12-
constonSelect=(tutorial:T.Tutorial)=>{
13-
channel.machineSend({
14-
type:'TUTORIAL_START',
15-
payload:{
16-
tutorial,
17-
}
18-
})
19-
}
20-
return(
21-
<div>
22-
{props.tutorialList.map((tutorial:T.Tutorial)=>(
23-
<TutorialItem
24-
key={tutorial.id}
25-
onSelect={()=>onSelect(tutorial)}
26-
title={tutorial.title||''}
27-
text={tutorial.text||''}
28-
/>
29-
))}
30-
</div>
31-
)
12+
constonSelect=(tutorial:T.Tutorial)=>{
13+
channel.machineSend({
14+
type:'TUTORIAL_START',
15+
payload:{
16+
tutorial,
17+
},
18+
})
19+
}
20+
return(
21+
<div>
22+
{props.tutorialList.map((tutorial:T.Tutorial)=>(
23+
<TutorialItem
24+
key={tutorial.id}
25+
onSelect={()=>onSelect(tutorial)}
26+
title={tutorial.version.summary.title||''}
27+
text={tutorial.version.summary.description||''}
28+
/>
29+
))}
30+
</div>
31+
)
3232
}
3333

3434
exportdefaultTutorialList

‎web-app/src/containers/New/index.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import*asReactfrom'react'
22
import{useQuery}from'@apollo/react-hooks'
3-
import*asTfrom'typings/graphql'
3+
import*asGfrom'typings/graphql'
44
import*asCRfrom'typings'
55

66
importqueryTutorialsfrom'../../services/apollo/queries/tutorials'
@@ -9,7 +9,7 @@ import ErrorView from '../../components/Error'
99
importTutorialListfrom'./TutorialList'
1010

1111
interfaceProps{
12-
tutorialList:T.Tutorial[]
12+
tutorialList:G.Tutorial[]
1313
}
1414

1515
exportconstNewPage=(props:Props)=>(
@@ -25,8 +25,12 @@ interface ContainerProps {
2525
send(action:CR.Action):void
2626
}
2727

28+
interfaceTutorialsData{
29+
tutorials:G.Tutorial[]
30+
}
31+
2832
constNewPageContainer=(props:ContainerProps)=>{
29-
const{ data, loading, error}=useQuery(queryTutorials)
33+
const{ data, loading, error}=useQuery<TutorialsData>(queryTutorials)
3034
if(loading){
3135
return<Loading/>
3236
}
@@ -35,6 +39,10 @@ const NewPageContainer = (props: ContainerProps) => {
3539
return<ErrorViewerror={error}/>
3640
}
3741

42+
if(!data){
43+
returnnull
44+
}
45+
3846
return(
3947
<React.Suspensefallback={Loading}>
4048
<NewPagetutorialList={data.tutorials}/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp