File tree Expand file tree Collapse file tree 6 files changed +20
-24
lines changed
packages/gatsby-theme/src/components Expand file tree Collapse file tree 6 files changed +20
-24
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,12 @@ import { Mutation } from 'react-apollo';
33import { loginUser } from '../../utils/auth' ;
44import { BookmarkButton } from '../shared/buttons' ;
55import { BookmarkTutorial } from '../../utils/queries' ;
6+ import { BookmarkTutorialMutation } from '../../graphqlTypes' ;
67import { optionalChaining } from '../../utils/helpers' ;
7-
88import { handleMutationResponse , ApiErrors } from '../../utils/errorHandling' ;
99
1010const BookmarkMutation = ( { tutorial } ) => (
11- < Mutation
11+ < Mutation < BookmarkTutorialMutation >
1212 mutation = { BookmarkTutorial }
1313 variables = { {
1414 id : tutorial . id ,
Original file line number Diff line number Diff line change @@ -6,9 +6,13 @@ import { VoteButton } from '../shared/buttons';
66import { Heading , Flex } from '../shared/base' ;
77import { optionalChaining } from '../../utils/helpers' ;
88import { UpvoteTutorial } from '../../utils/queries' ;
9+ import { UpvoteTutorialMutation } from '../../graphqlTypes' ;
910
1011const UpvoteMutation = ( { tutorial } ) => (
11- < Mutation mutation = { UpvoteTutorial } variables = { { id : tutorial . id } } >
12+ < Mutation < UpvoteTutorialMutation >
13+ mutation = { UpvoteTutorial }
14+ variables = { { id : tutorial . id } }
15+ >
1216 { upvote => {
1317 let active = optionalChaining ( ( ) => tutorial . viewerUserTutorial . upvoted ) ;
1418 let upvotes = optionalChaining ( ( ) => tutorial . upvotes ) ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { Query } from 'react-apollo';
44import ProgressBar from '../shared/ProgressBar' ;
55import { TutorialButton } from '../shared/buttons' ;
66import { getTutorialbyGatsbyID } from '../../utils/queries' ;
7- import { GetTutorialbyGatsbyIdQuery } from '../../graphqlTypes' ;
7+ import { GetTutorialbyGatsbyIdQuery , Maybe } from '../../graphqlTypes' ;
88import { getTutorialOverviewSlug } from '../../utils/getTutorialSlug' ;
99import { optionalChaining , percent } from '../../utils/helpers' ;
1010
Original file line number Diff line number Diff line change @@ -13,18 +13,6 @@ type QueryData = {
1313 node : Mdx ;
1414} ;
1515
16- // type Node = {
17- // id: string;
18- // fileAbsolutePath: string;
19- // frontmatter: Frontmatter;
20- // };
21-
22- // type Frontmatter = {
23- // id: string;
24- // tutorialTitle: string;
25- // description: string;
26- // };
27-
2816const CourseSection : React . FunctionComponent < CourseSectionProps > = ( {
2917 heading,
3018 body,
Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ interface PageTemplateProps {
1515}
1616
1717const PageTemplate : React . FunctionComponent < PageTemplateProps > = ( { data } ) => {
18- let gatsbyID = optionalChaining ( ( ) => data . overview . frontmatter . id ) ;
18+ let gatsbyID = optionalChaining ( ( ) => data ! . overview ! . frontmatter ! . id ) ;
1919
2020 // This is so that the start button can link to the user's current path
2121 // TO DO find a better way to pass in the which chapter the user is currently on
2222 const chapterPaths = optionalChaining ( ( ) =>
23- data . allMdx . edges . map ( a =>
23+ data ! . allMdx ! . edges . map ( a =>
2424 getTutorialSlug ( optionalChaining ( ( ) => a . node . fileAbsolutePath ) ) ,
2525 ) ,
2626 ) ;
@@ -29,11 +29,11 @@ const PageTemplate: React.FunctionComponent<PageTemplateProps> = ({ data }) => {
2929 < Layout >
3030 < Content >
3131 < Flex >
32- < Box width = { 3 / 4 } aligncontent = "center" >
32+ < Box width = { 3 / 4 } >
3333 < TutorialHeader
3434 width = { 1 / 2 }
35- title = { data ! . overview ! . frontmatter ! . tutorialTitle }
36- description = { data ! . overview ! . frontmatter ! . description }
35+ title = { data ! . overview ! . frontmatter ! . tutorialTitle || 'blank' }
36+ description = { data ! . overview ! . frontmatter ! . description || 'blank' }
3737 tags = { [ 'React' , 'Apollo' , 'Javascript' ] }
3838 />
3939 </ Box >
Original file line number Diff line number Diff line change @@ -6,7 +6,11 @@ import { SpectrumButton } from '../shared/buttons';
66
77type SidebarProps = {
88 tutorialTitle : string ;
9- chapters : string [ ] ;
9+ chapters : Chapter ;
10+ } ;
11+ type Chapter = {
12+ chapterTitle : string ;
13+ chapterPath : string ;
1014} ;
1115
1216export const Sidebar : React . FunctionComponent < SidebarProps > = ( {
@@ -22,8 +26,8 @@ export const Sidebar: React.FunctionComponent<SidebarProps> = ({
2226 </ Card >
2327 < ul >
2428 { chapters . map ( chapter => (
25- < li key = { chapter . chapterTitle } >
26- < a href = { chapter . chapterPath } > { chapter . chapterTitle } </ a >
29+ < li key = { chapter ! . chapterTitle } >
30+ < a href = { chapter ! . chapterPath } > { chapter ! . chapterTitle } </ a >
2731 </ li >
2832 ) ) }
2933 </ ul >
You can’t perform that action at this time.
0 commit comments