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

Commit56ae434

Browse files
authored
Merge pull request#296 from apollographql/tutorial-improvements
Updates client starter and final code
2 parentsbd57753 +5d786f0 commit56ae434

File tree

68 files changed

+41683
-88322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+41683
-88322
lines changed

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ This is the fullstack app for the [Apollo tutorial](https://www.apollographql.co
55
##File structure
66

77
The app is split out into two folders:
8+
89
-`start`: Starting point for the tutorial
910
-`final`: Final version
1011

‎final/client/package-lock.json‎

Lines changed: 41215 additions & 31589 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎final/client/package.json‎

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
{
22
"name":"client",
3-
"version":"0.1.0",
3+
"version":"0.2.0",
44
"private":true,
55
"dependencies": {
6-
"@apollo/client":"^3.4.6",
7-
"@reach/router":"^1.2.1",
8-
"@types/node":"^12.12.14",
9-
"@types/reach__router":"^1.2.6",
10-
"@types/react":"^16.9.15",
11-
"@types/react-dom":"^16.9.4",
12-
"emotion":"^9.2.12",
13-
"graphql":"^14.7.0",
14-
"polished":"^3.4.1",
15-
"react":"^16.12.0",
16-
"react-dom":"^16.12.0",
17-
"react-emotion":"^9.2.12",
18-
"react-scripts":"^3.4.1",
19-
"typescript":"^3.7.3"
6+
"@apollo/client":"^3.7.0",
7+
"@emotion/css":"^11.10.0",
8+
"@emotion/react":"^11.10.4",
9+
"@emotion/styled":"^11.10.4",
10+
"graphql":"^16.5.0",
11+
"history":"^5.3.0",
12+
"polished":"^4.2.2",
13+
"react":"^18.2.0",
14+
"react-dom":"^18.2.0",
15+
"react-router":"^6.4.1",
16+
"react-router-dom":"^6.4.1",
17+
"react-scripts":"^5.0.1",
18+
"typescript":"^4.8.4"
2019
},
2120
"scripts": {
2221
"start":"react-scripts start",
@@ -36,11 +35,14 @@
3635
"not op_mini all"
3736
],
3837
"devDependencies": {
39-
"@testing-library/jest-dom":"^4.0.0",
40-
"@testing-library/react":"^8.0.7",
41-
"@types/jest":"^24.0.23",
42-
"apollo":"^2.32.5",
43-
"artillery":"^1.6.0-26",
44-
"npm-watch":"^0.6.0"
38+
"@testing-library/jest-dom":"^5.16.5",
39+
"@testing-library/react":"^13.4.0",
40+
"@types/jest":"^29.1.1",
41+
"@types/node":"^18.7.3",
42+
"@types/react":"^18.0.21",
43+
"@types/react-dom":"^18.0.6",
44+
"@types/react-router":"^5.1.19",
45+
"artillery":"^2.0.0-23",
46+
"npm-watch":"^0.11.0"
4547
}
4648
}

‎final/client/src/components/__tests__/launch-tile.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ import React from 'react';
22

33
import{render,cleanup}from'../../test-utils';
44
importLaunchTilefrom'../launch-tile';
5+
import{renderApollo}from'../../test-utils';
56

67
describe('Launch Tile',()=>{
78
// automatically unmount and cleanup DOM after the test is finished.
89
afterEach(cleanup);
910

1011
it('renders without error',()=>{
11-
render(
12+
renderApollo(
1213
<LaunchTile
1314
launch={{
1415
__typename:'Launch',

‎final/client/src/components/__tests__/menu-item.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import React from 'react';
22

33
import{render,cleanup}from'../../test-utils';
44
importMenuItemfrom'../menu-item';
5+
import{renderApollo}from'../../test-utils';
56

67
describe('Menu Item',()=>{
78
// automatically unmount and cleanup DOM after the test is finished.
89
afterEach(cleanup);
910

1011
it('renders without error',()=>{
11-
render(<MenuItemto="/wow"/>);
12+
renderApollo(<MenuItemto="/wow"/>);
1213
});
1314
});

‎final/client/src/components/button.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
importstyledfrom'react-emotion';
1+
importstyledfrom'@emotion/styled';
22
import{lighten}from'polished';
33

44
import{unit,colors}from'../styles';

‎final/client/src/components/footer.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
importReactfrom'react';
2-
importstyledfrom'react-emotion';
2+
importstyledfrom'@emotion/styled';
33

44
importMenuItemfrom'./menu-item';
55
importLogoutButtonfrom'../containers/logout-button';

‎final/client/src/components/header.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
importReactfrom'react';
2-
importstyledfrom'react-emotion';
2+
importstyledfrom'@emotion/styled';
33
import{size}from'polished';
44

55
import{unit,colors}from'../styles';
@@ -24,7 +24,7 @@ interface HeaderProps {
2424
}
2525

2626
constHeader:React.FC<HeaderProps>=({ image, children='Space Explorer'})=>{
27-
constemail=atob(localStorage.getItem('token')asstring);
27+
constemail=window.atob(localStorage.getItem('token')asstring);
2828
constavatar=image||pickAvatarByEmail(email);
2929

3030
return(
@@ -36,7 +36,7 @@ const Header: React.FC<HeaderProps> = ({ image, children = 'Space Explorer' }) =
3636
</div>
3737
</Container>
3838
);
39-
}
39+
};
4040

4141
exportdefaultHeader;
4242

‎final/client/src/components/launch-detail.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
importReactfrom'react';
2-
importstyledfrom'react-emotion';
2+
importstyledfrom'@emotion/styled';
33

44
import{unit}from'../styles';
55
import{cardClassName,getBackgroundImage}from'./launch-tile';
66
import{LaunchDetails_launch}from'../pages/__generated__/LaunchDetails';
77

8-
typeLaunchDetailProps=Partial<LaunchDetails_launch>
8+
typeLaunchDetailProps=Partial<LaunchDetails_launch>;
99

1010
constLaunchDetail:React.FC<LaunchDetailProps>=({ id, site, rocket})=>(
1111
<Card

‎final/client/src/components/launch-tile.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
importReactfrom'react';
2-
importstyled,{css}from'react-emotion';
3-
import{Link}from'@reach/router';
2+
importstyledfrom'@emotion/styled';
3+
import{css}from'@emotion/react';
4+
import{Link}from'react-router-dom';
45

56
importgalaxyfrom'../assets/images/galaxy.jpg';
67
importissfrom'../assets/images/iss.jpg';
@@ -30,7 +31,7 @@ const LaunchTile: React.FC<LaunchTileProps> = ({ launch }) => {
3031
<h5>{rocket&&rocket.name}</h5>
3132
</StyledLink>
3233
);
33-
}
34+
};
3435

3536
exportdefaultLaunchTile;
3637

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp