Skip to content

Commit

Permalink
Merge pull request #226 from code4romania/develop
Browse files Browse the repository at this point in the history
Deploy to prod
  • Loading branch information
catileptic authored May 25, 2020
2 parents 8abf709 + 89796ea commit d723abb
Show file tree
Hide file tree
Showing 13 changed files with 562 additions and 440 deletions.
831 changes: 477 additions & 354 deletions frontend/package-lock.json

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"description": "Arbore decizional pentru informarea publicului",
"private": true,
"dependencies": {
"@code4ro/taskforce-fe-components": "^1.0.27",
"@code4ro/taskforce-fe-components": "^1.0.28",
"bulma": "^0.8.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-ga": "^2.7.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.1",
"fuse.js": "^3.6.1",
"query-string": "^6.11.1"
"fuse.js": "^6.0.0",
"query-string": "^6.12.1"
},
"scripts": {
"start": "react-scripts start",
Expand Down Expand Up @@ -69,13 +69,13 @@
"url": "https://github.com/code4romania/ce-ma-fac/issues"
},
"devDependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-prettier": "^3.1.2",
"husky": "^4.2.3",
"node-sass": "^4.13.1",
"prettier": "^1.19.1"
"@testing-library/jest-dom": "^5.8.0",
"@testing-library/react": "^10.0.4",
"@testing-library/user-event": "^10.3.5",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.3",
"husky": "^4.2.5",
"node-sass": "^4.14.1",
"prettier": "^2.0.5"
}
}
8 changes: 4 additions & 4 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Link,
Route,
Switch,
useHistory
useHistory,
} from "react-router-dom";
import { logPageView } from "./analyticsTracker";
import Home from "./components/Home";
Expand All @@ -14,7 +14,7 @@ import {
Header,
DevelopedBy,
IncubatedBy,
BackToTop
BackToTop,
} from "@code4ro/taskforce-fe-components";
import LogoSvg from "./images/logo.svg";
import gov from "./images/gov.png";
Expand All @@ -34,7 +34,7 @@ const customPartnerLogos = [
</Logo>,
<Logo url="http://www.dsu.mai.gov.ro" key="dsu">
<img src={DSU} alt="Departamentul pentru Situații de Urgență" />
</Logo>
</Logo>,
];

const MenuItems = [
Expand All @@ -56,7 +56,7 @@ const MenuItems = [
</a>,
<Link to="/despre" key={"des"}>
Despre
</Link>
</Link>,
];

const AppWrapper = () => {
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/analyticsTracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const initializeGA = () => {
ReactGA.initialize("UA-160603540-1");
};

export const logPageView = history => {
history.listen(location => {
export const logPageView = (history) => {
history.listen((location) => {
const page = location.pathname || window.location.pathname;
ReactGA.set({ page: page });
ReactGA.pageview(page);
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/About/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
Hero,
Instruments,
SocialsShare,
MailchimpSubscribe
MailchimpSubscribe,
} from "@code4ro/taskforce-fe-components";
import UsefulApps from "../../data/useful-apps";
import "./About.scss";
import {
renderInstrumentItem,
remapInstrumentsData
remapInstrumentsData,
} from "../../utils/instruments.utils";
import { mailchimpURL } from "../../config/mailchimp";

Expand Down Expand Up @@ -113,19 +113,19 @@ const About = () => {
<Hero title={"Instrumente utile"} useFallbackIcon={true} />

<Instruments layout="grid">
{instrumentsData.info.map(usefulApp =>
{instrumentsData.info.map((usefulApp) =>
renderInstrumentItem(usefulApp)
)}
{instrumentsData.news.map(usefulApp =>
{instrumentsData.news.map((usefulApp) =>
renderInstrumentItem(usefulApp)
)}
{instrumentsData.offer_help.map(usefulApp =>
{instrumentsData.offer_help.map((usefulApp) =>
renderInstrumentItem(usefulApp)
)}
{instrumentsData.data.map(usefulApp =>
{instrumentsData.data.map((usefulApp) =>
renderInstrumentItem(usefulApp)
)}
{instrumentsData.diaspora.map(usefulApp =>
{instrumentsData.diaspora.map((usefulApp) =>
renderInstrumentItem(usefulApp)
)}
</Instruments>
Expand Down
20 changes: 10 additions & 10 deletions frontend/src/components/ContentPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { List, ListItem } from "@code4ro/taskforce-fe-components";
import {
Hero,
Accordion,
SocialsShare
SocialsShare,
} from "@code4ro/taskforce-fe-components";

import { navigate } from "../../utils/instruments.utils";
Expand All @@ -33,8 +33,8 @@ function ContentPage({ page, subPage }) {
return;
}
const items = page.content
.filter(item => item.slug !== subPage.slug)
.map(item => (
.filter((item) => item.slug !== subPage.slug)
.map((item) => (
<ListItem
key={item.display_order}
title={item.title}
Expand Down Expand Up @@ -84,7 +84,7 @@ ContentPage.propTypes = {
PropTypes.shape({
title: PropTypes.string.isRequired,
page: PropTypes.string.isRequired,
slug: PropTypes.string
slug: PropTypes.string,
})
),
first_node_id: PropTypes.number,
Expand All @@ -96,23 +96,23 @@ ContentPage.propTypes = {
options: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
value: PropTypes.number.isRequired,
})
)
),
})
),
accordion: PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string.isRequired,
content: PropTypes.string.isRequired
content: PropTypes.string.isRequired,
})
)
),
}),
subPage: PropTypes.shape({
title: PropTypes.string.isRequired,
page: PropTypes.string.isRequired,
slug: PropTypes.string
})
slug: PropTypes.string,
}),
};

export default ContentPage;
2 changes: 1 addition & 1 deletion frontend/src/components/Footer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
Footer,
FooterLinkHeader,
FooterLinks,
FooterLinkItem
FooterLinkItem,
} from "@code4ro/taskforce-fe-components";

const FooterWrapper = () => {
Expand Down
14 changes: 7 additions & 7 deletions frontend/src/components/Form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ function Form({ data }) {
init();
}, [data.form]); // eslint-disable-line

const answerCurrentQuestion = answer => {
const answerCurrentQuestion = (answer) => {
setFormState({
...formState,
[answer.questionId]: answer.value
[answer.questionId]: answer.value,
});
};

Expand Down Expand Up @@ -102,7 +102,7 @@ Form.propTypes = {
content: PropTypes.arrayOf(
PropTypes.shape({
title: PropTypes.string.isRequired,
page: PropTypes.string.isRequired
page: PropTypes.string.isRequired,
})
),
firstNodeId: PropTypes.number.isRequired,
Expand All @@ -114,12 +114,12 @@ Form.propTypes = {
options: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
value: PropTypes.number.isRequired,
})
)
),
})
)
})
),
}),
};

export default Form;
16 changes: 8 additions & 8 deletions frontend/src/components/Form/multipleChoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ import { ListHeader, List, ListItem } from "@code4ro/taskforce-fe-components";

function MultipleChoice({ question, onAnswer, currentResponse = [] }) {
const [answers, setAnswers] = useState([]);
const isSelected = option => {
const isSelected = (option) => {
return currentResponse.includes(option.value);
};

const handleClick = option => {
const handleClick = (option) => {
let newAnswers;
if (answers.includes(option.value)) {
newAnswers = answers.filter(item => item !== option.value);
newAnswers = answers.filter((item) => item !== option.value);
} else {
newAnswers = [...answers, option.value];
}
setAnswers(newAnswers);
onAnswer({
questionId: question.questionId,
value: newAnswers
value: newAnswers,
});
};

Expand All @@ -28,7 +28,7 @@ function MultipleChoice({ question, onAnswer, currentResponse = [] }) {
<ListHeader title={question.questionText} />
<div>
<List>
{question.options.map(option => (
{question.options.map((option) => (
<ListItem
key={`answer_${question.questionId}_${option.value}`}
title={option.label}
Expand All @@ -50,12 +50,12 @@ MultipleChoice.propTypes = {
options: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
value: PropTypes.number.isRequired,
})
)
),
}),
onAnswer: PropTypes.func,
currentResponse: PropTypes.arrayOf(PropTypes.number)
currentResponse: PropTypes.arrayOf(PropTypes.number),
};

export default MultipleChoice;
12 changes: 6 additions & 6 deletions frontend/src/components/Form/singleChoice.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "./Form.scss";
import { ListHeader, List, ListItem } from "@code4ro/taskforce-fe-components";

function SingleChoice({ question, onAnswer, currentResponse }) {
const isSelected = option => {
const isSelected = (option) => {
return currentResponse === option.value;
};

Expand All @@ -13,15 +13,15 @@ function SingleChoice({ question, onAnswer, currentResponse }) {
<ListHeader title={question.questionText} />
<div>
<List>
{question.options.map(option => (
{question.options.map((option) => (
<ListItem
key={`answer_${question.questionId}_${option.value}`}
title={option.label}
active={isSelected(option)}
onClick={() =>
onAnswer({
questionId: question.questionId,
value: option.value
value: option.value,
})
}
/>
Expand All @@ -40,12 +40,12 @@ SingleChoice.propTypes = {
options: PropTypes.arrayOf(
PropTypes.shape({
label: PropTypes.string.isRequired,
value: PropTypes.number.isRequired
value: PropTypes.number.isRequired,
})
)
),
}),
onAnswer: PropTypes.func,
currentResponse: PropTypes.number
currentResponse: PropTypes.number,
};

export default SingleChoice;
Loading

0 comments on commit d723abb

Please sign in to comment.