Skip to content

Commit

Permalink
DRAFT : Redesign & maintenance (#124)
Browse files Browse the repository at this point in the history
* feat: refactor layout and material UI

* ref: router 6 migration

* fix: legacy panels

* ref: filter rework

* feat: finish filter Home

* ref: redesign survey unit card

* fix: status chip

* fix(home): scrollbar offset

* add new color for lockIcon

* use local Typhography and change style

* add placeholder

* feat(ui): Row component

* add fontWeight to statusChip

* add inactiveStyle & inaccessible

* add inactive & locked

* add priority on card

* ref(ui): add disabled variant for Card

* terminated switch

* feat(ui): notifications

* fix: filter terminated

* remove color

* add finalize enum

* change accordion sidebar

* add finalize enum

* remove console.log palette

* feat: suivi circular progress

* feat: notifications actions

* feat(ui): Pie chart for suivi page

* ref: CampaignProgressPieChart

* ref: search and types

* feat: SyncDialog update

* feat: suivi table

* fix: comment modal

* fix: text layout on suivi table

* fix: button layout on sync result

* feat(ui): Survey Unit page header

* feat(ui): Survey Unit Address Card

* feat: survey unit logement & repérage

* feat: survey unit persons form & card

* fix: comment on add button

* fix: Contacts card

* fix: add form for comment dialog

* feat: ContactOutcomeForm

* feat: Contact attempt form

* feat: seeder for development

* feat: Communications form

* feat: Comment form

* ref: Snackbar

* fix: snackbar showing too much

* chore: cleaning

* chore: cleaning tests & dependencies

* feat: not found page

* Add new component QuestionnaireCard

* add icons

* create customChip

* HousingResident component

* personlist Component

* QuestionnaireCard component

* to fix gitlab ci

* remove rollupOptions

* feat: reset data page

* add help button & popover

* add old Questionnaire component

* fix surveyUnitHeader

* fix homepage

* fix tableau de synthése

* maj mui

* comment grappe select

* fix PieChart size

* add textfield searchByName

* feat: identification for phone surveyUnit

* feat: form for move property

* change paddingBlock for pieChart

* change filter input

* activate select grappe

* desactivate grappe

* fix: noident identification text

* active grappe select

* feat: persist filter state

* fix: label for identification

* fix pieChart label

* fix : no nograp doesn't crash Select anymore, bonus fix for ssech

* feat: packaged randomness

* chore: refactor code for readibility

* fix: remove Chat references, not used anymore

* fix: another chat reference

* fix: add missing radio-group `name` attribute

* feat: change some labels

* add persist campagn monsuivi

* oidc

* fix: typo

* feat: prevent workbox upgrade -> keep v6.6.1

* fix: restore previious authentication

* feat: fallback-configuration

* Chore service worker tests (#128)

* chore: test workbox 6

* feat: bump app version for test

* fix:  use theme from provider, clean theme build, i18n

* feat: restore state life-cycle

* fix: typo

* feat: transmission steps are checked instead of disapear

* fix: work-box dependecies version

* test: clg in sw registration

* chore: more log in SW installation

* chore: even more log

* fix: missing import

* Update ServiceWorkerStatus.jsx

* fix: restore Queen SW

* bumb: worbox version

* feat: i18n

---------

Co-authored-by: Laurent Caouissin <[email protected]>

* Fix suppress location (#129)

* fix: remove category dont know

* fix: conditional rendering for noLocation

* add noLocation to dictionnary

* fix: remove clg

* fix: add dynamic data for grappe

* fix: move addressDeliveryPoint to be correct with AddressCard

* feat: add reset to campaign select filter

* fix: handle tricky bug on phoneNumbers being switched between persons (#130)

* add case to switch lang depends on browser for datepicker

* fix: remove useless Fragment

* add medium message to contact

* add new condition & remove ternary

* correction orthographique status

* chore: remove unused files
  • Loading branch information
Grafikart authored Apr 9, 2024
1 parent 12c2733 commit 892b900
Show file tree
Hide file tree
Showing 235 changed files with 10,576 additions and 9,905 deletions.
5 changes: 2 additions & 3 deletions .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
QUEEN_URL=https://queen.demo.dev.sspcloud.fr
PEARL_API_URL=https://pearl-bo.demo.dev.sspcloud.fr
QUEEN_URL=https://drama-queen.demo.insee.io
PEARL_API_URL=https://pearl-bo.demo.insee.io
PEARL_AUTHENTICATION_MODE=anonymous
CHAT_URL=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dist
build
dist-ssr
*.local
Caddyfile

# Editor directories and files
.vscode/*
Expand Down
5 changes: 1 addition & 4 deletions configuration/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@
"_PEARL_API_URL_COMMENT_": "url of Pearl API",

"PEARL_AUTHENTICATION_MODE": "${PEARL_AUTHENTICATION_MODE}",
"_PEARL_AUTHENTICATION_MODE_COMMENT": "The mode of authentication. Currently, App is supporting 'anonymous'",

"CHAT_URL": "${CHAT_URL}",
"_CHAT_URL_COMMENT_": "url of Pearl Chat"
"_PEARL_AUTHENTICATION_MODE_COMMENT": "The mode of authentication. Currently, App is supporting 'anonymous'"
}
36 changes: 16 additions & 20 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="/static/images/logo-insee-header.png" />
<!--
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="/static/images/logo-insee-header.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="/manifest.json" />

<script type="text/javascript"
src="https://unpkg.com/@webcomponents/[email protected]/webcomponents-bundle.js"></script>
<title>Collecte Enquêteurs</title>
</head>
<link rel="manifest" href="/manifest.json" />

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="./src/index.jsx"></script>
</body>
<title>Collecte Enquêteurs</title>
</head>

</html>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script type="module" src="./src/index.jsx"></script>
</body>
</html>
59 changes: 24 additions & 35 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
{
"name": "pearl",
"version": "1.1.9",
"version": "2.0.1",
"private": true,
"dependencies": {
"@date-io/date-fns": "1.x",
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "^4.0.0-alpha.57",
"@material-ui/pickers": "^3.3.10",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
"@testing-library/user-event": "^11.2.5",
"clsx": "^1.1.1",
"date-fns": "^2.18.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/montserrat": "^5.0.16",
"@maverick-js/signals": "^5.11.4",
"@mui/icons-material": "^5.15.10",
"@mui/material": "^5.15.10",
"@mui/styles": "^5.15.10",
"@mui/x-date-pickers": "^6.18.6",
"date-fns": "^2.30.0",
"dexie": "^3.2.1",
"dexie-export-import": "^1.0.3",
"dexie-react-hooks": "^1.1.1",
"downloadjs": "^1.4.7",
"font-awesome": "^4.7.0",
"keycloak-js": "^10.0.2",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-modal": "^3.11.1",
"react-router-dom": "^5.2.0",
"postcss": "8.4.24",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-hook-form": "^7.49.2",
"react-router-dom": "^6.21.0",
"react-swipeable-views": "^0.14.0",
"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"
"zod": "^3.22.4"
},
"scripts": {
"dev": "vite",
Expand All @@ -52,9 +45,6 @@
"jsx-a11y"
],
"rules": {
"react/prop-types": [
"off"
],
"prettier/prettier": [
1,
{
Expand Down Expand Up @@ -99,12 +89,9 @@
},
"devDependencies": {
"@originjs/vite-plugin-federation": "^1.2.1",
"@types/react": "^16.9.23",
"@types/react-router-dom": "^5.1.3",
"@vitejs/plugin-react": "^3.1.0",
"@types/react": "^18.2.46",
"@vitejs/plugin-react": "^4.2.1",
"copy-and-watch": "^0.1.4",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.15.1",
"eslint-config-airbnb": "^18.0.1",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
Expand All @@ -113,12 +100,14 @@
"eslint-plugin-react": "^7.16.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jest-sonar-reporter": "^2.0.0",
"jsdom": "^21.1.1",
"prettier": "^1.19.1",
"react-test-renderer": "^17.0.2",
"jsdom": "^23.0.1",
"prettier": "^3.1.1",
"vite": "^4.2.1",
"vite-plugin-pwa": "^0.14.7",
"vite-plugin-pwa": "^0.19.2",
"vite-tsconfig-paths": "^3.6.0",
"vitest": "^0.29.7"
},
"volta": {
"node": "20.10.0"
}
}
6 changes: 2 additions & 4 deletions public/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
"PEARL_API_URL": "http://localhost:8080",
"_PEARL_API_URL_COMMENT_": "url of Pearl API",

"PEARL_AUTHENTICATION_MODE": "keycloak",
"_PEARL_AUTHENTICATION_MODE_COMMENT": "The mode of authentication. Currently, App is supporting 'anonymous'",
"CHAT_URL": "",
"_CHAT_URL_COMMENT_": "url of Pearl Chat"
"PEARL_AUTHENTICATION_MODE": "anonymous",
"_PEARL_AUTHENTICATION_MODE_COMMENT": "The mode of authentication. Supported values 'anonymous' and 'keycloak' "
}
136 changes: 96 additions & 40 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,102 @@
import { Route, useLocation } from 'react-router-dom';

import CssBaseline from '@material-ui/core/CssBaseline';
import D from 'i18n';
import { DatabaseConsole } from 'components/panel-body/databaseConsole';
import Home from 'components/panel-body/home';
import Notification from 'components/common/Notification';
import { NotificationWrapper } from 'components/notificationWrapper';
import Palette from 'components/common/palette';
import Preloader from 'components/common/loader';
import React from 'react';
import { ResetData } from 'components/panel-body/resetData';
import SynchronizeWrapper from 'components/sychronizeWrapper';
import { ThemeProvider } from '@material-ui/core/styles';
import theme from './theme';
import { useAuth } from 'utils/auth/initAuth';
import { useServiceWorker } from 'utils/hooks/useServiceWorker';
import { createBrowserRouter, Outlet, RouterProvider } from 'react-router-dom';
import { loadConfiguration, useConfiguration } from './utils/hooks/useConfiguration';
import { PearlTheme } from './ui/PearlTheme';
import { Header } from './ui/Header';
import { Home } from './pages/Home';
import { useAuth } from './utils/auth/initAuth';
import { Preloader } from './ui/Preloader';
import D from './i18n/build-dictionary';
import { SyncContextProvider } from './ui/Sync/SyncContextProvider';
import { useEffectOnce } from './utils/hooks/useEffectOnce';
import { SurveyUnitPage } from './pages/SurveyUnitPage';
import './app.css';
import { SuiviPage } from './pages/SuiviPage';
import { LocalizationProvider } from '@mui/x-date-pickers';
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
import { QueenPage } from './pages/QueenPage';
import { ServiceWorkerStatus } from './ui/ServiceWorkerStatus';
import { ResetData } from './pages/ResetData';
import { enUS, fr } from 'date-fns/locale';

const router = createBrowserRouter([
{
path: '/queen/*',
element: <QueenPage />,
},
{
path: '/',
element: <AppWrapper />,
children: [
{
path: '/',
element: <Home />,
},
{
path: '/suivi',
element: <SuiviPage />,
},
{
path: '/survey-unit/:id',
element: <Outlet />,
children: [
{
path: 'details',
element: <SurveyUnitPage />,
},
],
},
{
path: '/support/reset-data',
element: <ResetData />,
},
],
},
]);

export function App() {
const configuration = useConfiguration();

useEffectOnce(loadConfiguration, []);

if (!configuration) {
return null;
}

function App() {
const { pathname } = useLocation();
return <RouterProvider router={router} />;
}

function AppWrapper() {
const { authenticated } = useAuth();
const serviceWorkerInfo = useServiceWorker(authenticated);
const browserLanguage = navigator.language;
let dateFnsLocale;
switch (browserLanguage) {
case 'fr':
case 'fr-FR':
dateFnsLocale = fr;
break;
case 'en-US':
case 'en':
default:
dateFnsLocale = enUS;
break;
}

return (
<ThemeProvider theme={theme}>
<CssBaseline />
<Notification serviceWorkerInfo={serviceWorkerInfo} />
<div>
{!authenticated && <Preloader message={D.pleaseWait} />}
{authenticated && (
<SynchronizeWrapper>
<NotificationWrapper>
{!pathname.startsWith('/support') && (
<Route path="/" render={routeProps => <Home {...routeProps} />} />
)}
<Route path="/support/palette" component={Palette} />
<Route path="/support/reset-data" component={ResetData} />
<Route path="/support/database" component={DatabaseConsole} />
</NotificationWrapper>
</SynchronizeWrapper>
)}
</div>
</ThemeProvider>
<PearlTheme>
<LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={dateFnsLocale}>
<ServiceWorkerStatus authenticated={authenticated} />
<div>
{authenticated ? (
<SyncContextProvider>
<Header />
<Outlet />
</SyncContextProvider>
) : (
<Preloader message={D.pleaseWait} />
)}
</div>
</LocalizationProvider>
</PearlTheme>
);
}

export default App;
17 changes: 0 additions & 17 deletions src/AppRooter.jsx

This file was deleted.

35 changes: 0 additions & 35 deletions src/Root.jsx

This file was deleted.

Loading

0 comments on commit 892b900

Please sign in to comment.