diff --git a/Dockerfile b/Dockerfile index 5724bdb..7701558 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM nginx:stable-alpine +FROM nginx COPY build /usr/share/nginx/html RUN rm etc/nginx/conf.d/default.conf COPY nginx-coleman-promotion.conf etc/nginx/conf.d/ diff --git a/package.json b/package.json index 48cef88..d2a50bb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "colempub", - "version": "1.1.2", + "version": "1.0.2", "dependencies": { "axios": "^0.19.2", "bootstrap": "^3.3.7", diff --git a/src/components/main.js b/src/components/main.js index 04d229e..2d655e1 100644 --- a/src/components/main.js +++ b/src/components/main.js @@ -18,7 +18,7 @@ import AssistanceForm from 'components/forms/assistance-form'; import AssistanceRouter from 'components/forms/assistance-router'; import ControlEmailForm from 'components/forms/mail-modif'; import DonneesPersonnelles from './content/donnees-personnelles'; -import { isSurveyOnLine } from 'utils/api'; + import { idExists, getSurveyTitleById, @@ -40,9 +40,6 @@ class Main extends React.Component { showResponseButton: true, showMinimalFooter: false, id: match.params.id, - isSurveyOnLine: undefined, - messageSurveyOffline: "", - messageInfoSurveyOffline: "" }; } @@ -73,31 +70,10 @@ class Main extends React.Component { } }; - fetchData = async () => { - try { - const response = await isSurveyOnLine(this.props.urlBackEnd)(this.state.id); - if (response.data && response.data.opened === false) { - this.setState({isSurveyOnLine: false}) - this.setState({messageSurveyOffline: response.data.messageSurveyOffline}) - this.setState({messageInfoSurveyOffline: response.data.messageInfoSurveyOffline}) - } else { - this.setState({isSurveyOnLine: true}) - } - } catch (error) { - console.error('Error checking survey online:', error); - this.setState({isSurveyOnLine: false}) - } - }; - - componentDidMount = () => { - this.fetchData(); - } - - /* return */ render() { const { urlBackEnd, match, urlMySurveys, keycloakAuth } = this.props; - const { id, showMenu, showResponseButton, showMinimalFooter , isSurveyOnLine, messageSurveyOffline, messageInfoSurveyOffline} = this.state; + const { id, showMenu, showResponseButton, showMinimalFooter } = this.state; return ( <> @@ -129,7 +105,7 @@ class Main extends React.Component { )} /> - {showMenu && } + {showMenu && }
{/* } /> {!showMinimalFooter ? ( - + ) : ( - + )}
-
- {showResponseButton && - - } -
+
{showResponseButton && }
)} diff --git a/src/components/template/footer-menu.js b/src/components/template/footer-menu.js index 6004e02..b2e84d6 100644 --- a/src/components/template/footer-menu.js +++ b/src/components/template/footer-menu.js @@ -4,8 +4,9 @@ import { Navbar, Nav, NavItem } from 'react-bootstrap'; import { LinkContainer } from 'react-router-bootstrap'; import logoTwitter from 'img/common/logo-twitter.png'; import { urlInseeFr } from 'utils/properties'; +import { getIsSurveyOnlineById } from 'utils/read-content'; -function FooterMenu({ path, home, id, isSurveyOnLine }) { +function FooterMenu({ path, home, id }) { const [isDesktop, setIsDesktop] = useState(window.innerWidth > 767); const updateFooterMenu = () => { if (window.innerWidth <= 767) { @@ -43,7 +44,7 @@ function FooterMenu({ path, home, id, isSurveyOnLine }) { {`Questions/réponses`} - {isSurveyOnLine && ( + {getIsSurveyOnlineById(id) && ( {`Contacter l'assistance`} diff --git a/src/components/template/menu.js b/src/components/template/menu.js index bdb8b5f..c09b1b6 100644 --- a/src/components/template/menu.js +++ b/src/components/template/menu.js @@ -6,9 +6,9 @@ import { Link } from 'react-router-dom'; import { urlInseeFr } from 'utils/properties'; import logoTwitter from 'img/common/logo-twitter.png'; import { getResultsMenuTitle, getSurveyDetailLink } from 'utils/read-content'; -import ReactLoading from 'react-loading'; +import { getIsSurveyOnlineById } from '../../utils/read-content'; -function Menu({ id, isSurveyOnLine }) { +function Menu({ id }) { const [isDesktop, setIsDesktop] = useState(window.innerWidth > 767); const updateFooterMenu = () => { if (window.innerWidth <= 767) { @@ -35,21 +35,16 @@ function Menu({ id, isSurveyOnLine }) {