-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#2790-remove-copy-cut-paste-Modal-from-client-to-ketcher-react
- Loading branch information
1 parent
5c35648
commit a42c813
Showing
12 changed files
with
217 additions
and
17 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
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
42 changes: 42 additions & 0 deletions
42
packages/ketcher-react/src/script/ui/views/modal/components/InfoModal/InfoModal.module.less
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,42 @@ | ||
/**************************************************************************** | ||
* Copyright 2021 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
***************************************************************************/ | ||
|
||
|
||
@import '../../../../../../style/variables.less'; | ||
|
||
.infoModal { | ||
width: @width-settings; | ||
} | ||
|
||
.ok { | ||
min-width: 70px; | ||
height: 24px; | ||
border-radius: 4px; | ||
font-size: 12px; | ||
color: #fff; | ||
background-color: #167782; | ||
border: 1px solid transparent; | ||
} | ||
|
||
.ok:hover, .ok:active { | ||
background-color: #4fb3bf; | ||
} | ||
|
||
.ok:disabled { | ||
color: #333; | ||
background-color: #e1e5ea; | ||
} | ||
|
63 changes: 63 additions & 0 deletions
63
packages/ketcher-react/src/script/ui/views/modal/components/InfoModal/InfoModal.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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/**************************************************************************** | ||
* Copyright 2021 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
***************************************************************************/ | ||
|
||
import { connect } from 'react-redux' | ||
import config from 'src/script/ui/action' | ||
import { error } from './constants' | ||
import { Dialog } from '../../../components' | ||
import { PasteErrorModalBody } from './PasteErrorModalBody' | ||
|
||
import styles from './InfoModal.module.less' | ||
|
||
function ErrorInfoModal(props) { | ||
console.log('props in ErrorInfoModal', props) | ||
|
||
const paste = config.paste.title ?? 'Paste' | ||
const isPasteError = props.message === paste | ||
|
||
const defaultMessage = `This action is unavailable via menu. Instead, use shortcut to ${props.message}.` | ||
|
||
const headerContent = <div>{error.message}</div> | ||
|
||
return ( | ||
<Dialog | ||
className={styles.infoModal} | ||
params={props} | ||
buttons={[ | ||
<button onClick={props.onOk} className={styles.ok} key="ok"> | ||
Close | ||
</button> | ||
]} | ||
headerContent={headerContent} | ||
> | ||
<div>{isPasteError ? <PasteErrorModalBody /> : defaultMessage}</div> | ||
</Dialog> | ||
) | ||
} | ||
|
||
const mapStateToProps = (state) => ({ | ||
errorMessage: state.options.app.errorMessage | ||
}) | ||
|
||
const mapDispatchToProps = (dispatch) => ({ | ||
onOk: (_result) => { | ||
dispatch({ type: 'MODAL_CLOSE' }) | ||
} | ||
}) | ||
|
||
const InfoModal = connect(mapStateToProps, mapDispatchToProps)(ErrorInfoModal) | ||
|
||
export default InfoModal |
20 changes: 20 additions & 0 deletions
20
...t/ui/views/modal/components/InfoModal/PasteErrorModalBody/PasteErrorModalBody.module.less
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,20 @@ | ||
.pasteErrorModalBody { | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
.shortcutsBlock { | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.shortcuts { | ||
display: flex; | ||
flex-direction: column; | ||
margin-top: 12px; | ||
} | ||
|
||
.shortcut { | ||
font-size: 14px; | ||
color: #167782; | ||
} |
17 changes: 17 additions & 0 deletions
17
...rc/script/ui/views/modal/components/InfoModal/PasteErrorModalBody/PasteErrorModalBody.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { pasteErrorText, shortcut } from '../constants' | ||
|
||
import styles from './PasteErrorModalBody.module.less' | ||
|
||
export const PasteErrorModalBody = (): JSX.Element => { | ||
return ( | ||
<div className={styles.pasteErrorModalBody}> | ||
<div>{pasteErrorText}</div> | ||
<div className={styles.shortcutsBlock}> | ||
<div className={styles.shortcuts}> | ||
<div className={styles.shortcut}>{shortcut.hotKey}</div> | ||
<div>{shortcut.label}</div> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
1 change: 1 addition & 0 deletions
1
...ketcher-react/src/script/ui/views/modal/components/InfoModal/PasteErrorModalBody/index.ts
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 @@ | ||
export * from './PasteErrorModalBody' |
9 changes: 9 additions & 0 deletions
9
packages/ketcher-react/src/script/ui/views/modal/components/InfoModal/constants.ts
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,9 @@ | ||
export const pasteErrorText = | ||
"Your browser doesn't allow pasting clipboard content via button. Please use shortcut instead." | ||
|
||
export const shortcut = { hotKey: 'CTRL/Cmd + V', label: 'for paste' } | ||
|
||
export const error = { | ||
message: 'Error Message', | ||
close: 'Close' | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/ketcher-react/src/script/ui/views/modal/components/InfoModal/index.ts
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,17 @@ | ||
/**************************************************************************** | ||
* Copyright 2021 EPAM Systems | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
***************************************************************************/ | ||
|
||
export { default } from './InfoModal' |
1 change: 1 addition & 0 deletions
1
packages/ketcher-react/src/script/ui/views/modal/components/InfoModal/overlay.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.