-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor sidebar items into a reusable function * Add JWT functionality and sidebar link * Add PreviewTokenAccess component * Audit fix and fmt * moved core of CodeBlock to the separate component which can be used outside of MDX scope * fix for CodeBlock * JwtForm view without logic * basic result component for jwt page * some logic integration into the new view * some drafting on how results part should work, overall fixes * fix audit * wip * configuration for the collection-level access * disable jwt page if server does not support it * format * wip: selection from existing payload keys * settings key select fix * fix form size and rename read access -> management access * add tooltips * add + button for collection settings * Fix: Too many re-renders, infinite loop. * Add note for no indexed field in CollectionAccessDialog * Fix missing error message when API key is not provided in Jwt.jsx * Fix missing setSelectedCollection call in CollectionAccessDialog.jsx --------- Co-authored-by: kartik-gupta-ij <[email protected]> Co-authored-by: generall <[email protected]>
- Loading branch information
1 parent
0d26952
commit d45014f
Showing
23 changed files
with
1,254 additions
and
173 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/components/InteractiveTutorial/MdxComponents/MdxCodeBlock.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { requestFromCode } from '../../CodeEditorWindow/config/RequesFromCode'; | ||
import { useTutorial } from '../../../context/tutorial-context'; | ||
import { bigIntJSON } from '../../../common/bigIntJSON'; | ||
import { CodeBlock } from '../../Common/CodeBlock'; | ||
|
||
/** | ||
* Code block with syntax highlighting | ||
* @param {object} children - code block content from mdx | ||
* @return {JSX.Element} | ||
* @constructor | ||
*/ | ||
export const MdxCodeBlock = ({ children }) => { | ||
const className = children.props.className || ''; | ||
const code = children.props.children.trim(); | ||
const language = className.replace(/language-/, ''); | ||
const withRunButton = children.props.withRunButton && bigIntJSON.parse(children.props.withRunButton); | ||
const { setResult } = useTutorial(); | ||
|
||
const handleRun = (code) => { | ||
setResult('{}'); | ||
requestFromCode(code, false) | ||
.then((res) => { | ||
setResult(() => bigIntJSON.stringify(res)); | ||
}) | ||
.catch((err) => { | ||
setResult(() => bigIntJSON.stringify(err)); | ||
}); | ||
}; | ||
|
||
return <CodeBlock codeStr={code} language={language} withRunButton={withRunButton} onRun={handleRun} />; | ||
}; | ||
|
||
MdxCodeBlock.propTypes = { | ||
children: PropTypes.shape({ | ||
props: PropTypes.shape({ | ||
className: PropTypes.string, | ||
children: PropTypes.string.isRequired, | ||
withRunButton: PropTypes.string, | ||
}), | ||
}), | ||
}; |
Oops, something went wrong.