Skip to content

Commit

Permalink
Merge pull request #3 from InseeFr/fix/business-feedback-queen-v2
Browse files Browse the repository at this point in the history
Fix/business feedback queen v2
  • Loading branch information
laurentC35 authored Jun 7, 2023
2 parents 3f15588 + 8913a6c commit 25febe2
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "drama-queen-container",
"private": true,
"version": "1.1.1",
"version": "1.1.2",
"workspaces": [
"drama-queen",
"queen-v2",
Expand Down
2 changes: 1 addition & 1 deletion queen-v2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "queen-v2",
"version": "1.0.1",
"version": "1.0.2",
"description": "Web application for the management of questionnaires powered by Lunatic",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { ArrowRightAlt, SkipNext } from '@material-ui/icons';

import { Button } from 'components/designSystem';
import D from 'i18n';
import KeyboardEventHandler from 'react-keyboard-event-handler';
import PropTypes from 'prop-types';
import React from 'react';
import KeyboardEventHandler from 'react-keyboard-event-handler';
import { SHORTCUT_FAST_FORWARD } from 'utils/constants';
import { useStyles } from './continue.style';

Expand All @@ -19,12 +19,14 @@ const ButtonContinue = ({
isLastReachedPage,
componentHasResponse,
isLastPage,
loopVariables = [],
page,
}) => {
const classes = useStyles();
const localPageFastForward = () => goToLastReachedPage();

const shouldFastForward = !readonly && rereading && !isLastReachedPage;
const shouldFastForward =
loopVariables.length === 0 && !readonly && rereading && !isLastReachedPage;
const shouldQuit = isLastPage && readonly;
const shouldSaveAndQuit = isLastPage && !readonly;
const shouldContinue = !shouldFastForward && componentHasResponse && !rereading;
Expand All @@ -50,7 +52,7 @@ const ButtonContinue = ({

const keyboardShortcut = (key, e) => {
e.preventDefault();
if (key === SHORTCUT_FAST_FORWARD) localPageFastForward();
if (key === SHORTCUT_FAST_FORWARD && shouldFastForward) localPageFastForward();
};

const geLabelToDisplay = () => {
Expand All @@ -71,6 +73,7 @@ const ButtonContinue = ({
const onClickFunction = () => {
if (shouldFastForward) return goToLastReachedPage;
if (shouldContinue) return pageNextFunction;
if (shouldSaveAndQuit) return localFinalQuit;
};

const helpLabel = shouldFastForward ? D.ctrlEnd : D.ctrlEnter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function LightOrchestrator({
overview = [],
// waiting,
pager,

// getErrors,
// getModalErrors,
getCurrentErrors,
Expand Down Expand Up @@ -276,6 +277,7 @@ function LightOrchestrator({
isLastReachedPage={isLastReachedPage}
componentHasResponse={hasResponse}
goToLastReachedPage={goToLastReachedPage}
loopVariables={loopVariables}
></ButtonContinue>
</div>
<NavBar
Expand Down
23 changes: 17 additions & 6 deletions queen-v2/src/components/orchestrator/lunaticStyle/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const useCustomLunaticStyles = makeStyles(theme => ({
marginTop: '1em',
fontWeight: 'normal',
fontSize: '92%',
'&.declaration-help': {
'&.declaration-help, &.HELP': {
color: theme.palette.declarations.help,
},
display: 'table',
Expand Down Expand Up @@ -182,21 +182,29 @@ export const useCustomLunaticStyles = makeStyles(theme => ({
'& .lunatic-icon': {
display: 'none',
},

'& > .lunatic-input-checkbox': {
display: 'inline-flex',
display: 'block',
alignItems: 'center',
// padding: '0.5em 0.5em 0.5em 0.6em',
position: 'relative',
// right: '1.3em',
// width: '92%',
},

'& > .lunatic-input-radio': {
display: 'block',
alignItems: 'center',
// padding: '0.5em 0.5em 0.5em 0.6em',
position: 'relative',
// right: '1.3em',
// width: '92%',
[theme.breakpoints.down('md')]: {
width: '85%',
},
},
'&:hover span': {
color: `${modalityLabelColorChecked}`,
fontWeight: 'bold',
'& *': {
fontWeight: 'bold',
},
// TODO code-modality not provided (yet?) in lunatic-v2
'& .code-modality': {
color: `${modalityCodeBackgroundColor}`,
Expand All @@ -215,6 +223,9 @@ export const useCustomLunaticStyles = makeStyles(theme => ({
'& span': {
color: `${modalityLabelColorChecked}`,
fontWeight: 'bold',
'& *': {
fontWeight: 'bold',
},
// TODO code-modality not provided (yet?) in lunatic-v2
'& .code-modality': {
color: `${modalityCodeBackgroundColor}`,
Expand Down

0 comments on commit 25febe2

Please sign in to comment.