-
Notifications
You must be signed in to change notification settings - Fork 1
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
Create templates in script editors #151
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.
Overall looks good, question about the hint-text content
const contentOnEmpty = useMemo(() => { | ||
const spanElement = document.createElement("span"); | ||
const t1 = document.createTextNode( | ||
"Define a dictionary called data to update the data.json. ", | ||
); | ||
const a1 = document.createElement("a"); | ||
a1.onclick = () => { | ||
setEditedFileContent(dataPyTemplate); | ||
}; | ||
a1.textContent = "Click here to generate an example"; | ||
spanElement.appendChild(t1); | ||
spanElement.appendChild(a1); | ||
return spanElement; | ||
}, [setEditedFileContent]); |
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.
Is it possible to do this as a React component? No worries if not, it just seems like it'd be more straightforward than having to assemble it manually.
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.
Would be nice, but I don't think it's possible.
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 just looked into a few options, all the supported ways of turning a JSX element into a actual DOM element are in react-dom/server
and therefore don't persist the onClick
in a meaningful way. Too bad
gui/src/app/pages/HomePage/DataGenerationWindow/DataRFileEditor.tsx
Outdated
Show resolved
Hide resolved
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 this is great! A few wording suggestions/suggestions about the template content.
This builds on #150
In data.py, data.R, analysis.py... if the editor is empty, there is a LINK text hint inviting click to generate template code.
We'll want to think about what the template code should be, and whether we want to somehow link to more thorough documentation.