Skip to content

Commit d457e49

Browse files
committed
Migrate to vite & fix import issues
1 parent cc7e3ff commit d457e49

File tree

29 files changed

+461
-460
lines changed

29 files changed

+461
-460
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Configuration
22

3-
The visualization and persistence services share the base URL of the API, provided by the `getBaseURI` method. When working on a development server, this URL must be defined in the [.env](https://github.com/InseeFr/Pogues/blob/main/.env) file in the `REACT_APP_API_URL` variable. For deployment on an apache server, the `POGUES_API_BASE_HOST` variable must be overridden in the [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) file located in the `public` folder.
3+
The visualization and persistence services share the base URL of the API, provided by the `getBaseURI` method. When working on a development server, this URL must be defined in the [.env](https://github.com/InseeFr/Pogues/blob/main/.env) file in the `VITE_API_URL` variable. For deployment on an apache server, the `POGUES_API_BASE_HOST` variable must be overridden in the [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) file located in the `public` folder.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Configuration
22

3-
Les services de visualisation et de persistance partage l'URL de base de l'API, fournie par la méthode `getBaseURI`. Lorsque que l'on travaille sur un serveur de développement, cette URL doit être définie dans le fichier [.env](https://github.com/InseeFr/Pogues/blob/main/.env) dans la variable `REACT_APP_API_URL`. Pour un déploiement sur un serveur apache, il faut surcharger la variable `POGUES_API_BASE_HOST` dans le fichier [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) se trouvant dans le dossier `public`.
3+
Les services de visualisation et de persistance partage l'URL de base de l'API, fournie par la méthode `getBaseURI`. Lorsque que l'on travaille sur un serveur de développement, cette URL doit être définie dans le fichier [.env](https://github.com/InseeFr/Pogues/blob/main/.env) dans la variable `VITE_API_URL`. Pour un déploiement sur un serveur apache, il faut surcharger la variable `POGUES_API_BASE_HOST` dans le fichier [configuration.json](https://github.com/InseeFr/Pogues/blob/main/public/configuration.json) se trouvant dans le dossier `public`.

jsconfig.json

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

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@
112112
"test": "react-scripts test --coverage -i",
113113
"testw": "react-scripts test --watch",
114114
"start": "vite",
115-
"start-insee": "cross-env REACT_APP_INSEE=true react-scripts start",
116115
"dev:server": "concurrently \"npm run server\" \"npm run start\"",
117116
"server": "node ./fake-server/server.js",
118117
"build": "npm run generate-entrypoint && vite build",
119-
"build-insee": "cross-env REACT_APP_INSEE=true react-scripts build",
120118
"lint": "eslint ./src -f table || true",
121119
"lint:fix": "eslint ./src -f table --fix || true",
122120
"jison": "jison jison/grammars/xpath.jison jison/grammars/xpath.jisonlex -o jison/generated-parsers/xpath-parser.js && node ./jison/fixParser.js",

scripts/generate-entrypoint.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
var fs = require('fs');
22

3-
fs.readFile('.env', 'utf8', function(_, contents) {
3+
fs.readFile('.env', 'utf8', function (_, contents) {
44
const content = contents
55
.split('\n')
66
.filter(line => !line.startsWith('#'))
77
.map(line => line.split('='))
88
.filter(data => data.length === 2)
99
.map(
1010
([key]) =>
11-
`echo "window._env_['${key.replace(
12-
'REACT_APP_',
13-
'',
14-
)}'] = '\$${key.replace(
15-
'REACT_APP_',
11+
`echo "window._env_['${key.replace('VITE_', '')}'] = '\$${key.replace(
12+
'VITE_',
1613
'',
1714
)}';" >> /usr/share/nginx/html/env-config.js`,
1815
);

src/forms/controls/control-with-suggestions/components/rich-textarea-with-suggestions.jsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
import React from 'react';
1+
// import { EditorState, Modifier, getDefaultKeyBinding } from 'draft-js';
22
import PropTypes from 'prop-types';
3-
import RichTextEditor from 'gillespie59-react-rte/dist/react-rte';
4-
import { getDefaultKeyBinding, EditorState, Modifier } from 'draft-js';
3+
import React from 'react';
54

65
import ControlWithSuggestion from './control-with-suggestions';
76
import { updateSuggestions } from './input-with-suggestions-utils';
87
import { getPattern, getStartValueWithSuggestion } from './utils';
98

109
import {
11-
getEditorValue,
1210
contentStateToString,
13-
formatURL,
11+
getEditorValue,
1412
toolbarConfig,
15-
toolbarConfigQuestion,
16-
rootStyle,
1713
} from '../../rich-textarea';
1814

19-
import { getControlId } from '../../../../utils/widget-utils';
2015
import { CONTROL_RICH_TEXTAREA } from '../../../../constants/dom-constants';
16+
import { getControlId } from '../../../../utils/widget-utils';
2117

2218
const { COMPONENT_CLASS } = CONTROL_RICH_TEXTAREA;
2319

@@ -196,7 +192,10 @@ class RichTextareaWithSuggestions extends ControlWithSuggestion {
196192
{required && <span className="ctrl-required">*</span>}
197193
</label>
198194
<div>
199-
<RichTextEditor
195+
<div style={{ color: 'red' }}>
196+
<b>ToDo</b>RichTextEditor
197+
</div>
198+
{/* <RichTextEditor
200199
blockStyleFn={() => 'singleline'}
201200
value={editorValue}
202201
onChange={this.handleChange}
@@ -214,7 +213,7 @@ class RichTextareaWithSuggestions extends ControlWithSuggestion {
214213
}}
215214
handleKeyCommand={this.handleKeyCommand}
216215
keyBindingFn={myKeyBindingFn}
217-
/>
216+
/> */}
218217
{touched && error && <span className="form-error">{error}</span>}
219218
{super.render()}
220219
</div>

src/forms/controls/rich-textarea/decorators/rich-textarea-decorators.jsx

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { CompositeDecorator } from 'draft-js';
2-
import RichTextareaLink from './rich-textarea-link';
1+
// import { CompositeDecorator } from 'draft-js';
32
import RichTextareaCondition from './rich-textarea-condition';
3+
import RichTextareaLink from './rich-textarea-link';
44

55
// Utils
66

@@ -29,7 +29,13 @@ export const customConditionDecorator = {
2929
component: RichTextareaCondition,
3030
};
3131

32-
export default new CompositeDecorator([
33-
customLinkDecorator,
34-
customConditionDecorator,
35-
]);
32+
export default () => (
33+
<div style={{ color: 'red' }}>
34+
<b>ToDo </b>CompositeDecorator
35+
</div>
36+
);
37+
38+
// export default new CompositeDecorator([
39+
// customLinkDecorator,
40+
// customConditionDecorator,
41+
// ]);

src/forms/controls/rich-textarea/lib/state-from-markdown-vtl.js

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
export default function stateFromMarkdown(/* markdown */) {
2+
// const elementMarkdown = MarkdownParser.parse(markdown, { getAST: true });
3+
4+
return (
5+
<div style={{ color: 'red' }}>
6+
<b>ToDo</b>stateFromElement (draft-js)
7+
</div>
8+
);
9+
10+
// return stateFromElement(elementMarkdown, {
11+
// customInlineFn: (element, { Entity }) => {
12+
// const className = element.getAttribute('className');
13+
// let condition;
14+
// if (element.tagName === 'SPAN' && className === 'condition') {
15+
// condition = Entity('CONDITION', {
16+
// conditions: JSON.parse(element.getAttribute('conditions')),
17+
// });
18+
// }
19+
20+
// return condition;
21+
// },
22+
// });
23+
}

0 commit comments

Comments
 (0)