Skip to content

Commit 7a9f731

Browse files
committed
Merge branch 'release-1.0.50'
2 parents 27ef3fa + 420b9e6 commit 7a9f731

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+4152
-2123
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "foodoasis-client",
33
"description": "React Client for Food Oasis",
4-
"version": "1.0.49",
4+
"version": "1.0.50",
55
"author": "Hack for LA",
66
"license": "GPL-2.0",
77
"private": true,

client/src/App.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ import FaqPDX from "components/StaticPagesPDX/Faq";
3535
import DonateMCK from "components/StaticPagesMCK/Donate";
3636
import AboutMCK from "components/StaticPagesMCK/About";
3737
import FaqMCK from "components/StaticPagesMCK/Faq";
38+
import DonateSB from "components/StaticPagesSB/Donate";
39+
import AboutSB from "components/StaticPagesSB/About";
40+
import FaqSB from "components/StaticPagesSB/Faq";
41+
3842
import Resources from "components/Layout/Resources";
3943
import Register from "components/Account/Register";
4044
import Login from "components/Account/Login";
@@ -48,6 +52,7 @@ import Results from "components/FoodSeeker/ResultsContainer";
4852
import Suggestion from "components/FoodSeeker/Suggestion";
4953
import ImportFile from "components/Admin/ImportOrganizations/ImportFile";
5054
import adminTheme from "./theme/adminTheme";
55+
import * as analytics from "../src/services/analytics";
5156

5257
const useStyles = makeStyles({
5358
app: () => ({
@@ -104,6 +109,11 @@ function App() {
104109
setBgImg(backgroundImage);
105110
}, []);
106111

112+
useEffect(() => {
113+
const result = analytics.postEvent("visitAppComponent");
114+
console.error(result);
115+
}, []);
116+
107117
useEffect(() => {
108118
const storedJson = sessionStorage.getItem("user");
109119
const userJson = JSON.stringify(user);
@@ -112,7 +122,11 @@ function App() {
112122
} else if (userJson === storedJson) {
113123
return;
114124
} else {
115-
setUser(JSON.parse(storedJson));
125+
const user = JSON.parse(storedJson);
126+
if (user) {
127+
analytics.identify(user.id);
128+
}
129+
setUser(user);
116130
}
117131
}, [user]);
118132

@@ -292,7 +306,9 @@ function App() {
292306
<ResetPassword setToast={setToast} />
293307
</Route>
294308
<Route path="/donate">
295-
{tenantId === 5 ? (
309+
{tenantId === 6 ? (
310+
<DonateSB />
311+
) : tenantId === 5 ? (
296312
<DonateMCK />
297313
) : tenantId === 4 ? (
298314
<DonatePDX />
@@ -305,7 +321,9 @@ function App() {
305321
)}
306322
</Route>
307323
<Route path="/about">
308-
{tenantId === 5 ? (
324+
{tenantId === 6 ? (
325+
<AboutSB />
326+
) : tenantId === 5 ? (
309327
<AboutMCK />
310328
) : tenantId === 4 ? (
311329
<AboutPDX />
@@ -318,7 +336,9 @@ function App() {
318336
)}
319337
</Route>
320338
<Route exact path="/faqs">
321-
{tenantId === 5 ? (
339+
{tenantId === 6 ? (
340+
<FaqSB />
341+
) : tenantId === 5 ? (
322342
<FaqMCK />
323343
) : tenantId === 4 ? (
324344
<FaqPDX />

client/src/components/Account/Login.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
import { Formik } from "formik";
1616
import * as Yup from "yup";
1717
import * as accountService from "services/account-service";
18+
import * as analytics from "../../services/analytics";
1819

1920
import LockOutlinedIcon from "@material-ui/icons/LockOutlined";
2021

@@ -88,6 +89,7 @@ const LoginForm = (props) => {
8889
values.password
8990
);
9091
if (response.isSuccess) {
92+
analytics.identify(response.user.id);
9193
setUser(response.user);
9294
setToast({
9395
message: "Login successful.",

client/src/components/Admin/ImportOrganizations/ImportFile.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect } from "react";
1+
import React, { useState, useEffect, useCallback } from "react";
22
import { Route, withRouter } from "react-router-dom";
33
import PropTypes from "prop-types";
44
import { Typography } from "@material-ui/core";
@@ -100,6 +100,8 @@ const ImportFile = (props) => {
100100

101101
const handleCancel = () => setImportData(initialImportData);
102102

103+
const resetData = useCallback(() => setImportData(initialImportData), []);
104+
103105
useEffect(() => {
104106
if (importData.data) {
105107
history.push("/organizationimport/review");
@@ -137,6 +139,7 @@ const ImportFile = (props) => {
137139
handleImportAction={handleImportAction}
138140
handleImportDialog={handleImportDialog}
139141
handleCancel={handleCancel}
142+
resetData={resetData}
140143
/>
141144
)}
142145
/>

client/src/components/Admin/ImportOrganizations/ImportFileTable.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ const useStyles = makeStyles((theme) => ({
3939
}));
4040

4141
const ImportFileTable = (props) => {
42-
const { data, handleImportAction, handleCancel } = props;
42+
const { data, handleImportAction, handleCancel, resetData} = props;
4343
const classes = useStyles();
4444

4545
useEffect(() => {
4646
return () => {
47-
handleCancel();
48-
};
49-
}, []);
47+
resetData();
48+
}
49+
}, [resetData],);
5050

5151
return (
5252
<section className={classes.section}>

client/src/components/Admin/VerificationAdmin.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect, useCallback } from "react";
1+
import React, { useState, useEffect } from "react";
22
import PropTypes from "prop-types";
33
import { withRouter, Redirect } from "react-router-dom";
44
import { CssBaseline, Dialog, Typography } from "@material-ui/core";
@@ -149,12 +149,9 @@ function VerificationAdmin(props) {
149149
data: stakeholders,
150150
loading: stakeholdersLoading,
151151
error: stakeholdersError,
152-
search: stakeholderSearch,
152+
searchCallback,
153153
} = useOrganizations();
154154

155-
// eslint-disable-next-line react-hooks/exhaustive-deps
156-
const searchCallback = useCallback(stakeholderSearch, []);
157-
158155
useEffect(() => {
159156
const execute = async () => {
160157
const criteriaString = sessionStorage.getItem(CRITERIA_TOKEN);

client/src/components/Admin/VerificationDashboard.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState, useEffect, useCallback } from "react";
1+
import React, { useState, useEffect } from "react";
22
import { withRouter, Redirect } from "react-router-dom";
33
import { CssBaseline, Typography } from "@material-ui/core";
44
import { makeStyles } from "@material-ui/core/styles";
@@ -80,12 +80,9 @@ function VerificationDashboard(props) {
8080
data: stakeholders,
8181
loading: stakeholdersLoading,
8282
error: stakeholdersError,
83-
search: stakeholderSearch,
83+
searchCallback,
8484
} = useOrganizations();
8585

86-
// eslint-disable-next-line react-hooks/exhaustive-deps
87-
const searchCallback = useCallback(stakeholderSearch, []);
88-
8986
useEffect(() => {
9087
const execute = async () => {
9188
if (!user) return;

client/src/components/FoodSeeker/Home.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import { withRouter } from "react-router";
33
import CssBaseline from "@material-ui/core/CssBaseline";
44
import Typography from "@material-ui/core/Typography";
@@ -119,6 +119,10 @@ const Home = (props) => {
119119
const classes = useStyles();
120120
const { origin, setOrigin, userCoordinates, browserLocation } = props;
121121

122+
useEffect(() => {
123+
window.stormly("event", "visitLandingPage");
124+
}, []);
125+
122126
React.useEffect(() => {
123127
if (props.match.path === "/") {
124128
sessionStorage.clear();
@@ -164,6 +168,10 @@ const Home = (props) => {
164168
<Typography variant={"h5"} className={classes.label}>
165169
Locate free food in California
166170
</Typography>
171+
) : tenantId === 6 ? (
172+
<Typography variant={"h5"} className={classes.label}>
173+
Locate free food in Santa Barbara
174+
</Typography>
167175
) : (
168176
<Typography variant={"h5"} className={classes.label}>
169177
Locate free food in Los Angeles

client/src/components/FoodSeeker/ResultsContainer.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,6 @@ export default function ResultsContainer({
6565
const doSelectStakeholder = useCallback(
6666
(stakeholder) => {
6767
if (stakeholder) {
68-
// Tell analytics that stakeholder is selected
69-
window.dataLayer.push({
70-
event: "viewDetail",
71-
action: "click",
72-
value: stakeholder.id,
73-
name: stakeholder.name,
74-
});
7568
//Update url history
7669
const name = stakeholder.name.toLowerCase().replaceAll(" ", "_");
7770
history.push(`/organizations?org=${name}`);
@@ -83,6 +76,8 @@ export default function ResultsContainer({
8376
[history]
8477
);
8578

79+
// Need to get this working to navigate to a specific organization, which may
80+
// not be listed in the previously fetched data collection
8681
// useEffect(() => {
8782
// if (location.search.includes("?org=") && data) {
8883
// const org = location.search.replace("?org=", "").replaceAll("_", " ");

client/src/components/FoodSeeker/ResultsContainerOld.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useEffect, useState, useCallback } from "react";
22
import { makeStyles } from "@material-ui/core/styles";
33
import { Grid } from "@material-ui/core";
4-
import { useHistory, useLocation } from "react-router-dom";
4+
import { useHistory } from "react-router-dom";
55

66
import { useOrganizationBests } from "hooks/useOrganizationBests";
77
import useCategoryIds from "hooks/useCategoryIds";
@@ -36,7 +36,6 @@ export default function ResultsContainer({
3636
const [status, setStatus] = useState("initial"); // 'initial', 'loading', 'loaded'
3737
const classes = useStyles();
3838
const history = useHistory();
39-
const location = useLocation();
4039

4140
const [selectedStakeholder, onSelectStakeholder] = useState(null);
4241
const [isMapView, setIsMapView] = useState(true);
@@ -73,22 +72,22 @@ export default function ResultsContainer({
7372
[setInitViewport, history]
7473
);
7574

76-
useEffect(() => {
77-
if (location.search.includes("?org=") && data) {
78-
const org = location.search.replace("?org=", "").replaceAll("_", " ");
79-
const stakeholder = data.find((s) => s.name.toLowerCase() === org);
80-
if (stakeholder) {
81-
onSelectStakeholder(stakeholder);
82-
setInitViewport({
83-
latitude: stakeholder.latitude,
84-
longitude: stakeholder.longitude,
85-
zoom: 13,
86-
});
87-
} else {
88-
onSelectStakeholder(null);
89-
}
90-
}
91-
}, [data, location.search]);
75+
// useEffect(() => {
76+
// if (location.search.includes("?org=") && data) {
77+
// const org = location.search.replace("?org=", "").replaceAll("_", " ");
78+
// const stakeholder = data.find((s) => s.name.toLowerCase() === org);
79+
// if (stakeholder) {
80+
// onSelectStakeholder(stakeholder);
81+
// setViewport({
82+
// ...viewport,
83+
// latitude: stakeholder.latitude,
84+
// longitude: stakeholder.longitude,
85+
// });
86+
// } else {
87+
// onSelectStakeholder(null);
88+
// }
89+
// }
90+
// }, [data, location.search, viewport]);
9291

9392
const switchResultsView = () => {
9493
doSelectStakeholder();
@@ -196,6 +195,8 @@ export default function ResultsContainer({
196195
selectedStakeholder={selectedStakeholder}
197196
categoryIds={categoryIds}
198197
setToast={setToast}
198+
viewport={initViewport}
199+
setViewport={setInitViewport}
199200
initViewport={initViewport}
200201
/>
201202
)}

0 commit comments

Comments
 (0)