Skip to content

Commit 24416dc

Browse files
ioedeveloperAniket-Engg
authored andcommitted
Fix copy cotent and stop click propagation
1 parent e87db8b commit 24416dc

File tree

4 files changed

+7
-9
lines changed

4 files changed

+7
-9
lines changed

apps/circuit-compiler/src/app/components/feedback.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,14 @@ export function CompilerFeedback ({ feedback, filePathToId, hideWarnings, openEr
4545
<RenderIf condition={response.type === 'Error'}>
4646
<div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-danger`} data-id="circuit_feedback">
4747
<FeedbackAlert
48-
message={response.message}
49-
location={ response.labels[0] ? response.labels[0].message + ` ${filePathToId[response.labels[0].file_id]}:${response.labels[0].range.start}:${response.labels[0].range.end}` : null}
48+
message={response.message + (response.labels[0] ? ": " + response.labels[0].message + ` ${filePathToId[response.labels[0].file_id]}:${response.labels[0].range.start}:${response.labels[0].range.end}` : '')}
5049
askGPT={ () => handleAskGPT(response) } />
5150
</div>
5251
</RenderIf>
5352
<RenderIf condition={(response.type === 'Warning') && !hideWarnings}>
5453
<div className={`circuit_feedback ${response.type.toLowerCase()} alert alert-warning`} data-id="circuit_feedback">
5554
<FeedbackAlert
5655
message={response.message}
57-
location={null}
5856
askGPT={() => { handleAskGPT(response) }} />
5957
</div>
6058
</RenderIf>

apps/circuit-compiler/src/app/components/feedbackAlert.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { FeedbackAlertProps } from '../types'
33
import { RenderIf } from '@remix-ui/helper'
44
import {CopyToClipboard} from '@remix-ui/clipboard'
55

6-
export function FeedbackAlert ({ message, location, askGPT }: FeedbackAlertProps) {
6+
export function FeedbackAlert ({ message, askGPT }: FeedbackAlertProps) {
77
const [ showAlert, setShowAlert] = useState<boolean>(true)
88

99
const handleCloseAlert = () => {
@@ -14,17 +14,17 @@ export function FeedbackAlert ({ message, location, askGPT }: FeedbackAlertProps
1414
<RenderIf condition={showAlert}>
1515
<>
1616
<span> { message } </span>
17-
<RenderIf condition={location !== null}>
18-
<span> { location }</span>
19-
</RenderIf>
2017
<div className="close" data-id="renderer" onClick={handleCloseAlert}>
2118
<i className="fas fa-times"></i>
2219
</div>
2320
<div className="d-flex pt-1 flex-row-reverse">
2421
<span className="ml-3 pt-1 py-1" >
2522
<CopyToClipboard content={message} className="p-0 m-0 far fa-copy error" direction={'top'} />
2623
</span>
27-
<span className="border border-success text-success btn-sm" onClick={askGPT}>ASK GPT</span>
24+
<span className="border border-success text-success btn-sm" onClick={(e) => {
25+
e.stopPropagation()
26+
askGPT()
27+
}}>ASK GPT</span>
2828
</div>
2929
</>
3030
</RenderIf>

apps/circuit-compiler/src/app/types/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export type CompilerReport = {
7272

7373
export type FeedbackAlertProps = {
7474
message: string,
75-
location: string,
7675
askGPT: () => void
7776
}
7877

libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ export const CopyToClipboard = (props: ICopyToClipboard) => {
4444
content = getContent && getContent()
4545
copyData()
4646
}
47+
e.stopPropagation()
4748
e.preventDefault()
4849
}
4950

0 commit comments

Comments
 (0)