Skip to content

Commit ac83059

Browse files
committed
Completed project
1 parent 637f2c2 commit ac83059

File tree

17 files changed

+11827
-14141
lines changed

17 files changed

+11827
-14141
lines changed

demo/graph-tutorial/README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Getting Started with Create React App
2+
13
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
24

35
## Available Scripts
@@ -6,23 +8,23 @@ In the project directory, you can run:
68

79
### `yarn start`
810

9-
Runs the app in the development mode.<br />
11+
Runs the app in the development mode.\
1012
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
1113

12-
The page will reload if you make edits.<br />
14+
The page will reload if you make edits.\
1315
You will also see any lint errors in the console.
1416

1517
### `yarn test`
1618

17-
Launches the test runner in the interactive watch mode.<br />
19+
Launches the test runner in the interactive watch mode.\
1820
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
1921

2022
### `yarn build`
2123

22-
Builds the app for production to the `build` folder.<br />
24+
Builds the app for production to the `build` folder.\
2325
It correctly bundles React in production mode and optimizes the build for the best performance.
2426

25-
The build is minified and the filenames include the hashes.<br />
27+
The build is minified and the filenames include the hashes.\
2628
Your app is ready to be deployed!
2729

2830
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

demo/graph-tutorial/package-lock.json

Lines changed: 0 additions & 13890 deletions
This file was deleted.

demo/graph-tutorial/package.json

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,29 @@
33
"version": "0.1.0",
44
"private": true,
55
"dependencies": {
6-
"@azure/msal-browser": "^2.1.0",
7-
"@fortawesome/fontawesome-free": "^5.14.0",
8-
"@microsoft/microsoft-graph-client": "^2.0.0",
9-
"@testing-library/jest-dom": "^4.2.4",
10-
"@testing-library/react": "^9.3.2",
11-
"@testing-library/user-event": "^7.1.2",
12-
"@types/jest": "^24.0.0",
13-
"@types/microsoft-graph": "^1.18.0",
14-
"@types/node": "^12.12.55",
15-
"@types/react": "^16.9.49",
16-
"@types/react-dom": "^16.9.0",
17-
"@types/react-router-dom": "^5.1.5",
18-
"@types/reactstrap": "^8.5.1",
19-
"bootstrap": "^4.5.2",
20-
"moment": "^2.27.0",
21-
"moment-timezone": "^0.5.31",
22-
"react": "^16.13.1",
23-
"react-dom": "^16.13.1",
6+
"@azure/msal-browser": "^2.10.0",
7+
"@fortawesome/fontawesome-free": "^5.15.2",
8+
"@microsoft/microsoft-graph-client": "^2.2.1",
9+
"@testing-library/jest-dom": "^5.11.4",
10+
"@testing-library/react": "^11.1.0",
11+
"@testing-library/user-event": "^12.1.10",
12+
"@types/jest": "^26.0.15",
13+
"@types/microsoft-graph": "^1.28.0",
14+
"@types/node": "^12.0.0",
15+
"@types/react": "^16.9.53",
16+
"@types/react-dom": "^16.9.8",
17+
"@types/react-router-dom": "^5.1.7",
18+
"@types/reactstrap": "^8.7.2",
19+
"bootstrap": "^4.6.0",
20+
"moment": "^2.29.1",
21+
"moment-timezone": "^0.5.32",
22+
"react": "^17.0.1",
23+
"react-dom": "^17.0.1",
2424
"react-router-dom": "^5.2.0",
25-
"react-scripts": "^3.4.3",
26-
"reactstrap": "^8.5.1",
27-
"typescript": "~3.7.2",
25+
"react-scripts": "4.0.1",
26+
"reactstrap": "^8.9.0",
27+
"typescript": "^4.0.3",
28+
"web-vitals": "^0.2.4",
2829
"windows-iana": "^4.2.1"
2930
},
3031
"scripts": {
@@ -34,7 +35,10 @@
3435
"eject": "react-scripts eject"
3536
},
3637
"eslintConfig": {
37-
"extends": "react-app"
38+
"extends": [
39+
"react-app",
40+
"react-app/jest"
41+
]
3842
},
3943
"browserslist": {
4044
"production": [
720 Bytes
Binary file not shown.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
2-
import { render } from '@testing-library/react';
2+
import { render, screen } from '@testing-library/react';
33
import App from './App';
44

55
test('renders learn react link', () => {
6-
const { getByText } = render(<App />);
7-
const linkElement = getByText(/learn react/i);
6+
render(<App />);
7+
const linkElement = screen.getByText(/learn react/i);
88
expect(linkElement).toBeInTheDocument();
99
});

demo/graph-tutorial/src/Calendar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ interface CalendarState {
2121
class Calendar extends React.Component<AuthComponentProps, CalendarState> {
2222
constructor(props: any) {
2323
super(props);
24+
2425
this.state = {
2526
eventsLoaded: false,
2627
events: [],
2728
startOfWeek: undefined
2829
};
2930
}
3031

31-
async componentDidUpdate()
32-
{
32+
async componentDidUpdate() {
3333
if (this.props.user && !this.state.eventsLoaded)
3434
{
3535
try {

demo/graph-tutorial/src/GraphService.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// <graphServiceSnippet1>
55
import moment, { Moment } from 'moment';
66
import { Event } from 'microsoft-graph';
7-
import { PageCollection, PageIterator } from '@microsoft/microsoft-graph-client';
7+
import { GraphRequestOptions, PageCollection, PageIterator } from '@microsoft/microsoft-graph-client';
88

99
var graph = require('@microsoft/microsoft-graph-client');
1010

@@ -48,22 +48,28 @@ export async function getUserWeekCalendar(accessToken: string, timeZone: string,
4848
// &$top=50
4949
var response: PageCollection = await client
5050
.api('/me/calendarview')
51-
.header("Prefer", `outlook.timezone="${timeZone}"`)
51+
.header('Prefer', `outlook.timezone="${timeZone}"`)
5252
.query({ startDateTime: startDateTime, endDateTime: endDateTime })
5353
.select('subject,organizer,start,end')
5454
.orderby('start/dateTime')
55-
.top(50)
55+
.top(25)
5656
.get();
5757

5858
if (response["@odata.nextLink"]) {
5959
// Presence of the nextLink property indicates more results are available
6060
// Use a page iterator to get all results
6161
var events: Event[] = [];
6262

63+
// Must include the time zone header in page
64+
// requests too
65+
var options: GraphRequestOptions = {
66+
headers: { 'Prefer': `outlook.timezone="${timeZone}"` }
67+
};
68+
6369
var pageIterator = new PageIterator(client, response, (event) => {
6470
events.push(event);
6571
return true;
66-
});
72+
}, options);
6773

6874
await pageIterator.iterate();
6975

@@ -72,7 +78,6 @@ export async function getUserWeekCalendar(accessToken: string, timeZone: string,
7278

7379
return response.value;
7480
}
75-
7681
}
7782
// </getUserWeekCalendarSnippet>
7883

demo/graph-tutorial/src/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import ReactDOM from 'react-dom';
33
import './index.css';
44
import App from './App';
5-
import * as serviceWorker from './serviceWorker';
5+
import reportWebVitals from './reportWebVitals';
66

77
ReactDOM.render(
88
<React.StrictMode>
@@ -11,7 +11,7 @@ ReactDOM.render(
1111
document.getElementById('root')
1212
);
1313

14-
// If you want your app to work offline and load faster, you can change
15-
// unregister() to register() below. Note this comes with some pitfalls.
16-
// Learn more about service workers: https://bit.ly/CRA-PWA
17-
serviceWorker.unregister();
14+
// If you want to start measuring performance in your app, pass a function
15+
// to log results (for example: reportWebVitals(console.log))
16+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17+
reportWebVitals();

demo/graph-tutorial/src/logo.svg

Lines changed: 1 addition & 7 deletions
Loading
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { ReportHandler } from 'web-vitals';
2+
3+
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4+
if (onPerfEntry && onPerfEntry instanceof Function) {
5+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6+
getCLS(onPerfEntry);
7+
getFID(onPerfEntry);
8+
getFCP(onPerfEntry);
9+
getLCP(onPerfEntry);
10+
getTTFB(onPerfEntry);
11+
});
12+
}
13+
};
14+
15+
export default reportWebVitals;

0 commit comments

Comments
 (0)