|
1 | 1 | import 'core-js/stable';
|
2 | 2 | import 'regenerator-runtime/runtime';
|
3 | 3 |
|
4 |
| -import React from 'react'; |
5 |
| -import ReactDOM from 'react-dom'; |
| 4 | +import React, {StrictMode} from 'react'; |
6 | 5 | import { AppContext, AppProvider } from '@edx/frontend-platform/react';
|
7 | 6 | import { initialize, getConfig, subscribe, APP_READY } from '@edx/frontend-platform';
|
8 | 7 | import Header, { StudioHeader } from '@edx/frontend-component-header';
|
9 | 8 |
|
10 | 9 | import './index.scss';
|
| 10 | +import { createRoot } from "react-dom/client"; |
11 | 11 |
|
| 12 | +const rootNode = createRoot(document.getElementById('root')); |
12 | 13 | subscribe(APP_READY, () => {
|
13 |
| - ReactDOM.render( |
14 |
| - <AppProvider> |
15 |
| - {/* We can fake out authentication by including another provider here with the data we want */} |
16 |
| - <AppContext.Provider value={{ |
17 |
| - authenticatedUser: null, |
18 |
| - config: getConfig(), |
19 |
| - }}> |
20 |
| - <Header /> |
21 |
| - </AppContext.Provider> |
22 |
| - <h5 className="mt-2 mb-5">Logged out state</h5> |
| 14 | + rootNode.render( |
| 15 | + <StrictMode> |
| 16 | + <AppProvider> |
| 17 | + {/* We can fake out authentication by including another provider here with the data we want */} |
| 18 | + <AppContext.Provider value={{ |
| 19 | + authenticatedUser: null, |
| 20 | + config: getConfig(), |
| 21 | + }}> |
| 22 | + <Header /> |
| 23 | + </AppContext.Provider> |
| 24 | + <h5 className="mt-2 mb-5">Logged out state</h5> |
23 | 25 |
|
24 |
| - {/* We can fake out authentication by including another provider here with the data we want */} |
25 |
| - <AppContext.Provider value={{ |
26 |
| - authenticatedUser: { |
27 |
| - userId: '123abc', |
28 |
| - username: 'testuser', |
29 |
| - name: 'Test User', |
30 |
| - |
31 |
| - roles: [], |
32 |
| - administrator: false, |
33 |
| - }, |
34 |
| - config: getConfig(), |
35 |
| - }}> |
36 |
| - <Header /> |
37 |
| - </AppContext.Provider> |
38 |
| - <h5 className="mt-2 mb-5">Logged in state</h5> |
39 |
| - <AppContext.Provider value={{ |
40 |
| - authenticatedUser: { |
41 |
| - userId: '123abc', |
42 |
| - username: 'testuser', |
43 |
| - name: 'Test User', |
44 |
| - |
45 |
| - roles: [], |
46 |
| - administrator: false, |
47 |
| - }, |
48 |
| - config: getConfig(), |
49 |
| - }}> |
50 |
| - <StudioHeader |
51 |
| - number="run123" |
52 |
| - org="testX" |
53 |
| - title="Course Name" |
54 |
| - isHiddenMainMenu={false} |
55 |
| - mainMenuDropdowns={[ |
56 |
| - { |
57 |
| - id: 'content-dropdown', |
58 |
| - buttonTitle: 'Content', |
59 |
| - items: [{ |
60 |
| - href: '#', |
61 |
| - title: 'Outline', |
62 |
| - }], |
| 26 | + {/* We can fake out authentication by including another provider here with the data we want */} |
| 27 | + <AppContext.Provider value={{ |
| 28 | + authenticatedUser: { |
| 29 | + userId: '123abc', |
| 30 | + username: 'testuser', |
| 31 | + name: 'Test User', |
| 32 | + |
| 33 | + roles: [], |
| 34 | + administrator: false, |
63 | 35 | },
|
64 |
| - ]} |
65 |
| - outlineLink="#" |
66 |
| - /> |
67 |
| - </AppContext.Provider> |
68 |
| - <h5 className="mt-2">Logged in state for Studio header</h5> |
69 |
| - </AppProvider>, |
70 |
| - document.getElementById('root'), |
| 36 | + config: getConfig(), |
| 37 | + }}> |
| 38 | + <Header /> |
| 39 | + </AppContext.Provider> |
| 40 | + <h5 className="mt-2 mb-5">Logged in state</h5> |
| 41 | + <AppContext.Provider value={{ |
| 42 | + authenticatedUser: { |
| 43 | + userId: '123abc', |
| 44 | + username: 'testuser', |
| 45 | + name: 'Test User', |
| 46 | + |
| 47 | + roles: [], |
| 48 | + administrator: false, |
| 49 | + }, |
| 50 | + config: getConfig(), |
| 51 | + }}> |
| 52 | + <StudioHeader |
| 53 | + number="run123" |
| 54 | + org="testX" |
| 55 | + title="Course Name" |
| 56 | + isHiddenMainMenu={false} |
| 57 | + mainMenuDropdowns={[ |
| 58 | + { |
| 59 | + id: 'content-dropdown', |
| 60 | + buttonTitle: 'Content', |
| 61 | + items: [{ |
| 62 | + href: '#', |
| 63 | + title: 'Outline', |
| 64 | + }], |
| 65 | + }, |
| 66 | + ]} |
| 67 | + outlineLink="#" |
| 68 | + /> |
| 69 | + </AppContext.Provider> |
| 70 | + <h5 className="mt-2">Logged in state for Studio header</h5> |
| 71 | + </AppProvider> |
| 72 | + </StrictMode>, |
71 | 73 | );
|
72 | 74 | });
|
73 | 75 |
|
|
0 commit comments