Skip to content

Commit

Permalink
first gide commit (#75)
Browse files Browse the repository at this point in the history
Co-authored-by: Jean DJADJA <jean.djadja@gide.net>
  • Loading branch information
jeandelest and Jean DJADJA authored Nov 28, 2023
1 parent 69d2eaa commit e7b713b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions drama-queen/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh
echo "window._env_['VITE_QUEEN_URL'] = '$VITE_QUEEN_URL';" >> /usr/share/nginx/html/env-config.js
echo "window._env_['VITE_QUEEN_V2_URL'] = '$VITE_QUEEN_V2_URL';" >> /usr/share/nginx/html/env-config.js
echo "window._env_['VITE_CAPMI_URL'] = '$VITE_CAPMI_URL';" >> /usr/share/nginx/html/env-config.js
exec "$@"
2 changes: 2 additions & 0 deletions drama-queen/src/custom.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
declare module "queen_v2/*";
declare module "queen";
declare module "capmi";

declare namespace JSX {
interface IntrinsicElements {
"queen-app": any;
"queen-v2-app": any;
"capmi-app": any;
}
}
3 changes: 3 additions & 0 deletions drama-queen/src/queen-service-worker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
/* eslint-disable no-restricted-globals */
self._QUEEN_URL = import.meta.env.VITE_QUEEN_URL;
self._QUEEN_V2_URL = import.meta.env.VITE_QUEEN_V2_URL;
self._QUEEN_CAPMI_URL = import.meta.env.VITE_CAPMI_URL;

importScripts(`${self._QUEEN_URL}/queen-service-worker.js`);
importScripts(`${self._QUEEN_V2_URL}/queen-service-worker.js`);
// The line above raise error in pearl ui (check why with insee)
// importScripts(`${self._QUEEN_CAPMI_URL}/queen-service-worker.js`);

const getDramaQueenUrlRegex = (url) => {
return url
Expand Down
4 changes: 4 additions & 0 deletions drama-queen/src/routing/createRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import type { RouteObject } from "react-router-dom";
export const createRoutes = (queenVersion: 1 | 2 = 1): RouteObject[] => {
const queenElement = queenVersion === 1 ? <queen-app /> : <queen-v2-app />;
return [
{
path: "/queen/gide/questionnaire/:quest/survey-unit/:surv",
element: <capmi-app></capmi-app>
},
{
path: "queen/env",
element: <EnvPage />
Expand Down
1 change: 1 addition & 0 deletions drama-queen/src/utils/injectLegacyQueens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ const injectBodyScript = (url: string) => {
export const injectLegacyEntryQueens = () => {
injectBodyScript(`${import.meta.env.VITE_QUEEN_URL}/entry.js`);
injectBodyScript(`${import.meta.env.VITE_QUEEN_V2_URL}/entry.js`);
injectBodyScript(`${import.meta.env.VITE_CAPMI_URL}/entry.js`);
};
1 change: 1 addition & 0 deletions drama-queen/src/vite-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ declare const APP_VERSION: string;
interface ImportMetaEnv {
readonly VITE_QUEEN_URL: string;
readonly VITE_QUEEN_V2_URL: string;
readonly VITE_CAPMI_URL: string;
readonly VITE_CAMPAIGN_ID_V2: string[];
// more env variables...
}
Expand Down

0 comments on commit e7b713b

Please sign in to comment.