-
Notifications
You must be signed in to change notification settings - Fork 187
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
Rapid exp title changes dependent on new or edit fixes #2901 #2994
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from "react"; | ||
import { useHistory } from "react-router-dom"; | ||
|
||
import { useExperimentState } from "experimenter-rapid/contexts/experiment/hooks"; | ||
|
||
const ExperimentFormPage: React.FC = () => { | ||
const { location } = useHistory(); | ||
let pageHeading = "Create a New A/A Experiment"; | ||
if (location.pathname.includes("edit")) { | ||
const experimentData = useExperimentState(); | ||
pageHeading = `Edit Experiment: ${experimentData.name}`; | ||
} | ||
|
||
return ( | ||
<div className="mb-4"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Below this was wrapped in a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I intially had it, but it gave me a weird indent 🤷♀️. Not exactly the best with front end stuff 😅 |
||
<div className="d-flex align-items-center"> | ||
<h3 className="mr-3">{pageHeading}</h3> | ||
<span className="badge badge-secondary mb-1">Draft</span> | ||
</div> | ||
<p> | ||
Create and automatically launch an A/A CFR experiment. A/A experiments | ||
measure the accuracy of the tool. | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ExperimentFormPage; |
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't we look at the experiment data to see if it has a name instead of looking at the url?
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.
so... i took a stab at only using experiment data. Since the name data value changes when a user changes the name in the text field, I couldn't think of a way how would that indicate whether the experiment was new, or an edit. I decided on using the presence of a slug in the experiment data instead?