-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update feedback form with correct link #530
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you provide more backstory? Why are we switching from the earthdata feedback form to Google forms?
How did window.feedback
get set? Should we remove the code that does that operation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to remove the kruft around setting up the old feedback form if we're not using that anymore.
See:
admg-casei/src/components/seo.js
Lines 31 to 45 in 52de652
const FBM_URL = `https://fbm.earthdata.nasa.gov/for/CASEI/feedback.js` | |
const { setIsFBMLoaded } = useContext(FBMContext) | |
const handleChangeClientState = (newState, addedTags) => { | |
if (addedTags && addedTags.scriptTags) { | |
const foundScript = addedTags.scriptTags.find( | |
({ src }) => src === FBM_URL | |
) | |
if (foundScript) { | |
foundScript.onload = () => window.feedback.init({ showIcon: false }) | |
setIsFBMLoaded(true) | |
} | |
} | |
} |
admg-casei/src/components/inpage-nav.js
Lines 110 to 119 in 52de652
{isFBMLoaded && ( | |
<Button | |
action={() => { | |
window.feedback.showForm() | |
}} | |
mode={POSITIVE} | |
> | |
Feedback | |
</Button> | |
)} |
admg-casei/src/components/fbm-provider.js
Lines 1 to 22 in 52de652
import React, { createContext, useState } from "react" | |
import PropTypes from "prop-types" | |
export const FBMContext = createContext({ isFBMLoaded: false }) | |
function FBMProvider({ children }) { | |
const [isFBMLoaded, setIsFBMLoaded] = useState( | |
typeof window !== "undefined" && window.feedback && window.feedback.showForm | |
) | |
return ( | |
<FBMContext.Provider value={{ isFBMLoaded, setIsFBMLoaded }}> | |
{children} | |
</FBMContext.Provider> | |
) | |
} | |
FBMProvider.propTypes = { | |
children: PropTypes.node.isRequired, | |
} | |
export default FBMProvider |
Lines 24 to 27 in 52de652
export const wrapRootElement = ({ element }) => { | |
return <FBMProvider>{element}</FBMProvider> | |
} | |
Reviewing a bit more about where we are already using the feedback form URL, I think it would be prudent to move this URL into a single constants file to make management of it a bit simpler: admg-casei/src/pages/contact.js Lines 67 to 72 in 52de652
|
There was a good amount of unnecessary code. Requested changes add to maintainability. cc @alukach |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank @naomatheus, looking really good! I think there may be one or two other issues left, but almost there
bounds: String | ||
spatial_bounds: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any idea why these were needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea,
gatsby doesn't allow "spatial_bounds"/"bounds" to be queried on the campaign type without this declaration.
source: https://www.gatsbyjs.com/docs/reference/graphql-data-layer/schema-customization/#fixing-field-types
Merging Fix/issue 525 to feature/issue-525
updates feedback form to open in new tab