Skip to content

Commit

Permalink
Migrate to vite & fix import issues
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentC35 committed Dec 18, 2023
1 parent cc7e3ff commit d457e49
Show file tree
Hide file tree
Showing 29 changed files with 461 additions and 460 deletions.
2 changes: 1 addition & 1 deletion docs/en/developper-guide/remote-apis/configuration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration

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.
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.
2 changes: 1 addition & 1 deletion docs/fr/guide-developpeur/remote-apis/configuration.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Configuration

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`.
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`.
5 changes: 0 additions & 5 deletions jsconfig.json

This file was deleted.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,9 @@
"test": "react-scripts test --coverage -i",
"testw": "react-scripts test --watch",
"start": "vite",
"start-insee": "cross-env REACT_APP_INSEE=true react-scripts start",
"dev:server": "concurrently \"npm run server\" \"npm run start\"",
"server": "node ./fake-server/server.js",
"build": "npm run generate-entrypoint && vite build",
"build-insee": "cross-env REACT_APP_INSEE=true react-scripts build",
"lint": "eslint ./src -f table || true",
"lint:fix": "eslint ./src -f table --fix || true",
"jison": "jison jison/grammars/xpath.jison jison/grammars/xpath.jisonlex -o jison/generated-parsers/xpath-parser.js && node ./jison/fixParser.js",
Expand Down
9 changes: 3 additions & 6 deletions scripts/generate-entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
var fs = require('fs');

fs.readFile('.env', 'utf8', function(_, contents) {
fs.readFile('.env', 'utf8', function (_, contents) {
const content = contents
.split('\n')
.filter(line => !line.startsWith('#'))
.map(line => line.split('='))
.filter(data => data.length === 2)
.map(
([key]) =>
`echo "window._env_['${key.replace(
'REACT_APP_',
'',
)}'] = '\$${key.replace(
'REACT_APP_',
`echo "window._env_['${key.replace('VITE_', '')}'] = '\$${key.replace(
'VITE_',
'',
)}';" >> /usr/share/nginx/html/env-config.js`,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import React from 'react';
// import { EditorState, Modifier, getDefaultKeyBinding } from 'draft-js';
import PropTypes from 'prop-types';
import RichTextEditor from 'gillespie59-react-rte/dist/react-rte';
import { getDefaultKeyBinding, EditorState, Modifier } from 'draft-js';
import React from 'react';

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

import {
getEditorValue,
contentStateToString,
formatURL,
getEditorValue,
toolbarConfig,
toolbarConfigQuestion,
rootStyle,
} from '../../rich-textarea';

import { getControlId } from '../../../../utils/widget-utils';
import { CONTROL_RICH_TEXTAREA } from '../../../../constants/dom-constants';
import { getControlId } from '../../../../utils/widget-utils';

const { COMPONENT_CLASS } = CONTROL_RICH_TEXTAREA;

Expand Down Expand Up @@ -196,7 +192,10 @@ class RichTextareaWithSuggestions extends ControlWithSuggestion {
{required && <span className="ctrl-required">*</span>}
</label>
<div>
<RichTextEditor
<div style={{ color: 'red' }}>
<b>ToDo</b>RichTextEditor
</div>
{/* <RichTextEditor
blockStyleFn={() => 'singleline'}
value={editorValue}
onChange={this.handleChange}
Expand All @@ -214,7 +213,7 @@ class RichTextareaWithSuggestions extends ControlWithSuggestion {
}}
handleKeyCommand={this.handleKeyCommand}
keyBindingFn={myKeyBindingFn}
/>
/> */}
{touched && error && <span className="form-error">{error}</span>}
{super.render()}
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CompositeDecorator } from 'draft-js';
import RichTextareaLink from './rich-textarea-link';
// import { CompositeDecorator } from 'draft-js';
import RichTextareaCondition from './rich-textarea-condition';
import RichTextareaLink from './rich-textarea-link';

// Utils

Expand Down Expand Up @@ -29,7 +29,13 @@ export const customConditionDecorator = {
component: RichTextareaCondition,
};

export default new CompositeDecorator([
customLinkDecorator,
customConditionDecorator,
]);
export default () => (
<div style={{ color: 'red' }}>
<b>ToDo </b>CompositeDecorator
</div>
);

// export default new CompositeDecorator([
// customLinkDecorator,
// customConditionDecorator,
// ]);
20 changes: 0 additions & 20 deletions src/forms/controls/rich-textarea/lib/state-from-markdown-vtl.js

This file was deleted.

23 changes: 23 additions & 0 deletions src/forms/controls/rich-textarea/lib/state-from-markdown-vtl.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default function stateFromMarkdown(/* markdown */) {
// const elementMarkdown = MarkdownParser.parse(markdown, { getAST: true });

return (
<div style={{ color: 'red' }}>
<b>ToDo</b>stateFromElement (draft-js)
</div>
);

// return stateFromElement(elementMarkdown, {
// customInlineFn: (element, { Entity }) => {
// const className = element.getAttribute('className');
// let condition;
// if (element.tagName === 'SPAN' && className === 'condition') {
// condition = Entity('CONDITION', {
// conditions: JSON.parse(element.getAttribute('conditions')),
// });
// }

// return condition;
// },
// });
}
Loading

0 comments on commit d457e49

Please sign in to comment.