Skip to content

Commit

Permalink
Merge pull request #60 from InseeFr/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
BettyB979 authored Jun 25, 2024
2 parents 1894cc0 + b77eea2 commit 0d9d05f
Show file tree
Hide file tree
Showing 17 changed files with 13,525 additions and 60 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Use Node.js 14C
uses: actions/setup-node@v1
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: yarn --frozen-lockfile
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- name: script download and install access-content
run: |
chmod +x ./scripts/getContent.sh
Expand All @@ -33,7 +33,7 @@ jobs:
- run: yarn run test
- run: yarn build
- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
path: build
18 changes: 9 additions & 9 deletions .github/workflows/develop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Use Node.js 14C
uses: actions/setup-node@v1
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: yarn --frozen-lockfile
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- name: script download and install access-content
run: |
chmod +x ./scripts/getContent.sh
Expand All @@ -34,15 +34,15 @@ jobs:
- run: yarn
- run: yarn build
- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
path: build
release:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get current version
id: version
uses: notiz-dev/github-action-json-property@release
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ jobs:
install:
runs-on: ubuntu-latest
steps:
- name: Use Node.js 14C
uses: actions/setup-node@v1
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- run: yarn --frozen-lockfile
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: 14
node-version: 18
- name: script download and install access-content
run: |
chmod +x ./scripts/getContent.sh
Expand All @@ -34,15 +34,15 @@ jobs:
- run: yarn
- run: yarn build
- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build
path: build
release:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get current version
id: version
uses: notiz-dev/github-action-json-property@release
Expand All @@ -64,10 +64,10 @@ jobs:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Download build
id: download
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: build
path: build
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,3 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
yarn.lock*
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM nginx
FROM nginx:stable-alpine
COPY build /usr/share/nginx/html
RUN rm etc/nginx/conf.d/default.conf
COPY nginx-coleman-promotion.conf etc/nginx/conf.d/
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "colempub",
"version": "1.0.2",
"version": "1.0.10",
"dependencies": {
"axios": "^0.19.2",
"bootstrap": "^3.3.7",
Expand All @@ -22,7 +22,7 @@
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"build": "export SET NODE_OPTIONS=--openssl-legacy-provider && react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Expand Down
10 changes: 8 additions & 2 deletions src/components/auth/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ import { getSurveyVerifMailById } from 'utils/read-content';
import { getQuestionnaireUrl } from 'utils/api';
import useAuth from 'utils/hook/auth';
import NoSurveyPage from 'components/content/ineligible';
import UnauthorizedPage from 'components/content/unauthorized';

const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => {
const { loading, authenticated, authError } = useAuth(keycloakAuth);
const [error, setError] = useState(null);
const [ineligible, setIneligible] = useState(false);
const [unauthorized, setUnauthorized] = useState(false);

const redirectToUrl = url => {
window.location = url;
Expand All @@ -35,8 +37,11 @@ const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => {
setIneligible(true);
}
} catch (e) {
// including 410 status - no habilitation found
setError('technique');
if (e.response.status === 401 || e.response.status === 403 || e.response.status === 404) {
setUnauthorized(true);
} else {
setError('technique');
}
}
}, [history, id, urlBackEnd, keycloakAuth]);

Expand All @@ -50,6 +55,7 @@ const Auth = ({ urlBackEnd, id, history, keycloakAuth }) => {
{loading && <Loading id={id} />}
{error && <ErrorComponent error={error} />}
{ineligible && <NoSurveyPage id={id} />}
{unauthorized && <UnauthorizedPage id={id} />}
</>
);
};
Expand Down
6 changes: 4 additions & 2 deletions src/components/content/faq/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ class Faq extends Component {
const { itemDisplayed } = this.state;
return (
<section>
<h2>{`Questions générales`}</h2>
{faqData.filter(f => f.type === 'general' && f.body !== undefined).length > 0 && (
<h2>{`Questions générales`}</h2>
)}
{faqData.map(({ id, title, body, type }) =>
type === 'general' ? (
type === 'general' && body !== undefined ? (
<FaqItem
id={id}
key={`faq-item-${id}`}
Expand Down
26 changes: 26 additions & 0 deletions src/components/content/unauthorized.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from 'react';
import ReactMarkdown from 'react-markdown';
import { getUnauthorizedText } from 'utils/read-content';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';

const UnauthorizedPage = ({ id }) => {
return (
<>
<div className="no-survey">
<section>
<p>
<ReactMarkdown source={getUnauthorizedText()} linkTarget="_blank" />
{` En cas de difficultés, vous pouvez `}
<Link to={`/${id}/contacter-assistance`}>{`contacter l'assistance`}</Link>
</p>
</section>
</div>
</>
);
};

export default UnauthorizedPage;
UnauthorizedPage.propTypes = {
id: PropTypes.string.isRequired,
};
1 change: 1 addition & 0 deletions src/components/forms/assistance-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class AssistanceForm extends React.Component {
const formData = {
auth,
idue: auth ? params.get('idue') : '',
questioningId: auth ? params.get('questioningId') : '',
name: formControls.name.value,
idec: formControls.idec.value,
phonenumber: formControls.phonenumber.value,
Expand Down
2 changes: 1 addition & 1 deletion src/components/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SurveyItem from 'components/template/survey-item';

const Home = () => (
<div id="main">
<Banner title={`Portail de réponse aux enquêtes de la statistique publique`} />
<Banner title={`Portail de réponse\r\n aux enquêtes de la statistique publique`} />

<div className="row">
<div className="col-md-12 text-justify">
Expand Down
2 changes: 1 addition & 1 deletion src/components/template/response-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const ResponseButton = ({ id }) => (
<button
type="button"
className="btn btn-lg"
id="boutonRepondre"
id="accessButton"
disabled={!getIsSurveyOnlineById(id)}
>
{'Accéder au questionnaire'}
Expand Down
4 changes: 2 additions & 2 deletions src/components/template/survey-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Link } from 'react-router-dom';

const SurveyItem = ({ survey }) => (
<div className="survey-item">
<Link to={`/${survey.id}`} tabIndex="-1">
<button type="button" className="btn btn-lg" id="boutonRepondre">
<Link to={`/${survey.id}`} tabIndex="-1" className='survey-item-link'>
<button type="button" className="btn" id="boutonRepondre">
<span>{survey.titleShort}</span>
<br />
{`${window.location.host}/${survey.id}`}
Expand Down
37 changes: 31 additions & 6 deletions src/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,27 @@ h2 {
.btn-md {
margin-right: 10px;
}

#survey-item-link {
display: inline-block;
width: 100%;
height: 100%;
}

#boutonRepondre {
display: flex;
flex-direction: column;
white-space: inherit;
width: 100%;
height: 100%;
justify-content: center;
align-items: center;
word-wrap: break-word;
}

#menuItemRepondre,
#boutonRepondre,
#accessButton,
#boutonMailConfirm,
#boutonMailModif,
#formSend,
Expand All @@ -105,10 +124,12 @@ h2 {
}
#menuItemRepondre:hover,
#boutonRepondre:hover,
#accessButton:hover,
#boutonMailConfirm:hover,
#boutonMailModif:hover,
#menuItemRepondre:focus,
#boutonRepondre:focus,
#accessButton:focus,
#boutonMailConfirm:focus,
#boutonMailModif:focus,
#formSend:hover,
Expand Down Expand Up @@ -321,14 +342,18 @@ div.banner-top h1 {

/* survey item */
.surveys-list {
text-align: center;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
gap: 10px;
margin-top:2rem;
}

.survey-item {
text-align: center;
margin: 5px;
display: inline-block;
width: 30%;
min-width: 300px;
border-radius: 7px;
width: auto;
background-color: $blue-insee;
color: $yellow-insee;

Expand All @@ -340,7 +365,7 @@ div.banner-top h1 {
text-decoration: none;
}
span {
font-size: 2em;
font-size: 1.5em;
}
}

Expand Down
Loading

0 comments on commit 0d9d05f

Please sign in to comment.