Skip to content

Commit d9ad901

Browse files
committed
remove else statements
1 parent 1171f18 commit d9ad901

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

packages/gatsby-theme/src/components/Account.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,8 @@ const Account = () => {
1515
}
1616
if (user) {
1717
return <Profile user={user} />;
18-
} else {
19-
return (
20-
<GithubButton onClick={() => loginUser()}>Sign up</GithubButton>
21-
);
2218
}
19+
return <GithubButton onClick={() => loginUser()}>Sign up</GithubButton>;
2320
}}
2421
</WithCurrentUser>
2522
);

packages/gatsby-theme/src/components/Upvote.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@ const Upvote = () => {
1515
{({ user }) => {
1616
if (user) {
1717
return <UpvoteData event={() => console.log('upvoted!')} />;
18-
} else {
19-
return <UpvoteData event={() => loginUser()} />;
2018
}
19+
return <UpvoteData event={() => loginUser()} />;
2120
}}
2221
</WithCurrentUser>
2322
);
@@ -27,6 +26,8 @@ type UpvoteDataProps = {
2726
event: string;
2827
};
2928

29+
// place holder until we have a backend that stores the number of upvotes
30+
// and can keep track of which tutorials a user upvotes
3031
const UpvoteData: React.FunctionComponent<UpvoteDataProps> = ({ event }) => {
3132
return (
3233
<Flex flexDirection="column" alignItems="center" justifyContent="center">

packages/gatsby-theme/src/components/templates/Tutorial.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const TutorialLayout: React.FunctionComponent<TutorialLayoutProps> = ({
1818
return null;
1919
}
2020
const { pageTitle } = data!.mdx!.frontmatter!;
21-
const tutorialTitle = data!.tutorialTitle!.frontmatter!.tutorialTitle!;
21+
const { tutorialTitle } = data!.tutorialTitle!.frontmatter!;
2222
const chapters = data!.pageTitles!.edges!.map(
2323
a => a.node!.frontmatter!.pageTitle!,
2424
);

packages/gatsby-theme/src/pages/profile.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ const Profile = () => {
1515
}
1616
if (user) {
1717
return <ProfilePage user={user} />;
18-
} else {
19-
navigate('/signup/');
20-
return null;
2118
}
19+
navigate('/signup/');
20+
return null;
2221
}}
2322
</WithCurrentUser>
2423
);

packages/gatsby-theme/src/pages/signup.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ const Signup = () => {
1717
if (user) {
1818
navigate('/profile/');
1919
return null;
20-
} else {
21-
return <SignupPage />;
2220
}
21+
return <SignupPage />;
2322
}}
2423
</WithCurrentUser>
2524
);

0 commit comments

Comments
 (0)