Skip to content

Commit

Permalink
Replace tapp class with page provider for v5
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiner Pöpping committed Dec 5, 2024
1 parent c82a694 commit 31aa378
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 27 deletions.
15 changes: 8 additions & 7 deletions templates/api-v5/page-module-redux/src/components/AppWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React from 'react';
import { ChaynsProvider, withCompatMode } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import App from './App';
import store from '../redux-modules';
import { Provider } from 'react-redux';

const AppWrapper = ({ ...props }) => {
return (
<div className="tapp">
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<ChaynsProvider {...props}>
<Provider store={store}>
/* eslint-disable-next-line react/jsx-props-no-spreading */
<ChaynsProvider {...props}>
<Provider store={store}>
<PageProvider>
<App/>
</Provider>
</ChaynsProvider>
</div>
</PageProvider>
</Provider>
</ChaynsProvider>
)
}

Expand Down
5 changes: 4 additions & 1 deletion templates/api-v5/page-module/src/components/AppWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import React from 'react';
import { ChaynsProvider, withCompatMode } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import App from './App';

const AppWrapper = ({ ...props }) => {
return (
<div className="tapp">
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<ChaynsProvider {...props}>
<App/>
<PageProvider>
<App/>
</PageProvider>
</ChaynsProvider>
</div>
)
Expand Down
5 changes: 4 additions & 1 deletion templates/api-v5/page-redux/src/components/AppWrapper.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React from 'react';
import { Provider } from 'react-redux';
import { ChaynsProvider } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import store from '../redux-modules';
import App from './App';

const AppWrapper = () => {
return (
<ChaynsProvider>
<Provider store={store}>
<App />
<PageProvider>
<App />
</PageProvider>
</Provider>
</ChaynsProvider>
)
Expand Down
2 changes: 1 addition & 1 deletion templates/api-v5/page-redux/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<title>{{ readable-package-name }}</title>
</head>
<body>
<div class="tapp" id="root" {{ tapp-style }}></div>
<div id="root" {{ tapp-style }}></div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import { ChaynsProvider, withCompatMode } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import App from './App';

const AppWrapper = ({ ...props }) => {
return (
<div className="tapp">
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<ChaynsProvider {...props}>
/* eslint-disable-next-line react/jsx-props-no-spreading */
<ChaynsProvider {...props}>
<PageProvider>
<App/>
</ChaynsProvider>
</div>
</PageProvider>
</ChaynsProvider>
)
}

Expand Down
11 changes: 6 additions & 5 deletions templates/api-v5/page-ts-module/src/components/AppWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
import React from 'react';
import { ChaynsProvider, withCompatMode } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import App from './App';

const AppWrapper = ({ ...props }) => {
return (
<div className="tapp">
{/* eslint-disable-next-line react/jsx-props-no-spreading */}
<ChaynsProvider {...props}>
/* eslint-disable-next-line react/jsx-props-no-spreading */
<ChaynsProvider {...props}>
<PageProvider>
<App/>
</ChaynsProvider>
</div>
</PageProvider>
</ChaynsProvider>
)
}

Expand Down
5 changes: 4 additions & 1 deletion templates/api-v5/page-ts-redux/src/components/AppWrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import React from 'react';
import { Provider } from 'react-redux';
import { ChaynsProvider } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import App from './App';
import store from '../redux-modules';

const AppWrapper = () => {
return (
<ChaynsProvider>
<Provider store={store}>
<App/>
<PageProvider>
<App/>
</PageProvider>
</Provider>
</ChaynsProvider>
)
Expand Down
2 changes: 1 addition & 1 deletion templates/api-v5/page-ts-redux/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<title>{{ readable-package-name }}</title>
</head>
<body>
<div class="tapp" id="root" {{ tapp-style }}></div>
<div id="root" {{ tapp-style }}></div>
</body>
</html>
2 changes: 1 addition & 1 deletion templates/api-v5/page-ts/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<title>{{ readable-package-name }}</title>
</head>
<body>
<div class="tapp" id="root" {{ tapp-style }}></div>
<div id="root" {{ tapp-style }}></div>
</body>
</html>
3 changes: 2 additions & 1 deletion templates/api-v5/page-ts/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { ChaynsProvider } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';
import App from './components/App';

try {
const root = createRoot(document.querySelector('#root'));
root.render(<ChaynsProvider><App /></ChaynsProvider>);
root.render(<ChaynsProvider><PageProvider><App /></PageProvider></ChaynsProvider>);
} catch (e) {
console.error('Encountered error at `ReactDOM.render`: ', e);
}
2 changes: 1 addition & 1 deletion templates/api-v5/page/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<title>{{ readable-package-name }}</title>
</head>
<body>
<div class="tapp" id="root" {{ tapp-style }}></div>
<div id="root" {{ tapp-style }}></div>
</body>
</html>
3 changes: 2 additions & 1 deletion templates/api-v5/page/src/index.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { ChaynsProvider } from 'chayns-api';
import { PageProvider } from '@chayns-components/core';

import App from './components/App';

try {
const root = createRoot(document.querySelector('#root'));
root.render(<ChaynsProvider><App /></ChaynsProvider>);
root.render(<ChaynsProvider><PageProvider><App /></PageProvider></ChaynsProvider>);
} catch (e) {
console.error('Encountered error at `ReactDOM.render`: ', e);
}
2 changes: 1 addition & 1 deletion templates/api-v5/shared/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
<title>{{ package-name }}</title>
</head>
<body>
<div class="tapp" id="root" ></div>
<div id="root" ></div>
</body>
</html>

0 comments on commit 31aa378

Please sign in to comment.