Skip to content

Commit

Permalink
Merge branch 'release-1.0.31' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Dec 8, 2020
2 parents a35d2e9 + 24ba6ae commit e921666
Show file tree
Hide file tree
Showing 17 changed files with 112 additions and 46 deletions.
5 changes: 3 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
extends: ["eslint:recommended", "plugin:prettier/recommended"],
plugins: ["react", "prettier", "eslint-plugin-react"],
extends: ["eslint:recommended", "plugin:prettier/recommended", "plugin:react/recommended"],
plugins: ["react", "prettier"],
env: {
mocha: true,
es6: true,
Expand All @@ -14,6 +14,7 @@ module.exports = {
},
},
rules: {
"react/prop-types": 0,
"prettier/prettier": "error",
},
settings: {
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "food-oasis-client",
"description": "React Client for Food Oasis",
"version": "1.0.30",
"version": "1.0.31",
"author": "Hack for LA",
"license": "GPL-2.0",
"private": true,
Expand Down
17 changes: 0 additions & 17 deletions client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
<meta property="og:image" content="%PUBLIC_URL%/favicon.ico" />
<meta property="og:description" content="Food Oasis LA is a Hack for LA project that aims to provide verified information about free food resources, such as address, location, phone number, etc. to food seekers in the LA county area and to help them find resources near them by visualizing all of these organizations on one map. " />
<meta property="og:locale" content="en_US" />


<link rel="apple-touch-icon" href="%PUBLIC_URL%/favicon.ico" />
<link
href="https://api.tiles.mapbox.com/mapbox-gl-js/v1.4.0/mapbox-gl.css"
Expand All @@ -43,14 +41,6 @@
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PS74HS2');
</script>
<!-- End Google Tag Manager -->
<title>Food Oasis</title>
<style>
html,
Expand All @@ -63,13 +53,6 @@
</style>
</head>
<body id="body">
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-PS74HS2"
height="0" width="0" style="display:none;visibility:hidden">
</iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/ConfirmEmail.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ConfirmEmail = (props) => {
<React.Fragment>
<div>Confirm Email</div>
{!confirmResult ? (
<div>"Confirming Email..."</div>
<div>&ldquo;Confirming Email...&ldquo;</div>
) : confirmResult.success ? (
<Redirect to={"/login"} />
) : emailSent ? (
Expand Down
13 changes: 8 additions & 5 deletions client/src/components/MenuItemLink.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
import React, { useMemo, forwardRef } from "react";
import PropTypes from "prop-types";
import { makeStyles } from "@material-ui/styles";
import ListItem from "@material-ui/core/ListItem";
Expand All @@ -11,12 +11,13 @@ const useStyles = makeStyles({
},
});

export default function MenuItemLink({ to, text, userSection, onClick }) {
const MenuItemLink = ({ to, text, userSection, onClick }) => {
const classes = useStyles();

const renderLink = React.useMemo(
const renderLink = useMemo(
() =>
React.forwardRef((itemProps, ref) => (
// eslint-disable-next-line react/display-name
forwardRef((itemProps, ref) => (
<Link to={to} innerRef={ref} {...itemProps} />
)),
[to]
Expand All @@ -29,11 +30,13 @@ export default function MenuItemLink({ to, text, userSection, onClick }) {
</ListItem>
</span>
);
}
};

MenuItemLink.propTypes = {
to: PropTypes.string,
text: PropTypes.string.isRequired,
userSection: PropTypes.bool,
onClick: PropTypes.func,
};

export default MenuItemLink;
8 changes: 8 additions & 0 deletions client/src/components/Results/ResultsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ export default function ResultsContainer({

const doSelectStakeholder = useCallback(
(stakeholder) => {
if (stakeholder) {
window.dataLayer.push({
event: "viewDetail",
action: "click",
value: stakeholder.id,
name: stakeholder.name,
});
}
if (stakeholder && !isMobile) {
setViewport({
...viewport,
Expand Down
13 changes: 10 additions & 3 deletions client/src/components/Stakeholder/StakeholderDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,22 @@ const StakeholderDetails = ({
<div className={classes.buttons}>
<Button
variant="outlined"
onClick={() =>
onClick={() => {
window.dataLayer.push({
event: "getDirections",
action: "click",
value: selectedStakeholder.id,
name: selectedStakeholder.name,
});

window.open(
getGoogleMapsUrl(
selectedStakeholder.zip,
selectedStakeholder.address1,
selectedStakeholder.address2 || null
)
)
}
);
}}
>
Directions
</Button>
Expand Down
22 changes: 18 additions & 4 deletions client/src/components/Stakeholder/StakeholderPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,23 +213,37 @@ const StakeholderPreview = ({ stakeholder, doSelectStakeholder }) => {
<Button
variant="outlined"
size="small"
onClick={() =>
onClick={() => {
window.dataLayer.push({
event: "getDirections",
action: "click",
value: stakeholder.id,
name: stakeholder.name,
});
window.open(
getGoogleMapsUrl(
stakeholder.zip,
stakeholder.address1,
stakeholder.address2 || null
)
)
}
);
}}
>
Directions
</Button>
{mainNumber && (
<Button
variant="outlined"
size="small"
onClick={() => window.open(`tel:${mainNumber.value}`)}
onClick={() => {
window.dataLayer.push({
event: "dialPhone",
action: "click",
value: stakeholder.id,
name: stakeholder.name,
});
window.open(`tel:${mainNumber.value}`);
}}
>
Call
</Button>
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/StaticPages/Donate.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ const Donate = () => {
</div>
<section className={classes.cards}>
<aside className={classes.signup}>
<h3>Get monthly updates on what we're doing</h3>
<h3>Get monthly updates on what we&apos;re doing</h3>
<a
href="//foodoasis.us18.list-manage.com/subscribe?u=40d31892cbbe01312937f7de6&id=42235bb7ce"
target="_blank"
Expand Down
2 changes: 1 addition & 1 deletion client/src/components/StaticPagesCA/Donate.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ const Donate = () => {
</div>
<section className={classes.cards}>
<aside className={classes.signup}>
<h3>Get monthly updates on what we're doing</h3>
<h3>Get monthly updates on what we&apos;re doing</h3>
<a
href="//foodoasis.us18.list-manage.com/subscribe?u=40d31892cbbe01312937f7de6&id=42235bb7ce"
target="_blank"
Expand Down
12 changes: 6 additions & 6 deletions client/src/components/StaticPagesHI/Donate.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ const Donate = () => {
those costs.
</p>
<p>
Please make donations to our parent organization (Code for America).
At the Code for America donation page you will see a text box: “What
inspired you to donate today? Please write "Food Oasis and Code for
Hawaii" in that box. Your donation will get earmarked for Food Oasis
Hawaii.
Please make donations to our parent organization (Code for America)
At the Code for America donation page you will see a text box:
&quot;What inspired you to donate today&quot;? Please write
&quot;Food Oasis and Code for Hawaii&quot; in that box. Your
donation will get earmarked for Food Oasis Hawaii
</p>
<a
// href="//www.codeforamerica.org/donate"
Expand Down Expand Up @@ -211,7 +211,7 @@ const Donate = () => {
</div>
<section className={classes.cards}>
<aside className={classes.signup}>
<h3>Get monthly updates on what we're doing</h3>
<h3>Get monthly updates on what we&apos;`re doing</h3>
<a
href="//foodoasis.us18.list-manage.com/subscribe?u=40d31892cbbe01312937f7de6&id=42235bb7ce"
target="_blank"
Expand Down
5 changes: 4 additions & 1 deletion client/src/components/Verification/OrganizationEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ const OrganizationEdit = (props) => {
values.confirmedEmail &&
values.confirmedPhone &&
values.confirmedHours &&
values.confirmedFoodTypes &&
values.name &&
values.address1 &&
values.city &&
Expand Down Expand Up @@ -403,7 +404,9 @@ const OrganizationEdit = (props) => {
</ListItemText>
</ListItem>
</List>
<Typography>If you don't get through to them: (choose one)</Typography>
<Typography>
If you don&apos;t get through to them: (choose one)
</Typography>
<List dense>
<ListItem>
<ListItemText primary="1. The phone was inactive" />
Expand Down
6 changes: 6 additions & 0 deletions client/src/components/Verification/VerificationAdminGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,12 @@ const dataEntryColumns = [
formatter: confirmationFormatter,
width: 60,
},
{
key: "confirmedFoodTypes",
name: "FoodTypes",
formatter: confirmationFormatter,
width: 60,
},
{
key: "neighborhoodName",
name: "Neighborhood",
Expand Down
15 changes: 15 additions & 0 deletions client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,20 @@ import ReactDOM from "react-dom";
import "./i18n";
import "styles/root.css";
import App from "./App";
import TagManager from "react-gtm-module";

const tagManagerArgs = {
gtmId: "GTM-PS74HS2",
events: {
customEvent: "customEvent",
viewDetail: null,
getDirections: null,
dialPhone: null,
},
action: null,
value: null,
};

TagManager.initialize(tagManagerArgs);

ReactDOM.render(<App />, document.getElementById("root"));
20 changes: 20 additions & 0 deletions migrations/1607446572233_recalculate-complete-critiacal-percent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* eslint-disable camelcase */

exports.shorthands = undefined;

exports.up = (pgm) => {
pgm.sql(`
UPDATE stakeholder SET
complete_critical_percent = CASE WHEN (inactive OR inactive_temporary) THEN
(v_name::integer + v_categories::integer + v_address::integer) *100/3
ELSE
(v_name::integer + v_categories::integer + v_address::integer
+ v_email::integer + v_phone::integer + v_hours::integer
+ v_food_types::integer) *100/7
END
`);
};

exports.down = () => {
// not reversible
};
7 changes: 6 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "foodoasis",
"version": "1.0.30",
"version": "1.0.31",
"author": "Hack for LA",
"description": "Web API Server for Food Oasis",
"main": "server.js",
Expand All @@ -11,8 +11,8 @@
"server": "nodemon server.js",
"client": "npm run start --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\"",
"lint": "eslint -c .eslintrc.js --ignore-path .eslintignore **/*.{js,jsx}",
"lint:fix": "eslint -c .eslintrc.js --ignore-path .eslintignore --fix **/*.{js,jsx}",
"lint": "eslint -c .eslintrc.js --ignore-path .eslintignore \"**/*.{js,jsx}\"",
"lint:fix": "eslint -c .eslintrc.js --ignore-path .eslintignore --fix \"**/*.{js,jsx}\"",
"release-notes": "gren release",
"migrate": "node-pg-migrate -f db/config.js",
"loadtest:local": "loadtest -n 200 -c 20 \"http://localhost:3000/api/stakeholders?name=&categoryIds[]=1&categoryIds[]=9&latitude=34.0544&longitude=-118.2439&distance=5&isInactive=false\" ",
Expand Down Expand Up @@ -57,6 +57,7 @@
"passport-local": "^1.0.0",
"pg": "^8.0.3",
"pino-noir": "^2.2.1",
"react-gtm-module": "^2.0.11",
"uuid": "^3.3.3"
},
"devDependencies": {
Expand Down

0 comments on commit e921666

Please sign in to comment.