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

Commit8342bb2

Browse files
committed
typings update first pass
1 parent4d2cfd6 commit8342bb2

File tree

32 files changed

+160
-566
lines changed

32 files changed

+160
-566
lines changed

‎src/channel/state/Progress.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
import*asCRfrom'typings'
1+
import*asTfrom'typings'
22
import*asTTfrom'typings/tutorial'
33
import*asvscodefrom'vscode'
44
importStoragefrom'../../services/storage'
55

6-
constdefaultValue:CR.Progress={
6+
constdefaultValue:T.Progress={
77
levels:{},
88
steps:{},
99
complete:false,
1010
}
1111

1212
// hold current progress and sync to storage based on tutorial.id/version
1313
classProgress{
14-
privatevalue:CR.Progress
15-
privatestorage:Storage<CR.Progress>|undefined
14+
privatevalue:T.Progress
15+
privatestorage:Storage<T.Progress>|undefined
1616
constructor(){
1717
this.value=defaultValue
1818
}
19-
publicsetTutorial=async(workspaceState:vscode.Memento,tutorial:G.Tutorial):Promise<CR.Progress>=>{
20-
this.storage=newStorage<CR.Progress>({
19+
publicsetTutorial=async(workspaceState:vscode.Memento,tutorial:TT.Tutorial):Promise<T.Progress>=>{
20+
this.storage=newStorage<T.Progress>({
2121
key:`coderoad:progress:${tutorial.id}:${tutorial.version}`,
2222
storage:workspaceState,
2323
defaultValue,
@@ -28,7 +28,7 @@ class Progress {
2828
publicget=()=>{
2929
returnthis.value
3030
}
31-
publicset=(value:CR.Progress)=>{
31+
publicset=(value:T.Progress)=>{
3232
this.value=value
3333
if(!this.storage){
3434
returndefaultValue
@@ -39,7 +39,7 @@ class Progress {
3939
publicreset=()=>{
4040
this.set(defaultValue)
4141
}
42-
publicsetStepComplete=(tutorialData:TT.TutorialData,stepId:string):CR.Progress=>{
42+
publicsetStepComplete=(tutorialData:TT.TutorialData,stepId:string):T.Progress=>{
4343
constnext=this.value
4444
// mark step complete
4545
next.steps[stepId]=true

‎typings/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export interface MachineStateSchema {
6969
Setup:{
7070
states:{
7171
Startup:{}
72-
Authenticate:{}
72+
//Authenticate: {}
7373
Error:{}
7474
LoadStoredTutorial:{}
7575
Start:{}

‎typings/tutorial.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type Step = {
3030
/** A tutorial for use in VSCode CodeRoad */
3131
exporttypeTutorial={
3232
id:string
33+
version:string
3334
summary:TutorialSummary
3435
data:TutorialData
3536
}

‎web-app/src/App.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
import{ApolloProvider}from'@apollo/react-hooks'
21
import*asReactfrom'react'
32
importErrorBoundaryfrom'./components/ErrorBoundary'
43
importRoutesfrom'./Routes'
5-
importclientfrom'./services/apollo'
64

75
constApp=()=>(
86
<ErrorBoundary>
9-
<ApolloProviderclient={client}>
10-
<Routes/>
11-
</ApolloProvider>
7+
<Routes/>
128
</ErrorBoundary>
139
)
1410

‎web-app/src/components/Error/index.tsx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import{ApolloError}from'apollo-boost'
2-
import{GraphQLError}from'graphql'
32
import*asReactfrom'react'
43
import{css,jsx}from'@emotion/core'
54
importonErrorfrom'../../services/sentry/onError'
@@ -34,25 +33,7 @@ const ErrorView = ({ error }: Props) => {
3433
return(
3534
<divcss={styles.container}>
3635
<h1>Error</h1>
37-
{error.graphQLErrors&&(
38-
<div>
39-
{error.graphQLErrors.map(({ message, locations, path}:GraphQLError,index:number)=>(
40-
<h5key={index}>
41-
<b>[GraphQL error]:</b> Message:{message}, Location:{locations}, Path:{path}
42-
</h5>
43-
))}
44-
</div>
45-
)}
46-
{error.networkError&&(
47-
<h5>
48-
<b>[Network error]:</b>{error.networkError.message}
49-
</h5>
50-
)}
51-
{error.extraInfo&&(
52-
<p>
53-
<b>[Extra info]:</b>{JSON.stringify(error.extraInfo)}
54-
</p>
55-
)}
36+
<div>{JSON.stringify(error)}</div>
5637
</div>
5738
)
5839
}

‎web-app/src/containers/Overview/OverviewPage.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import*asReactfrom'react'
2-
import*asGfrom'typings/graphql'
2+
import*asTTfrom'typings/tutorial'
33
importmomentfrom'moment'
44
importButtonfrom'../../components/Button'
55
importMarkdownfrom'../../components/Markdown'
@@ -71,9 +71,7 @@ const styles = {
7171
interfaceProps{
7272
title:string
7373
description:string
74-
createdBy:G.User
75-
updatedAt:string
76-
levels:G.Level[]
74+
levels:TT.Level[]
7775
onNext():void
7876
onBack():void
7977
}
@@ -93,15 +91,15 @@ const Summary = (props: Props) => (
9391
</div>
9492
<h1css={styles.title}>{props.title}</h1>
9593
<h3>{props.description}</h3>
96-
<h5css={styles.meta}>
94+
{/*<h5 css={styles.meta}>
9795
<div css={{ marginRight: '2rem' }}>Created by {props.createdBy.name}</div>
9896
<div>Last updated {moment(props.updatedAt).format('M/YYYY')}</div>
99-
</h5>
97+
</h5> */}
10098
</div>
10199
<div>
102100
<divcss={styles.levelList}>
103101
<h2>Content</h2>
104-
{props.levels.map((level:G.Level,index:number)=>(
102+
{props.levels.map((level:TT.Level,index:number)=>(
105103
<divkey={index}>
106104
<h3>
107105
{index+1}.{level.title}
Lines changed: 31 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import{useQuery}from'@apollo/react-hooks'
22
import*asReactfrom'react'
33
import*asCRfrom'typings'
4-
import*asGfrom'typings/graphql'
4+
import*asTTfrom'typings/tutorial'
55
importErrorViewfrom'../../components/Error'
6-
importqueryTutorialfrom'../../services/apollo/queries/tutorial'
76
importOverviewPagefrom'./OverviewPage'
87
importLoadingPagefrom'../Loading'
98

@@ -13,7 +12,7 @@ interface PageProps {
1312
}
1413

1514
interfaceTutorialData{
16-
tutorial:G.Tutorial
15+
tutorial:TT.Tutorial
1716
}
1817

1918
interfaceTutorialDataVariables{
@@ -27,51 +26,36 @@ const Overview = (props: PageProps) => {
2726
if(!tutorial){
2827
thrownewError('Tutorial not found in summary page')
2928
}
30-
const{ loading, error, data}=useQuery<TutorialData,TutorialDataVariables>(queryTutorial,{
31-
fetchPolicy:'no-cache',// to ensure latest
32-
variables:{
33-
tutorialId:tutorial.id,
34-
// version: tutorial.version.version, // TODO: re-enable latest
35-
},
36-
})
3729

38-
if(loading){
39-
return<LoadingPagetext="Loading Summary..."context={props.context}/>
40-
}
41-
42-
if(error){
43-
return<ErrorViewerror={error}/>
44-
}
45-
46-
if(!data){
47-
returnnull
48-
}
49-
50-
constonNext=()=>
51-
props.send({
52-
type:'TUTORIAL_START',
53-
payload:{
54-
tutorial:data.tutorial,
55-
},
56-
})
57-
58-
constonBack=()=>props.send({type:'BACK'})
59-
60-
const{ title, description}=data.tutorial.summary
61-
const{ createdBy, updatedAt,data:tutorialData}=data.tutorial.version
62-
const{ levels}=tutorialData
63-
64-
return(
65-
<OverviewPage
66-
title={title}
67-
description={description}
68-
createdBy={createdBy}
69-
updatedAt={updatedAt}
70-
levels={levels}
71-
onNext={onNext}
72-
onBack={onBack}
73-
/>
74-
)
30+
console.log('todo overview load')
31+
32+
return<div>Overview Page</div>
33+
34+
// const onNext = () =>
35+
// props.send({
36+
// type: 'TUTORIAL_START',
37+
// payload: {
38+
// tutorial: data.tutorial,
39+
// },
40+
// })
41+
42+
// const onBack = () => props.send({ type: 'BACK' })
43+
44+
// const { title, description } = data.tutorial.summary
45+
// const { createdBy, updatedAt, data: tutorialData } = data.tutorial.version
46+
// const { levels } = tutorialData
47+
48+
// return (
49+
// <OverviewPage
50+
// title={title}
51+
// description={description}
52+
// createdBy={createdBy}
53+
// updatedAt={updatedAt}
54+
// levels={levels}
55+
// onNext={onNext}
56+
// onBack={onBack}
57+
// />
58+
// )
7559
}
7660

7761
exportdefaultOverview

‎web-app/src/containers/SelectTutorial/SelectTutorial.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import*asReactfrom'react'
22
import*asTfrom'typings'
3-
import*asGfrom'typings/graphql'
3+
import*asTTfrom'typings/tutorial'
44
import{css,jsx}from'@emotion/core'
55
importTutorialItemfrom'./TutorialItem'
66

@@ -18,11 +18,11 @@ const styles = {
1818

1919
interfaceProps{
2020
send(action:T.Action):void
21-
tutorialList:G.Tutorial[]
21+
tutorialList:TT.Tutorial[]
2222
}
2323

2424
constSelectTutorial=(props:Props)=>{
25-
constonSelect=(tutorial:G.Tutorial)=>{
25+
constonSelect=(tutorial:TT.Tutorial)=>{
2626
props.send({
2727
type:'SELECT_TUTORIAL',
2828
payload:{
@@ -36,13 +36,12 @@ const SelectTutorial = (props: Props) => {
3636
<span>Select a tutorial to launch in this workspace:</span>
3737
</div>
3838
<div>
39-
{props.tutorialList.map((tutorial:G.Tutorial)=>(
39+
{props.tutorialList.map((tutorial:TT.Tutorial)=>(
4040
<TutorialItem
4141
key={tutorial.id}
4242
onSelect={()=>onSelect(tutorial)}
4343
title={tutorial.summary.title||''}
4444
description={tutorial.summary.description||''}
45-
createdBy={tutorial.createdBy}
4645
/>
4746
))}
4847
</div>

‎web-app/src/containers/SelectTutorial/TutorialItem.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import*asReactfrom'react'
2-
import*asGfrom'typings/graphql'
2+
import*asTTfrom'typings/tutorial'
33
import{css,jsx}from'@emotion/core'
44
importCardfrom'../../components/Card'
55
importTagfrom'../../components/Tag'
@@ -49,21 +49,9 @@ const styles = {
4949
interfaceProps{
5050
title:string
5151
description:string
52-
createdBy?:G.User|null
5352
onSelect():void
5453
}
5554

56-
// icons from https://konpa.github.io/devicon/
57-
constLanguageIcon=()=>(
58-
<svgviewBox="0 0 128 128"css={styles.languageIcon}>
59-
<pathfill="#F0DB4F"d="M1.408 1.408h125.184v125.185h-125.184z"></path>
60-
<path
61-
fill="#323330"
62-
d="M116.347 96.736c-.917-5.711-4.641-10.508-15.672-14.981-3.832-1.761-8.104-3.022-9.377-5.926-.452-1.69-.512-2.642-.226-3.665.821-3.32 4.784-4.355 7.925-3.403 2.023.678 3.938 2.237 5.093 4.724 5.402-3.498 5.391-3.475 9.163-5.879-1.381-2.141-2.118-3.129-3.022-4.045-3.249-3.629-7.676-5.498-14.756-5.355l-3.688.477c-3.534.893-6.902 2.748-8.877 5.235-5.926 6.724-4.236 18.492 2.975 23.335 7.104 5.332 17.54 6.545 18.873 11.531 1.297 6.104-4.486 8.08-10.234 7.378-4.236-.881-6.592-3.034-9.139-6.949-4.688 2.713-4.688 2.713-9.508 5.485 1.143 2.499 2.344 3.63 4.26 5.795 9.068 9.198 31.76 8.746 35.83-5.176.165-.478 1.261-3.666.38-8.581zm-46.885-37.793h-11.709l-.048 30.272c0 6.438.333 12.34-.714 14.149-1.713 3.558-6.152 3.117-8.175 2.427-2.059-1.012-3.106-2.451-4.319-4.485-.333-.584-.583-1.036-.667-1.071l-9.52 5.83c1.583 3.249 3.915 6.069 6.902 7.901 4.462 2.678 10.459 3.499 16.731 2.059 4.082-1.189 7.604-3.652 9.448-7.401 2.666-4.915 2.094-10.864 2.07-17.444.06-10.735.001-21.468.001-32.237z"
63-
></path>
64-
</svg>
65-
)
66-
6755
constTutorialItem=(props:Props)=>(
6856
<CardonClick={props.onSelect}>
6957
<divstyle={styles.card}>
@@ -72,7 +60,7 @@ const TutorialItem = (props: Props) => (
7260
</div>
7361
<divcss={styles.right}>
7462
<h2css={styles.title}>{props.title}</h2>
75-
{props.createdBy&&<h3css={styles.author}>{props.createdBy.name}</h3>}
63+
{/* {props.createdBy && <h3 css={styles.author}>{props.createdBy.name}</h3>} */}
7664
<divcss={styles.tags}>
7765
<Tag>javascript</Tag>
7866
</div>
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import{useQuery}from'@apollo/react-hooks'
22
import*asReactfrom'react'
33
import*asTfrom'typings'
4-
import*asGfrom'typings/graphql'
4+
import*asTTfrom'typings/tutorial'
55
importErrorViewfrom'../../components/Error'
6-
importqueryTutorialsfrom'../../services/apollo/queries/tutorials'
76
importLoadingPagefrom'../Loading'
87
importSelectTutorialfrom'./SelectTutorial'
98

@@ -13,27 +12,11 @@ interface ContainerProps {
1312
}
1413

1514
interfaceTutorialsData{
16-
tutorials:G.Tutorial[]
15+
tutorials:TT.Tutorial[]
1716
}
1817

1918
constSelectPageContainer=(props:ContainerProps)=>{
20-
const{ data, loading, error}=useQuery<TutorialsData>(queryTutorials,{
21-
fetchPolicy:'no-cache',
22-
})
23-
24-
if(error){
25-
return<ErrorViewerror={error}/>
26-
}
27-
28-
if(loading){
29-
return<LoadingPagetext="Loading tutorials"context={props.context}/>
30-
}
31-
32-
if(!data){
33-
returnnull
34-
}
35-
36-
return<SelectTutorialtutorialList={data.tutorials}send={props.send}/>
19+
return<div>SelectTutorial</div>
3720
}
3821

3922
exportdefaultSelectPageContainer

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import*asReactfrom'react'
22
import*asCRfrom'typings'
3-
import*asGfrom'typings/graphql'
3+
import*asTTfrom'typings/tutorial'
44
importBetaBadgefrom'../../components/BetaBadge'
55
import{css,jsx}from'@emotion/core'
66
importButtonfrom'../../components/Button'
@@ -46,7 +46,7 @@ const styles = {
4646
interfaceProps{
4747
onContinue():void
4848
onNew():void
49-
tutorial?:G.Tutorial
49+
tutorial?:TT.Tutorial
5050
}
5151

5252
exportconstStartPage=(props:Props)=>(

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp