File tree 2 files changed +15
-1
lines changed
app/components/course-admin/code-example-page/evaluation-card 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change
1
+ <TertiaryButton class =" mb-4" {{ on " click" this.handleCopyPromptButtonClick }} >
2
+ Copy prompt
3
+ </TertiaryButton >
4
+
1
5
<div class =" bg-gray-800 border border-gray-700 rounded overflow-y-auto relative flex-grow p-3" >
2
6
{{ #if @evaluation.promptFileContents }}
3
7
<pre class =" font-mono text-xs text-white whitespace-pre-wrap" ><code >{{ ansi-to-html @evaluation.promptFileContents }} </code ></pre >
Original file line number Diff line number Diff line change
1
+ import { action } from '@ember/object' ;
1
2
import Component from '@glimmer/component' ;
2
3
import type CommunitySolutionEvaluationModel from 'codecrafters-frontend/models/community-solution-evaluation' ;
3
4
@@ -9,7 +10,16 @@ export interface Signature {
9
10
} ;
10
11
}
11
12
12
- export default class PromptTabComponent extends Component < Signature > { }
13
+ export default class PromptTabComponent extends Component < Signature > {
14
+ @action
15
+ handleCopyPromptButtonClick ( ) {
16
+ if ( this . args . evaluation . promptFileContents ) {
17
+ navigator . clipboard . writeText ( this . args . evaluation . promptFileContents ) ;
18
+ } else {
19
+ alert ( 'Error, contact us at [email protected] if this keeps happening!' ) ;
20
+ }
21
+ }
22
+ }
13
23
14
24
declare module '@glint/environment-ember-loose/registry' {
15
25
export default interface Registry {
You can’t perform that action at this time.
0 commit comments