Skip to content

Commit

Permalink
Develop (#101)
Browse files Browse the repository at this point in the history
* v4 datamodel enum implementation

* identification component, tabs navigation
contactAttempt medium

* identification component
contactOutcomeConfiguration handling
contactAttemptConfiguration handling
navigation refactor

* prevent full package import with destructuration

* remove dead code

* ES2020 syntax

* syntax update

* transmission controls handle identification

* extends data managed by identification hook
minor graphical/typo fixes

* identification questionnaire internal state OK

* missing answer

* selected tab text color

* fix identification component when no data

* IASCO transmission control implementation
log removal

* fix undefined identification evaluation

* fix enum entry for API compliance

* identification generate valid starting state

* typo

* label changes

* prevent tab switching when saving

* fix transmission control

* fix panel navigation

* save each identification

* filter contactOutcome by COconfiguration

* UI refactor

* fix contact outcome enums by medium

* fix enum typo for API compliance

* fix selected question highlight
prevent valid answers erasure

* update identification tab label

* sticky tabs bar & prevent overlap on scrolls

* extend comment length

* new GUI components

* fix background color in UE page

* GUI improvements : nex compos & CSS

* remove previous component

* remove unused dictionnary entries

* split info in column

* update contact data display

* update contact component display

* fuse individual, phone, mail forms

* new components graphical enhancement

* GUI AppBar update

* contact[attempt/ouctome] GUI update

* minor code fix

* remove unused imports

* update infoTile test : minr GUI change

* GUI forms refactor - WIP

* user form birthdate change fix

* fixes

* working phoneNumber

* prevent updating fiscal/directory phone numbers

* fix missing phone number crash

* theme integration for buttons

* delete phoneNumbers
lateral menu css fix
email edition fix
birthdate display fix

* remove unused import

* itw phone number duplicate removal

* fix transmission control

* GUI fixes

* CSS clean-up, dead code removal

* rename folder

* CSS, fix default contactoutcome

* remove unused components

* address form refactor

* CSS i18n new address data function

* infoTile text overflow

* fix minor bug

* fix tests

Co-authored-by: Nicolas Turban <[email protected]>
  • Loading branch information
SimonDmz and nicolasTurban authored Oct 10, 2022
1 parent fced37d commit 8ef6f31
Show file tree
Hide file tree
Showing 93 changed files with 2,744 additions and 1,812 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pearl",
"version": "0.5.7",
"version": "0.6.0",
"private": true,
"dependencies": {
"@date-io/date-fns": "1.x",
Expand All @@ -25,6 +25,7 @@
"react-modal": "^3.11.1",
"react-router-dom": "^5.2.0",
"react-scripts": "4.0.3",
"react-swipeable-views": "^0.14.0",
"workbox-cacheable-response": "^5.1.3",
"workbox-core": "^5.1.3",
"workbox-precaching": "^5.1.3",
Expand Down
6 changes: 3 additions & 3 deletions public/configuration.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"QUEEN_URL": "https://queen.demo.dev.sspcloud.fr",
"QUEEN_URL": "http://localhost:5000",
"_QUEEN_URL_COMMENT_": "Final URL of the Queen application",

"PEARL_API_URL": "https://api.organisation-collecte-enqueteurs.enquetes.developpement.insee.fr",
"PEARL_API_URL": "http://localhost:8080",
"_PEARL_API_URL_COMMENT_": "url of Pearl API",

"PEARL_AUTHENTICATION_MODE": "anonymous",
"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"
Expand Down
7 changes: 3 additions & 4 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import React from 'react';
import CssBaseline from '@material-ui/core/CssBaseline';
import { ThemeProvider } from '@material-ui/core/styles';

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';
Expand Down
27 changes: 0 additions & 27 deletions src/components/common/IconStatus.js

This file was deleted.

11 changes: 5 additions & 6 deletions src/components/common/Notification/notificationItem.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import React, { useContext } from 'react';
import Link from '@material-ui/core/Link';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';

import { NOTIFICATION_TYPE_MANAGEMENT, NOTIFICATION_TYPE_SYNC } from 'utils/constants';
import React, { useContext } from 'react';

import D from 'i18n';
import { FiberManualRecord } from '@material-ui/icons';
import FiberManualRecord from '@material-ui/icons/FiberManualRecord';
import Link from '@material-ui/core/Link';
import { NavigationContext } from '../navigation/component';
import { NotificationWrapperContext } from 'components/notificationWrapper';
import { SynchronizeWrapperContext } from 'components/sychronizeWrapper';
import Typography from '@material-ui/core/Typography';
import { dateFnsLocal } from 'utils';
import { formatDistance } from 'date-fns';
import { makeStyles } from '@material-ui/core/styles';
import syncReportIdbService from 'utils/indexeddb/services/syncReport-idb-service';

const useStyles = makeStyles(theme => ({
Expand Down
58 changes: 29 additions & 29 deletions src/components/common/navigation/component.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,33 @@
import React, { useContext, useEffect, useState } from 'react';
import { NavLink, Route } from 'react-router-dom';
import React, { useContext } from 'react';

import AppBar from '@material-ui/core/AppBar';
import Badge from '@material-ui/core/Badge';
import Card from '@material-ui/core/Card';
import CardMedia from '@material-ui/core/CardMedia';
import ClickAwayListener from '@material-ui/core/ClickAwayListener';
import D from 'i18n';
import Fade from '@material-ui/core/Fade';
import IconButton from '@material-ui/core/IconButton';
import Popper from '@material-ui/core/Popper';
import Tooltip from '@material-ui/core/Tooltip';
import MenuIcon from '@material-ui/icons/Menu';
import Notifications from '@material-ui/icons/Notifications';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';

import D from 'i18n';
import InfoTile from 'components/panel-body/UEpage/infoTile/infoTile';
import { NotificationWrapperContext } from 'components/notificationWrapper';
import Notifications from '@material-ui/icons/Notifications';
import { NotificationsRoot } from '../Notification/notificationsRoot';
import OnlineStatus from '../online-status';
import { PEARL_USER_KEY } from 'utils/constants';
import Popper from '@material-ui/core/Popper';
import PropTypes from 'prop-types';
import SearchBar from '../search/component';
import Synchronize from 'components/common/synchronize';
import Toolbar from '@material-ui/core/Toolbar';
import Tooltip from '@material-ui/core/Tooltip';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core/styles';

export const NavigationContext = React.createContext();

const Navigation = ({ location, textSearch, setTextSearch, setOpenDrawer }) => {
const Navigation = ({ textSearch, setTextSearch, setOpenDrawer }) => {
const { unReadNotificationsNumber } = useContext(NotificationWrapperContext);
const [disabled, setDisable] = useState(location.pathname.startsWith('/queen'));

useEffect(() => {
setDisable(location.pathname.startsWith('/queen'));
}, [location]);

const getName = () => {
const interviewerFromLocalStorage = window.localStorage.getItem(PEARL_USER_KEY);
Expand Down Expand Up @@ -65,7 +59,7 @@ const Navigation = ({ location, textSearch, setTextSearch, setOpenDrawer }) => {
flex: '1 1 auto',
},
notificationsIcon: {
fontSize: 'xxx-large',
fontSize: 'xx-large',
color: theme.palette.secondary.main,
'&:hover': { color: theme.palette.secondary.dark },
},
Expand All @@ -78,6 +72,8 @@ const Navigation = ({ location, textSearch, setTextSearch, setOpenDrawer }) => {
'&:focus, &:hover': {
backgroundColor: theme.palette.primary.main,
},
marginLeft: '1em',
marginRight: '1em',
},
notif: {
zIndex: 1200,
Expand All @@ -103,26 +99,31 @@ const Navigation = ({ location, textSearch, setTextSearch, setOpenDrawer }) => {
<NavigationContext.Provider value={context}>
<AppBar position="sticky" className={classes.appBar} elevation={0}>
<Toolbar className={classes.appBar}>
<NavLink activeClassName="active" exact to="/">
<Card className={classes.card}>
<CardMedia
className={classes.media}
image="/static/images/logo-insee-header.png"
title="Insee"
/>
</Card>
</NavLink>
<Tooltip title={D.goToHomePage}>
<IconButton
className={classes.noVisibleFocus}
edge="start"
edge="end"
color="inherit"
aria-label="open notifications"
onClick={() => setOpenDrawer(true)}
>
<MenuIcon className={classes.notificationsIcon} />
</IconButton>
</Tooltip>
<NavLink activeClassName="active" exact to="/">
<Card className={classes.card}>
<CardMedia
className={classes.media}
image="/static/images/logo-insee-header.png"
title="Insee"
/>
</Card>
</NavLink>
<Typography variant="h4">Sabiane</Typography>
<Typography variant="h4" color="error">
Collecte
</Typography>

<div className={classes.grow}>
<Route
exact
Expand All @@ -131,7 +132,6 @@ const Navigation = ({ location, textSearch, setTextSearch, setOpenDrawer }) => {
<SearchBar {...routeProps} textSearch={textSearch} setTextSearch={setTextSearch} />
)}
/>
<Route path="/survey-unit/:id" render={routeProps => <InfoTile {...routeProps} />} />
</div>
<div className={classes.column}>
<ClickAwayListener onClickAway={handleClickAway}>
Expand Down Expand Up @@ -165,7 +165,7 @@ const Navigation = ({ location, textSearch, setTextSearch, setOpenDrawer }) => {
{getName()}
</Typography>
</div>
<Synchronize disabled={disabled} materialClass={classes.syncIcon} />
<Synchronize materialClass={classes.syncIcon} />
</Toolbar>
</AppBar>
</NavigationContext.Provider>
Expand Down
45 changes: 16 additions & 29 deletions src/components/common/search/component.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,28 @@
import React from 'react';
import InputBase from '@material-ui/core/InputBase';
import { makeStyles } from '@material-ui/core/styles';
import PropTypes from 'prop-types';
import React from 'react';
import { makeStyles } from '@material-ui/core/styles';

const useStyles = makeStyles(theme => ({
search: {
[theme.breakpoints.up('sm')]: {
marginLeft: theme.spacing(3),
width: '75%',
},
},
inputInput: {
padding: theme.spacing(1, 1, 1, 1),
border: 'solid 1px black',
},
}));

const SearchBar = ({ textSearch, setTextSearch }) => {
const classes = useStyles();
const handleChange = e => {
const txt = e.target.value;
setTextSearch(txt);
};

const useStyles = makeStyles(theme => ({
search: {
position: 'relative',
marginRight: theme.spacing(2),
marginLeft: 0,
height: '2em',
[theme.breakpoints.up('sm')]: {
marginLeft: theme.spacing(3),
width: '75%',
},
},

inputRoot: {
color: 'inherit',
height: '2em',
},
inputInput: {
padding: theme.spacing(1, 1, 1, 0),
paddingLeft: `1em`,
// backgroundColor: theme.color.backgroundColor,
border: 'solid 1px black',
color: 'black',
marginRight: '1em',
},
}));
const classes = useStyles();

return (
<InputBase
className={classes.search}
Expand Down
32 changes: 32 additions & 0 deletions src/components/common/sharedComponents/EditableBooleanField.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core';

const useStyles = makeStyles(() => ({
row: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: '1em',
},
}));

export const EditableBooleanField = ({ id, label, defaultValue = undefined, onChangeFunction }) => {
const classes = useStyles();
return (
<div className={classes.row}>
<Typography color="textSecondary">{label}</Typography>
<TextField
margin="dense"
id={id}
name={id}
InputLabelProps={{ color: 'secondary' }}
type="checkbox"
fullWidth
inputProps={{ checked: defaultValue }}
onChange={event => onChangeFunction(event)}
/>
</div>
);
};
32 changes: 32 additions & 0 deletions src/components/common/sharedComponents/EditableTextField.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import React from 'react';
import TextField from '@material-ui/core/TextField';
import Typography from '@material-ui/core/Typography';
import { makeStyles } from '@material-ui/core';

const useStyles = makeStyles(() => ({
row: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: '1em',
},
}));

export const EditableTextField = ({ id, label, defaultValue = '', onChangeFunction }) => {
const classes = useStyles();
return (
<div className={classes.row}>
<Typography color="textSecondary">{label}</Typography>
<TextField
margin="dense"
id={id}
name={id}
InputLabelProps={{ color: 'secondary' }}
type="text"
fullWidth
defaultValue={defaultValue}
onChange={event => onChangeFunction(event)}
/>
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { EditableTextField } from './EditableTextField';
import React from 'react';
import { makeStyles } from '@material-ui/core';

const useStyles = makeStyles(theme => ({
row: {
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
gap: '1em',
},
}));

export const EditableTextFieldWithClickableIcon = ({
id,
label,
defaultValue = '',
icons = [],
onChangeFunction,
}) => {
const classes = useStyles();
return (
<div className={classes.row}>
<EditableTextField
id={id}
label={label}
defaultValue={defaultValue}
onChangeFunction={onChangeFunction}
/>
{icons.map(Icon => (
<Icon />
))}
</div>
);
};
Loading

0 comments on commit 8ef6f31

Please sign in to comment.