From ff35a1637fe6ed94ec672eb936e1d83889918ba1 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 13 Oct 2020 22:06:02 -0500 Subject: [PATCH 1/6] stakeholder buttons - update materialUI theme - change stakeholder action buttons to outlines --- client/src/components/Buttons.js | 7 +-- .../Stakeholder/StakeholderDetails.js | 19 +++--- .../Stakeholder/StakeholderPreview.js | 24 ++++--- client/src/theme/materialUI.js | 63 ++++++++++--------- 4 files changed, 58 insertions(+), 55 deletions(-) diff --git a/client/src/components/Buttons.js b/client/src/components/Buttons.js index 9ec0212e6..417513123 100644 --- a/client/src/components/Buttons.js +++ b/client/src/components/Buttons.js @@ -86,12 +86,7 @@ const DeleteButton = (props) => { const DeleteIconButton = (props) => { return ( - + ); diff --git a/client/src/components/Stakeholder/StakeholderDetails.js b/client/src/components/Stakeholder/StakeholderDetails.js index 3e9d863a5..4683f2662 100644 --- a/client/src/components/Stakeholder/StakeholderDetails.js +++ b/client/src/components/Stakeholder/StakeholderDetails.js @@ -1,5 +1,6 @@ import React, { useState } from "react"; import { makeStyles } from "@material-ui/core/styles"; +import { Button } from "@material-ui/core"; import mapMarker from "images/mapMarker"; import fbIcon from "images/fbIcon.png"; @@ -14,7 +15,6 @@ import { extractNumbers, getGoogleMapsUrl } from "helpers"; import Icon from "components/Icon"; import SuggestionDialog from "components/SuggestionDialog"; -import { PlainButton } from "components/Buttons"; const useStyles = makeStyles((theme, props) => ({ stakeholder: { @@ -87,6 +87,7 @@ const useStyles = makeStyles((theme, props) => ({ left: "1em", alignSelf: "flex-start", margin: "1em 0 0 0", + cursor: "pointer", }, label: { width: "100%", @@ -105,6 +106,7 @@ const useStyles = makeStyles((theme, props) => ({ display: "flex", flexDirection: "row", justifyContent: "space-between", + marginTop: "10px", }, numbers: { display: "inline", @@ -284,9 +286,8 @@ const StakeholderDetails = ({

) : null}
- window.open( getGoogleMapsUrl( @@ -296,14 +297,12 @@ const StakeholderDetails = ({ ) ) } - /> - + Directions + +
{selectedStakeholder.hours ? ( <> diff --git a/client/src/components/Stakeholder/StakeholderPreview.js b/client/src/components/Stakeholder/StakeholderPreview.js index 9565bd4af..4f83763d2 100644 --- a/client/src/components/Stakeholder/StakeholderPreview.js +++ b/client/src/components/Stakeholder/StakeholderPreview.js @@ -2,6 +2,7 @@ import React from "react"; import PropTypes from "prop-types"; import moment from "moment"; import { makeStyles } from "@material-ui/core/styles"; +import { Button } from "@material-ui/core"; import { MEAL_PROGRAM_CATEGORY_ID, @@ -11,7 +12,6 @@ import { ORGANIZATION_COLORS, CLOSED_COLOR } from "constants/map"; import { getGoogleMapsUrl, extractNumbers } from "helpers"; import Icon from "components/Icon"; -import { PlainButton } from "components/Buttons"; const useStyles = makeStyles(() => ({ stakeholder: { @@ -208,8 +208,9 @@ const StakeholderPreview = ({ stakeholder, doSelectStakeholder }) => { ) : null}
- window.open( getGoogleMapsUrl( @@ -219,16 +220,21 @@ const StakeholderPreview = ({ stakeholder, doSelectStakeholder }) => { ) ) } - size="small" - /> + > + Directions + {mainNumber && ( - window.open(`tel:${mainNumber.value}`)} - /> + > + Call + )} - +
diff --git a/client/src/theme/materialUI.js b/client/src/theme/materialUI.js index fa211d1ab..f544a0026 100644 --- a/client/src/theme/materialUI.js +++ b/client/src/theme/materialUI.js @@ -3,18 +3,19 @@ import { createMuiTheme } from "@material-ui/core/styles"; const theme = createMuiTheme({ palette: { primary: { - // purple - // main: "#772f7a", + // blue + light: "#1976d2", main: "#336699", contrastText: "#ffffff", }, secondary: { // orange - main: "rgb(249, 192, 88)", + main: "#f9c058", contrastText: "#000000", }, error: { - main: "rgb(249, 64, 64)", + // red + main: "#f94040", contrastText: "#000000", }, text: { @@ -24,38 +25,40 @@ const theme = createMuiTheme({ typography: { fontFamily: '"Helvetica Neue", Helvetica, sans-serif;', }, - overrides: { - MuiButton: { - outlined: { - margin: "10px", - border: "2px solid #772f7a", - color: "#772f7a", - "&:hover": { - color: "hsl(298, 44%, 96%)", - backgroundColor: "#772f7a", - }, +}); + +const { primary } = theme.palette; + +theme.overrides = { + MuiButton: { + outlined: { + border: `2px solid ${primary.main}`, + color: primary.main, + "&:hover": { + color: primary.contrastText, + backgroundColor: primary.main, }, }, - MuiLink: { - root: { - color: "#1976d2", - "&:visited": { - color: "#772f7a", - }, - }, - underlineHover: { - textDecoration: "none", - "&:hover": { - textDecoration: "underline", - }, + }, + MuiLink: { + root: { + color: primary.light, + "&:visited": { + color: primary.main, }, }, - MuiAppBar: { - root: { - backgroundColor: "rgb(241, 241, 241)", + underlineHover: { + textDecoration: "none", + "&:hover": { + textDecoration: "underline", }, }, }, -}); + MuiAppBar: { + root: { + backgroundColor: "#f1f1f1", + }, + }, +}; export default theme; From 94c230a950fee10d391d53f09ba6165aefe000fe Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 13 Oct 2020 23:01:45 -0500 Subject: [PATCH 2/6] filter bar improvements - remove unused classes - remove unused button title - clean up map icon color, filter buttons and radius button to be more consistent --- .../components/Results/ResultsContainer.js | 10 -- .../src/components/Results/ResultsFilters.js | 155 +++++------------- client/src/components/Results/ResultsMap.js | 6 - .../Stakeholder/StakeholderDetails.js | 8 - client/src/components/SwitchViewsButton.js | 10 +- client/src/theme/materialUI.js | 1 + 6 files changed, 45 insertions(+), 145 deletions(-) diff --git a/client/src/components/Results/ResultsContainer.js b/client/src/components/Results/ResultsContainer.js index 0351dadeb..204fe4d56 100644 --- a/client/src/components/Results/ResultsContainer.js +++ b/client/src/components/Results/ResultsContainer.js @@ -12,16 +12,6 @@ import List from "./ResultsList"; import Map from "./ResultsMap"; const useStyles = makeStyles((theme) => ({ - filterButton: { - margin: "0 .25rem", - padding: "0 0.5rem", - fontSize: "12px", - }, - div: { - textAlign: "center", - fontSize: "12px", - border: "1px solid blue", - }, listMapContainer: { [theme.breakpoints.down("sm")]: { height: "100%", diff --git a/client/src/components/Results/ResultsFilters.js b/client/src/components/Results/ResultsFilters.js index 30a446cf9..d006a9830 100644 --- a/client/src/components/Results/ResultsFilters.js +++ b/client/src/components/Results/ResultsFilters.js @@ -1,14 +1,7 @@ import React, { useCallback, useEffect } from "react"; import PropTypes from "prop-types"; import { makeStyles } from "@material-ui/core/styles"; -import { - Grid, - Select, - MenuItem, - FormControl, - Button, - Box, -} from "@material-ui/core"; +import { Grid, Select, MenuItem, Button, Box } from "@material-ui/core"; import SearchIcon from "@material-ui/icons/Search"; import { @@ -18,76 +11,23 @@ import { } from "constants/stakeholder"; import { isMobile } from "helpers"; +import theme from "theme/materialUI"; import SwitchViewsButton from "components/SwitchViewsButton"; import Search from "components/Search"; const useStyles = makeStyles((theme) => ({ - filterGroup: { - margin: 0, - padding: 0, - }, - filterGroupButton: { - margin: 0, - padding: ".5rem", - fontSize: "max(.8vw,12px)", - whiteSpace: "nowrap", - backgroundColor: "#fff", - border: ".1em solid #000", - color: "#000", - [theme.breakpoints.down("xs")]: { - padding: ".1rem .1rem", - margin: "0", - fontSize: "max(.8vw,11px)", - }, - }, - filterButton: { - margin: 0, - padding: ".5rem", - fontSize: "max(.8vw,12px)", - whiteSpace: "nowrap", - backgroundColor: "#fff", - border: ".1em solid #000", - color: "#000", - [theme.breakpoints.down("xs")]: { - padding: ".6rem .6rem", - margin: ".3rem", - fontSize: "max(.8vw,12px)", - borderRadius: "5px !important", - }, - }, - distanceControl: { - margin: ".3rem", - backgroundColor: "#fff", - // padding: "auto 0 auto .7em", - padding: ".3rem", - border: ".1em solid #000", - outline: "none", - [theme.breakpoints.down("xs")]: { - padding: ".4rem", - margin: ".3rem", - }, + select: { + color: "white", }, menuItems: { fontSize: "max(.8vw,12px)", color: "#000", }, controlPanel: { - backgroundColor: "#336699", + backgroundColor: theme.palette.primary.main, padding: "1rem 0", flex: "1 0 auto", }, - inputHolder: { - display: "flex", - justifyContent: "flex-start", - alignItems: "center", - }, - input: { - fontSize: "12px", - width: "25em", - height: "2em", - outline: "none", - padding: ".25em", - }, inputContainer: { display: "flex", alignItems: "center", @@ -120,7 +60,7 @@ const useStyles = makeStyles((theme) => ({ buttonHolder: { display: "flex", [theme.breakpoints.down("xs")]: { - marginTop: "1rem", + marginTop: "0.5rem", }, }, })); @@ -146,7 +86,6 @@ const ResultsFilters = ({ switchResultsView, }) => { const classes = useStyles(); - const isMealsSelected = categoryIds.indexOf(MEAL_PROGRAM_CATEGORY_ID) >= 0; const isPantrySelected = categoryIds.indexOf(FOOD_PANTRY_CATEGORY_ID) >= 0; @@ -243,43 +182,42 @@ const ResultsFilters = ({ className={classes.buttonHolder} > - + ))} + */} ({ display: "inherit", justifyContent: "inherit", }, - img: { - display: "inherit", - justifyContent: "center", - alignItems: "center", - }, - typeLogo: { - width: "72px", - }, info: { fontSize: "1.1em", textAlign: "left", diff --git a/client/src/components/SwitchViewsButton.js b/client/src/components/SwitchViewsButton.js index eeeff9a87..623e6378b 100644 --- a/client/src/components/SwitchViewsButton.js +++ b/client/src/components/SwitchViewsButton.js @@ -9,21 +9,17 @@ export default function SwitchViewsButton({ color = "primary", }) { return ( - diff --git a/client/src/theme/materialUI.js b/client/src/theme/materialUI.js index f544a0026..2b40bc434 100644 --- a/client/src/theme/materialUI.js +++ b/client/src/theme/materialUI.js @@ -6,6 +6,7 @@ const theme = createMuiTheme({ // blue light: "#1976d2", main: "#336699", + dark: "#0A3865", contrastText: "#ffffff", }, secondary: { From 526d2c292c1d744a0f8a47f1787094e71c0d83e9 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Tue, 13 Oct 2020 23:19:08 -0500 Subject: [PATCH 3/6] small app header on mobile - change app header from 60px tall to 45px on xs screen sizes --- client/src/components/Header.js | 12 +++++++++--- client/src/components/Menu.js | 9 +++++---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/client/src/components/Header.js b/client/src/components/Header.js index c7a8ee82e..5b3a56e16 100644 --- a/client/src/components/Header.js +++ b/client/src/components/Header.js @@ -15,7 +15,7 @@ Header.propTypes = { setToast: PropTypes.func, }; -const useStyles = makeStyles({ +const useStyles = makeStyles((theme) => ({ headerHolder: { backgroundColor: (props) => props.headerColor, marginBottom: (props) => props.headerMargin, @@ -24,6 +24,10 @@ const useStyles = makeStyles({ header: { minHeight: "60px", padding: "0 1.5em 0 0", + [theme.breakpoints.down("xs")]: { + padding: "0 0.5em 0 0", + minHeight: "45px", + }, }, content: { display: "flex", @@ -35,10 +39,12 @@ const useStyles = makeStyles({ width: "90px", height: "60px", margin: "0 .5rem", - "&:hover": { filter: "brightness(1.2)", }, + [theme.breakpoints.down("xs")]: { + height: "45px", + }, }, tagline: { color: "#1b1b1b", @@ -47,7 +53,7 @@ const useStyles = makeStyles({ lineHeight: "1.5", fontFamily: `"HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans- serif`, }, -}); +})); export default function Header(props) { const { user, setUser, setToast } = props; diff --git a/client/src/components/Menu.js b/client/src/components/Menu.js index bc5b69f70..59335f8f4 100644 --- a/client/src/components/Menu.js +++ b/client/src/components/Menu.js @@ -26,23 +26,24 @@ Menu.propTypes = { setToast: PropTypes.func, }; -const useStyles = makeStyles({ +const useStyles = makeStyles((theme) => ({ list: { width: 250, }, menuButton: { transform: "scale(1.6,1.5)", - backgroundColor: "#FFF", - padding: "0.5rem", minWidth: "0", "&:hover": { backgroundColor: "#FFF", }, + [theme.breakpoints.down("xs")]: { + transform: "scale(1.2, 1.2)", + }, }, blueMenu: { fill: "#19334D", }, -}); +})); export default function Menu(props) { const isHomePage = useLocationHook(); From 4e987b878789915e78c536abe1c532f9161417d4 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Wed, 14 Oct 2020 10:47:23 -0500 Subject: [PATCH 4/6] distinct filter buttons - separate meal and pantry buttons --- client/src/components/Results/ResultsFilters.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/client/src/components/Results/ResultsFilters.js b/client/src/components/Results/ResultsFilters.js index d006a9830..ba921373a 100644 --- a/client/src/components/Results/ResultsFilters.js +++ b/client/src/components/Results/ResultsFilters.js @@ -216,8 +216,6 @@ const ResultsFilters = ({ ? theme.palette.primary.dark : "#fff", color: isPantrySelected ? "#fff" : "#000", - borderTopRightRadius: 0, - borderBottomRightRadius: 0, }} onClick={togglePantry} > @@ -247,8 +245,7 @@ const ResultsFilters = ({ ? theme.palette.primary.dark : "#fff", color: isMealsSelected ? "#fff" : "#000", - borderTopLeftRadius: 0, - borderBottomLeftRadius: 0, + marginLeft: "5px", }} onClick={toggleMeal} > From fee6588503d033456b39e6cc03b186853e29a98f Mon Sep 17 00:00:00 2001 From: John Darragh Date: Wed, 14 Oct 2020 08:50:16 -0700 Subject: [PATCH 5/6] Fix HI tenant prob, issue 689, 708 --- app/services/EmailTemplate.js | 4 +++- client/src/App.js | 12 +++++------- client/src/components/Footer.js | 4 ++-- client/src/components/Header.js | 6 +++--- client/src/components/Results/ResultsContainer.js | 6 +++--- client/src/components/Search.js | 2 +- .../src/components/Verification/SearchCriteria.js | 8 +++----- client/src/containers/Home/index.js | 14 +++++--------- client/src/helpers/Configuration.js | 8 ++++---- client/src/hooks/useMapboxGeocoder.js | 6 +++--- client/src/services/stakeholder-best-service.js | 4 ++-- client/src/services/stakeholder-service.js | 4 ++-- 12 files changed, 36 insertions(+), 42 deletions(-) diff --git a/app/services/EmailTemplate.js b/app/services/EmailTemplate.js index 5beb50b65..42c1178f7 100644 --- a/app/services/EmailTemplate.js +++ b/app/services/EmailTemplate.js @@ -24,7 +24,9 @@ module.exports = function applyEmailTemplate(emailBody, baseUrl) { Food Oasis Logo -

Your free food directory

+

+ Your free food directory +

diff --git a/client/src/App.js b/client/src/App.js index 2468a43eb..7b0e7543d 100644 --- a/client/src/App.js +++ b/client/src/App.js @@ -4,7 +4,7 @@ import { makeStyles, ThemeProvider } from "@material-ui/core/styles"; import { Grid } from "@material-ui/core"; import theme from "theme/materialUI"; import { logout } from "services/account-service"; -import { getTenantId } from "helpers/Configuration"; +import { tenantId, originCoordinates } from "helpers/Configuration"; // Components import { UserContext } from "components/user-context"; @@ -35,7 +35,6 @@ import Home from "containers/Home"; import Results from "components/Results/ResultsContainer"; import Suggestion from "components/Suggestion"; import newTheme from "./theme/newTheme"; -import { defaultCoordinates } from "./helpers/Configuration"; const useStyles = makeStyles({ app: (props) => ({ @@ -71,14 +70,13 @@ const useStyles = makeStyles({ }); function App() { - const tenantId = getTenantId(); const [user, setUser] = useState(null); const [userCoordinates, setUserCoordinates] = useState({}); const [toast, setToast] = useState({ message: "" }); const [bgImg, setBgImg] = useState(""); const [origin, setOrigin] = useState({ - latitude: defaultCoordinates.lat, - longitude: defaultCoordinates.lon, + latitude: originCoordinates.lat, + longitude: originCoordinates.lon, }); useEffect(() => { @@ -129,8 +127,8 @@ function App() { (error) => { console.log(`Getting browser location failed: ${error.message}`); const userCoordinates = { - latitude: defaultCoordinates.lat, - longitude: defaultCoordinates.lon, + latitude: originCoordinates.lat, + longitude: originCoordinates.lon, }; setUserCoordinates(userCoordinates); } diff --git a/client/src/components/Footer.js b/client/src/components/Footer.js index ede878060..f55f209ad 100644 --- a/client/src/components/Footer.js +++ b/client/src/components/Footer.js @@ -7,7 +7,7 @@ import { Link } from "react-router-dom"; // The two tenant logos happen to be the same at this moment import logo from "images/foodoasis.svg"; import logoCA from "images/foodoasis.svg"; -import { getTenantId } from "../helpers/Configuration"; +import { tenantId } from "../helpers/Configuration"; const useStyles = makeStyles((theme) => ({ footer: { @@ -100,7 +100,7 @@ const Footer = () => { return ( - {getTenantId() === 2 ? ( + {tenantId === 2 ? ( logo ) : ( logo diff --git a/client/src/components/Header.js b/client/src/components/Header.js index c7a8ee82e..e89e88d9d 100644 --- a/client/src/components/Header.js +++ b/client/src/components/Header.js @@ -7,7 +7,7 @@ import logo from "images/foodoasis.svg"; import logoCA from "images/foodoasis.svg"; import { AppBar, Toolbar, Typography } from "@material-ui/core"; import { makeStyles } from "@material-ui/core/styles"; -import { getTenantId } from "../helpers/Configuration"; +import { tenantId } from "../helpers/Configuration"; Header.propTypes = { user: PropTypes.object, @@ -66,7 +66,7 @@ export default function Header(props) { const styles = isHomePage ? homePageStyles : defaultStyles; const classes = useStyles(styles); - const taglineText = isHomePage ? "" : "Your free food directory"; + const taglineText = ""; // isHomePage ? "" : "Your free food directory"; return ( <> @@ -74,7 +74,7 @@ export default function Header(props) {
{!isHomePage && - (getTenantId() === 1 ? ( + (tenantId === 1 ? (
logo{" "} diff --git a/client/src/components/Results/ResultsContainer.js b/client/src/components/Results/ResultsContainer.js index 0351dadeb..dc945e4fc 100644 --- a/client/src/components/Results/ResultsContainer.js +++ b/client/src/components/Results/ResultsContainer.js @@ -5,7 +5,7 @@ import { Grid } from "@material-ui/core"; import { useOrganizationBests } from "hooks/useOrganizationBests"; import useCategoryIds from "hooks/useCategoryIds"; import { isMobile } from "helpers"; -import { defaultCoordinates } from "../../helpers/Configuration"; +import { originCoordinates } from "../../helpers/Configuration"; import Filters from "./ResultsFilters"; import List from "./ResultsList"; @@ -79,14 +79,14 @@ export default function ResultsContainer(props) { ? JSON.parse(storage.origin).latitude : userCoordinates ? userCoordinates.latitude - : defaultCoordinates.lat, + : originCoordinates.lat, longitude: userSearch ? userSearch.longitude : storage.origin ? JSON.parse(storage.origin).longitude : userCoordinates ? userCoordinates.longitude - : defaultCoordinates.lon, + : originCoordinates.lon, }; const [radius, setRadius] = useState( diff --git a/client/src/components/Search.js b/client/src/components/Search.js index a4137060f..be3422b94 100644 --- a/client/src/components/Search.js +++ b/client/src/components/Search.js @@ -109,7 +109,7 @@ export default function Search({ userCoordinates, setOrigin, origin }) { variant="outlined" margin="none" fullWidth - placeholder="Search by address, neighborhood, or zip code" + placeholder="Search by address or zip code" name="address" size="small" autoFocus={false} diff --git a/client/src/components/Verification/SearchCriteria.js b/client/src/components/Verification/SearchCriteria.js index 074ec7f77..92a0e945a 100644 --- a/client/src/components/Verification/SearchCriteria.js +++ b/client/src/components/Verification/SearchCriteria.js @@ -20,7 +20,7 @@ import { import RadioTrueFalseEither from "../RadioTrueFalseEither"; import LocationAutocomplete from "../LocationAutocomplete"; import AccountAutocomplete from "../AccountAutocomplete"; -import { defaultCoordinates } from "../../helpers/Configuration"; +import { originCoordinates } from "../../helpers/Configuration"; const useStyles = makeStyles((theme) => ({ card: { @@ -58,10 +58,8 @@ const SearchCriteria = ({ : "custom" ); - const [customLatitude, setCustomLatitude] = useState(defaultCoordinates.lat); - const [customLongitude, setCustomLongitude] = useState( - defaultCoordinates.LocationAutocomplete - ); + const [customLatitude, setCustomLatitude] = useState(originCoordinates.lat); + const [customLongitude, setCustomLongitude] = useState(originCoordinates.lon); const [customPlaceName, setCustomPlaceName] = useState(""); useEffect(() => { diff --git a/client/src/containers/Home/index.js b/client/src/containers/Home/index.js index b56d901e3..1c5fbfade 100644 --- a/client/src/containers/Home/index.js +++ b/client/src/containers/Home/index.js @@ -13,7 +13,7 @@ import Search from "components/Search"; import logo from "images/foodoasis.svg"; import logoCA from "images/foodoasis.svg"; import logoHI from "images/foodoasis.svg"; -import { getTenantId } from "helpers/Configuration"; +import { tenantId } from "helpers/Configuration"; const useStyles = makeStyles((theme) => ({ container: { @@ -134,28 +134,24 @@ const Home = (props) => { - {getTenantId() === 3 ? ( + {tenantId === 3 ? ( logo - ) : getTenantId() === 2 ? ( + ) : tenantId === 2 ? ( logo ) : ( logo )} - - - Your free food directory -
props.history.push("/organizations")} > - {getTenantId() === 3 ? ( + {tenantId === 3 ? ( Locate free food resources in Hawaii - ) : getTenantId() === 2 ? ( + ) : tenantId === 2 ? ( Locate free food resources in California diff --git a/client/src/helpers/Configuration.js b/client/src/helpers/Configuration.js index 83494b536..ff1aa93b6 100644 --- a/client/src/helpers/Configuration.js +++ b/client/src/helpers/Configuration.js @@ -1,4 +1,4 @@ -export const getTenantId = () => +export const tenantId = (() => window.location.hostname.toLowerCase().includes("hi.food") || window.location.hostname.toLowerCase().includes("hawaii") || process.env.REACT_APP_TENANT_ID === "3" @@ -7,10 +7,10 @@ export const getTenantId = () => window.location.hostname.toLowerCase().includes("california") || process.env.REACT_APP_TENANT_ID === "2" ? 2 - : 1; + : 1)(); -export const defaultCoordinates = (() => { - switch (getTenantId()) { +export const originCoordinates = (() => { + switch (tenantId) { case 3: return { lat: 21.33629, lon: -157.89435 }; case 2: diff --git a/client/src/hooks/useMapboxGeocoder.js b/client/src/hooks/useMapboxGeocoder.js index f80b72665..e7e7a0bc3 100644 --- a/client/src/hooks/useMapboxGeocoder.js +++ b/client/src/hooks/useMapboxGeocoder.js @@ -1,7 +1,7 @@ import React from "react"; import axios from "axios"; import debounce from "debounce-fn"; -import { getTenantId } from "helpers/Configuration"; +import { tenantId } from "helpers/Configuration"; const baseUrl = `https://api.mapbox.com/geocoding/v5/mapbox.places`; @@ -49,9 +49,9 @@ export function useMapboxGeocoder() { const fetchMapboxResults = debounce( async (searchString) => { const bbox = - getTenantId() === 1 + tenantId === 1 ? losAngelesCountyLatLong - : getTenantId() === 2 + : tenantId === 2 ? californiaLatLong : hawaiiLatLong; const mapboxUrl = `${baseUrl}/${searchString}.json?bbox=${bbox}&access_token=${process.env.REACT_APP_MAPBOX_TOKEN}`; diff --git a/client/src/services/stakeholder-best-service.js b/client/src/services/stakeholder-best-service.js index 85a7d590a..a6ad373ac 100644 --- a/client/src/services/stakeholder-best-service.js +++ b/client/src/services/stakeholder-best-service.js @@ -1,6 +1,6 @@ import axios from "axios"; import moment from "moment"; -import { getTenantId } from "helpers/Configuration"; +import { tenantId } from "helpers/Configuration"; const baseUrl = "/api/stakeholderbests"; @@ -27,7 +27,7 @@ export const search = async (searchParams) => { const response = await axios.get(baseUrl, { params: { ...searchParams, - tenantId: getTenantId(), + tenantId, }, }); let stakeholders = response.data.map((s) => { diff --git a/client/src/services/stakeholder-service.js b/client/src/services/stakeholder-service.js index 4b48717de..edacc5702 100644 --- a/client/src/services/stakeholder-service.js +++ b/client/src/services/stakeholder-service.js @@ -1,7 +1,7 @@ import axios from "axios"; import moment from "moment"; import fileDownload from "js-file-download"; -import { getTenantId } from "helpers/Configuration"; +import { tenantId } from "helpers/Configuration"; const baseUrl = "/api/stakeholders"; @@ -47,7 +47,7 @@ export const getById = async (id) => { export const post = async (stakeholder) => { const response = await axios.post(baseUrl, { ...stakeholder, - tenantId: getTenantId(), + tenantId, }); return response.data; }; From e181f3b599fee493c9aa964cd15d47aec49de1a4 Mon Sep 17 00:00:00 2001 From: John Darragh Date: Wed, 14 Oct 2020 09:06:26 -0700 Subject: [PATCH 6/6] Bumped version number to 1.0.26 --- client/package.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/client/package.json b/client/package.json index 9b9b598fc..8adb39302 100644 --- a/client/package.json +++ b/client/package.json @@ -1,7 +1,7 @@ { "name": "food-oasis-client", "description": "React Client for Food Oasis", - "version": "1.0.25", + "version": "1.0.26", "author": "Hack for LA", "license": "GPL-2.0", "private": true, diff --git a/package.json b/package.json index bcd44a96d..3c2bcad63 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "foodoasis", - "version": "1.0.25", + "version": "1.0.26", "author": "Hack for LA", "description": "Web API Server for Food Oasis", "main": "server.js",