Skip to content
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

Merged
merged 16 commits into from
Jun 7, 2023
Merged

Conversation

naomatheus
Copy link
Collaborator

updates feedback form to open in new tab

@naomatheus naomatheus requested a review from alukach June 1, 2023 21:35
Copy link
Member

@alukach alukach left a 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?

package-lock.json Show resolved Hide resolved
@naomatheus
Copy link
Collaborator Author

Backstory

Yea, this is in #525
@alukach

Copy link
Member

@alukach alukach left a 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:

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)
}
}
}

{isFBMLoaded && (
<Button
action={() => {
window.feedback.showForm()
}}
mode={POSITIVE}
>
Feedback
</Button>
)}

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

export const wrapRootElement = ({ element }) => {
return <FBMProvider>{element}</FBMProvider>
}

package-lock.json Show resolved Hide resolved
@alukach
Copy link
Member

alukach commented Jun 2, 2023

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:

<ExternalLink
url="https://docs.google.com/forms/d/e/1FAIpQLSfCQzZHtaDSiWNdwiJa3TIzsyhjEbYyyHwfrcwIKn_UmdVaKA/viewform?usp=sf_link"
target="_blank"
label="CASEI feedback"
id="feedback form"
/>{" "}

@naomatheus naomatheus requested a review from alukach June 5, 2023 20:47
@naomatheus
Copy link
Collaborator Author

There was a good amount of unnecessary code. Requested changes add to maintainability. cc @alukach

Copy link
Member

@alukach alukach left a 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

src/components/seo.js Outdated Show resolved Hide resolved
src/pages/index.js Outdated Show resolved Hide resolved
Comment on lines +29 to +30
bounds: String
spatial_bounds: String
Copy link
Member

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?

Copy link
Collaborator Author

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

@naomatheus naomatheus merged commit b519411 into develop Jun 7, 2023
@naomatheus naomatheus deleted the feature/issue-525 branch June 7, 2023 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants