Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(code-editor): added button to switch editors
- Loading branch information
Showing
10 changed files
with
58 additions
and
31 deletions.
There are no files selected for viewing
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
22 changes: 18 additions & 4 deletions
22
modules/code-editor/src/views/full/components/SplashScreen.tsx
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 |
---|---|---|
@@ -1,17 +1,31 @@ | ||
import { Button } from '@blueprintjs/core' | ||
import { KeyboardShortcut, SplashScreen } from 'botpress/ui' | ||
import React from 'react' | ||
import { MdCode } from 'react-icons/md' | ||
|
||
import style from '../style.scss' | ||
|
||
const description = `Code editor allows you to create and edit actions without leaving botpress studio. It features typings and | ||
intelligent code completion. To edit global files and content generated by modules, you need to enable that by editing the code-editor.json configuration file.` | ||
|
||
const rawEditorDesc = `WARNING: The raw file editor has no safeguards and you can easily mess important files. Handle with care ! | ||
You can edit any file contained in the data folder, create new files and move existing files around.` | ||
const rawEditorDesc = ( | ||
<span> | ||
<span className={style.warning}>WARNING</span> | ||
<br /> The raw file editor has no safeguards and you can easily mess important files. Handle with care ! You can | ||
edit any file contained in the data folder, create new files and move existing files around. | ||
</span> | ||
) | ||
|
||
export default ({ rawEditor }) => ( | ||
<SplashScreen icon={<MdCode />} title={'Code Editor'} description={rawEditor ? rawEditorDesc : description}> | ||
export default ({ hasRawPermissions, isAdvanced, setAdvanced }) => ( | ||
<SplashScreen icon={<MdCode />} title={'Code Editor'} description={isAdvanced ? rawEditorDesc : description}> | ||
<KeyboardShortcut label="Save file" keys={['ACTION', 's']} /> | ||
<KeyboardShortcut label="New file" keys={['ACTION', 'alt', 'n']} /> | ||
<KeyboardShortcut label="Command Palette" keys={['ACTION', 'shift', 'p']} /> | ||
<br /> | ||
{hasRawPermissions && ( | ||
<div> | ||
<Button text={isAdvanced ? 'Basic Editor' : 'Advanced Editor'} onClick={() => setAdvanced(!isAdvanced)} /> | ||
</div> | ||
)} | ||
</SplashScreen> | ||
) |
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
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 |
---|---|---|
|
@@ -50,3 +50,8 @@ | |
.padding { | ||
padding: 2px 10px; | ||
} | ||
|
||
.warning { | ||
font-weight: bold; | ||
color: red; | ||
} |
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