-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
1,430 additions
and
567 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/node_modules/ | ||
.DS_Store | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
"eslint:recommended", | ||
"plugin:react/recommended", | ||
"plugin:react/jsx-runtime", | ||
"plugin:jsx-a11y/recommended", | ||
"plugin:react-hooks/recommended", | ||
"plugin:prettier/recommended" // Make sure this is always the last element in the array. | ||
], | ||
parser: "@typescript-eslint/parser", | ||
parserOptions: { ecmaVersion: "latest", sourceType: "module" }, | ||
settings: { react: { version: "detect" } }, | ||
env: { browser: true, amd: true, node: true }, | ||
plugins: ["simple-import-sort", "prettier"], | ||
rules: { | ||
"react/react-in-jsx-scope": "off", | ||
"jsx-a11y/accessible-emoji": "off", | ||
"@typescript-eslint/explicit-function-return-type": "off", | ||
"simple-import-sort/imports": "error", | ||
"simple-import-sort/exports": "error", | ||
"jsx-a11y/anchor-is-valid": [ | ||
"error", | ||
{ | ||
components: ["Link"], | ||
specialLink: ["hrefLeft", "hrefRight"], | ||
aspects: ["invalidHref", "preferButton"] | ||
} | ||
] | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/node_modules/ | ||
/dist/ | ||
/.eslintrc.js | ||
/docs/ | ||
/CHANGELOG.md | ||
/.yarn_home |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"printWidth": 105, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": false, | ||
"quoteProps": "preserve", | ||
"trailingComma": "none", | ||
"bracketSpacing": true, | ||
"arrowParens": "avoid" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,46 @@ | ||
{ | ||
"name": "drama-queen", | ||
"private": true, | ||
"version": "1.4.0", | ||
"type": "module", | ||
"scripts": { | ||
"dev": "vite --port 5000 --strictPort", | ||
"build": "tsc && node scripts/generate-entrypoint.js && vite build", | ||
"preview": "vite preview --port 5000 --strictPort", | ||
"serve": "vite preview --port 5000 --strictPort" | ||
}, | ||
"dependencies": { | ||
"dexie": "^3.2.4", | ||
"dexie-react-hooks": "^1.1.6", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.14.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.3.3", | ||
"@types/react": "^18.2.14", | ||
"@types/react-dom": "^18.2.6", | ||
"@vitejs/plugin-react": "^4.0.1", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.3.9", | ||
"vite-plugin-pwa": "^0.16.4", | ||
"workbox-cacheable-response": "^5.1.3", | ||
"workbox-core": "^5.1.3", | ||
"workbox-precaching": "^5.1.3", | ||
"workbox-routing": "^5.1.3", | ||
"workbox-strategies": "^5.1.3" | ||
} | ||
"name": "drama-queen", | ||
"private": true, | ||
"version": "1.4.0", | ||
"scripts": { | ||
"dev": "vite --port 5000 --strictPort", | ||
"build": "tsc && node scripts/generate-entrypoint.js && vite build", | ||
"preview": "vite preview --port 5000 --strictPort", | ||
"serve": "vite preview --port 5000 --strictPort", | ||
"lint:check": "eslint ./src --ext .ts,.tsx", | ||
"lint": "npm run lint:check -- --fix", | ||
"_format": "prettier \"**/*.{ts,tsx,json}\"", | ||
"format": "npm run _format -- --write", | ||
"format:check": "npm run _format -- --list-different" | ||
}, | ||
"dependencies": { | ||
"dexie": "^3.2.4", | ||
"dexie-react-hooks": "^1.1.6", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0", | ||
"react-router-dom": "^6.16.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20.3.3", | ||
"@types/react": "^18.2.14", | ||
"@types/react-dom": "^18.2.6", | ||
"@typescript-eslint/eslint-plugin": "^6.7.2", | ||
"@typescript-eslint/parser": "^6.7.2", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint-plugin-jsx-a11y": "^6.5.1", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"eslint-plugin-react": "^7.33.2", | ||
"eslint-plugin-simple-import-sort": "^10.0.0", | ||
"@vitejs/plugin-react": "^4.0.1", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.1.6", | ||
"vite": "^4.3.9", | ||
"vite-plugin-pwa": "^0.16.4", | ||
"workbox-cacheable-response": "^7.0.0", | ||
"workbox-core": "^7.0.0", | ||
"workbox-precaching": "^7.0.0", | ||
"workbox-routing": "^7.0.0", | ||
"workbox-strategies": "^7.0.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,27 @@ | ||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { RouterProvider } from "react-router-dom"; | ||
import { injectLegacyEntryQueens } from "utils/injectLegacyQueens"; | ||
|
||
import { createRouter } from "./routing/router-factory"; | ||
import { RoutingStrategy } from "./routing/types"; | ||
import { injectLegacyEntryQueens } from "utils/injectLegacyQueens"; | ||
|
||
const mount = ({ | ||
mountPoint, | ||
initialPathname, | ||
routingStrategy, | ||
mountPoint, | ||
initialPathname, | ||
routingStrategy | ||
}: { | ||
mountPoint: HTMLElement; | ||
initialPathname?: string; | ||
routingStrategy?: RoutingStrategy; | ||
mountPoint: HTMLElement; | ||
initialPathname?: string; | ||
routingStrategy?: RoutingStrategy; | ||
}) => { | ||
console.log("Mount Drama Queen"); | ||
injectLegacyEntryQueens(); | ||
|
||
console.log("Mount Drama Queen") | ||
injectLegacyEntryQueens(); | ||
|
||
const router = createRouter({ strategy: routingStrategy, initialPathname }); | ||
const root = createRoot(mountPoint); | ||
root.render(<RouterProvider router={router} />); | ||
const router = createRouter({ strategy: routingStrategy, initialPathname }); | ||
const root = createRoot(mountPoint); | ||
root.render(<RouterProvider router={router} />); | ||
|
||
return () => queueMicrotask(() => root.unmount()); | ||
return () => queueMicrotask(() => root.unmount()); | ||
}; | ||
|
||
export { mount }; | ||
export { mount }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
/* eslint-disable no-unused-vars */ | ||
declare module "queen_v2/*"; | ||
declare module "queen"; | ||
|
||
declare namespace JSX { | ||
interface IntrinsicElements { | ||
"queen-app": any; | ||
"queen-v2-app": any; | ||
} | ||
interface IntrinsicElements { | ||
"queen-app": any; | ||
"queen-v2-app": any; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
import('./bootstrap').then( | ||
({ mount }) => { | ||
const localRoot = document.getElementById('drama-queen'); | ||
import("./bootstrap").then(({ mount }) => { | ||
const localRoot = document.getElementById("drama-queen"); | ||
|
||
mount({ | ||
mountPoint: localRoot!, | ||
routingStrategy: 'browser', | ||
mountPoint: localRoot!, | ||
routingStrategy: "browser" | ||
}); | ||
} | ||
); | ||
}); | ||
|
||
export { }; | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
import React from 'react' | ||
import './env.css' | ||
import "./env.css"; | ||
|
||
import React from "react"; | ||
|
||
export function EnvPage() { | ||
return ( | ||
<div className="App"> | ||
<h1>Drama Queen v{APP_VERSION}</h1> | ||
<div className="card"> | ||
<p>Les variables d'environnements</p> | ||
<p className="read-the-docs"> | ||
{Object.entries(import.meta.env).filter(([k,]) => k.startsWith("VITE")).map(([k, v]) => ( | ||
<React.Fragment key={k}> | ||
<b>{k}</b> : {v}<br /> | ||
</React.Fragment> | ||
) | ||
)} | ||
</p> | ||
</div> | ||
</div > | ||
) | ||
}; | ||
return ( | ||
<div className="App"> | ||
<h1>Drama Queen v{APP_VERSION}</h1> | ||
<div className="card"> | ||
<p>Les variables d&aposenvironnements</p> | ||
<p className="read-the-docs"> | ||
{Object.entries(import.meta.env) | ||
.filter(([k]) => k.startsWith("VITE")) | ||
.map(([k, v]) => ( | ||
<React.Fragment key={k}> | ||
<b>{k}</b> : {v} | ||
<br /> | ||
</React.Fragment> | ||
))} | ||
</p> | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { db } from 'indexedDb' | ||
import { useParams } from 'react-router-dom' | ||
import { useLiveQuery } from "dexie-react-hooks"; | ||
import { db } from "indexedDb"; | ||
import { useParams } from "react-router-dom"; | ||
import { READ_ONLY } from "utils/constants"; | ||
|
||
type Params = { | ||
readonly?: typeof READ_ONLY; | ||
id: string; | ||
} | ||
readonly?: typeof READ_ONLY; | ||
id: string; | ||
}; | ||
|
||
export function SurveyUnitMapping() { | ||
const { readonly, id } = useParams<Params>(); | ||
const { readonly, id } = useParams<Params>(); | ||
|
||
const surveyUnit = useLiveQuery( | ||
() => db.surveyUnit.get({ id: id }), [id] | ||
) | ||
const surveyUnit = useLiveQuery(() => db.surveyUnit.get({ id: id }), [id]); | ||
|
||
if (!surveyUnit) return <div>In Progress</div> | ||
if (!surveyUnit) return <div>In Progress</div>; | ||
|
||
//return <Navigate to={(`/queen/${readonly ? `${readonly}/` : ''}questionnaire/${surveyUnit?.questionnaireId}/survey-unit/${id}`)} /> | ||
//We know that we will reload the entire app but it's due on purpose | ||
//Because of a faulty architecture and a queen non-modification constraint, we need to know which queen we're going to redirect to when the DramaQueen is mounted. | ||
window.location.href = `/queen/${readonly ? `${readonly}/` : ''}questionnaire/${surveyUnit?.questionnaireId}/survey-unit/${id}`; | ||
return null; | ||
//return <Navigate to={(`/queen/${readonly ? `${readonly}/` : ''}questionnaire/${surveyUnit?.questionnaireId}/survey-unit/${id}`)} /> | ||
//We know that we will reload the entire app but it's due on purpose | ||
//Because of a faulty architecture and a queen non-modification constraint, we need to know which queen we're going to redirect to when the DramaQueen is mounted. | ||
window.location.href = `/queen/${ | ||
readonly ? `${readonly}/` : "" | ||
}questionnaire/${surveyUnit?.questionnaireId}/survey-unit/${id}`; | ||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.