@@ -42,8 +42,11 @@ import type { CardDef } from 'https://cardstack.com/base/card-api';
42
42
43
43
import ApplyButton from ' ../ai-assistant/apply-button' ;
44
44
import { type ApplyButtonState } from ' ../ai-assistant/apply-button' ;
45
+
45
46
import Preview from ' ../preview' ;
46
47
48
+ import PreparingRoomMessageCommand from ' ./preparing-room-message-command' ;
49
+
47
50
interface Signature {
48
51
Element: HTMLDivElement ;
49
52
Args: {
@@ -53,6 +56,7 @@ interface Signature {
53
56
runCommand: () => void ;
54
57
isError? : boolean ;
55
58
isPending? : boolean ;
59
+ isStreaming: boolean ;
56
60
monacoSDK: MonacoSDK ;
57
61
};
58
62
}
@@ -193,97 +197,101 @@ export default class RoomMessageCommand extends Component<Signature> {
193
197
{{#if @ messageCommand.description }}
194
198
<div class =' command-description' >{{@ messageCommand.description }} </div >
195
199
{{/if }}
196
- <div
197
- class =' command-button-bar'
198
- {{! In test, if we change this isIdle check to the task running locally on this component, it will fail because roomMessages get destroyed during re-indexing.
200
+ {{#if @ isStreaming }}
201
+ <PreparingRoomMessageCommand />
202
+ {{else }}
203
+ <div
204
+ class =' command-button-bar'
205
+ {{! In test, if we change this isIdle check to the task running locally on this component, it will fail because roomMessages get destroyed during re-indexing.
199
206
Since services are long-lived so it we will not have this issue. I think this will go away when we convert our room field into a room component }}
200
- {{! TODO : Convert to non-EC async method after fixing CS-6987 }}
201
- data-test-command-card-idle ={{this .commandService.run.isIdle }}
202
- >
203
- <Button
204
- class =' view-code-button'
205
- {{on ' click' this . toggleViewCode}}
206
- @ kind ={{if this . isDisplayingCode ' primary-dark' ' secondary-dark' }}
207
- @ size =' extra-small'
208
- data-test-view-code-button
207
+ {{! TODO : Convert to non-EC async method after fixing CS-6987 }}
208
+ data-test-command-card-idle ={{this .commandService.run.isIdle }}
209
209
>
210
- {{if this . isDisplayingCode ' Hide Code' ' View Code' }}
211
- </Button >
212
- <ApplyButton
213
- @ state ={{this .applyButtonState }}
214
- {{on ' click' @ runCommand}}
215
- data-test-command-apply ={{this .applyButtonState }}
216
- />
217
- </div >
218
- {{#if this . isDisplayingCode }}
219
- <div class =' preview-code' >
220
210
<Button
221
- class =' code-copy-button'
222
- @ kind =' text-only'
211
+ class =' view-code-button'
212
+ {{on ' click' this . toggleViewCode}}
213
+ @ kind ={{if this . isDisplayingCode ' primary-dark' ' secondary-dark' }}
223
214
@ size =' extra-small'
224
- {{on ' click' this . copyToClipboard}}
225
- data-test-copy-code
215
+ data-test-view-code-button
226
216
>
227
- <CopyIcon
228
- width =' 16'
229
- height =' 16'
230
- role =' presentation'
231
- aria-hidden =' true'
232
- />
233
- <span class =' copy-text' >Copy to clipboard</span >
217
+ {{if this . isDisplayingCode ' Hide Code' ' View Code' }}
234
218
</Button >
235
- <div
236
- class =' monaco-container'
237
- {{this .scrollBottomIntoView }}
238
- {{monacoModifier
239
- content =this . previewCommandCode
240
- contentChanged =undefined
241
- monacoSDK =@ monacoSDK
242
- language =' json'
243
- readOnly =true
244
- editorDisplayOptions =this . editorDisplayOptions
245
- }}
246
- data-test-editor
247
- data-test-percy-hide
219
+ <ApplyButton
220
+ @ state ={{this .applyButtonState }}
221
+ {{on ' click' @ runCommand}}
222
+ data-test-command-apply ={{this .applyButtonState }}
248
223
/>
249
224
</div >
250
- {{/if }}
251
- {{#if this . failedCommandState }}
252
- <div class =' failed-command-result' >
253
- <span class =' failed-command-text' >
254
- {{this .failedCommandState.message }}
255
- </span >
256
- <Button
257
- {{on ' click' @ runCommand}}
258
- class =' retry-button'
259
- @ size =' small'
260
- @ kind =' secondary-dark'
261
- data-test-retry-command-button
225
+ {{#if this . isDisplayingCode }}
226
+ <div class =' preview-code' >
227
+ <Button
228
+ class =' code-copy-button'
229
+ @ kind =' text-only'
230
+ @ size =' extra-small'
231
+ {{on ' click' this . copyToClipboard}}
232
+ data-test-copy-code
233
+ >
234
+ <CopyIcon
235
+ width =' 16'
236
+ height =' 16'
237
+ role =' presentation'
238
+ aria-hidden =' true'
239
+ />
240
+ <span class =' copy-text' >Copy to clipboard</span >
241
+ </Button >
242
+ <div
243
+ class =' monaco-container'
244
+ {{this .scrollBottomIntoView }}
245
+ {{monacoModifier
246
+ content =this . previewCommandCode
247
+ contentChanged =undefined
248
+ monacoSDK =@ monacoSDK
249
+ language =' json'
250
+ readOnly =true
251
+ editorDisplayOptions =this . editorDisplayOptions
252
+ }}
253
+ data-test-editor
254
+ data-test-percy-hide
255
+ />
256
+ </div >
257
+ {{/if }}
258
+ {{#if this . failedCommandState }}
259
+ <div class =' failed-command-result' >
260
+ <span class =' failed-command-text' >
261
+ {{this .failedCommandState.message }}
262
+ </span >
263
+ <Button
264
+ {{on ' click' @ runCommand}}
265
+ class =' retry-button'
266
+ @ size =' small'
267
+ @ kind =' secondary-dark'
268
+ data-test-retry-command-button
269
+ >
270
+ Retry
271
+ </Button >
272
+ </div >
273
+ {{/if }}
274
+ {{#if this . commandResultCard.card }}
275
+ <CardContainer
276
+ @ displayBoundaries ={{ false }}
277
+ class =' command-result-card-preview'
278
+ data-test-command-result-container
262
279
>
263
- Retry
264
- </Button >
265
- </div >
266
- {{/if }}
267
- {{#if this . commandResultCard.card }}
268
- <CardContainer
269
- @ displayBoundaries ={{ false }}
270
- class =' command-result-card-preview'
271
- data-test-command-result-container
272
- >
273
- <CardHeader
274
- @ cardTypeDisplayName ={{this .headerTitle }}
275
- @ cardTypeIcon ={{cardTypeIcon this . commandResultCard.card}}
276
- @ moreOptionsMenuItems ={{this .moreOptionsMenuItems }}
277
- class =' header'
278
- data-test-command-result-header
279
- />
280
- <Preview
281
- @ card ={{this .commandResultCard.card }}
282
- @ format =' embedded'
283
- @ displayContainer ={{ false }}
284
- data-test-boxel-command-result
285
- />
286
- </CardContainer >
280
+ <CardHeader
281
+ @ cardTypeDisplayName ={{this .headerTitle }}
282
+ @ cardTypeIcon ={{cardTypeIcon this . commandResultCard.card}}
283
+ @ moreOptionsMenuItems ={{this .moreOptionsMenuItems }}
284
+ class =' header'
285
+ data-test-command-result-header
286
+ />
287
+ <Preview
288
+ @ card ={{this .commandResultCard.card }}
289
+ @ format =' embedded'
290
+ @ displayContainer ={{ false }}
291
+ data-test-boxel-command-result
292
+ />
293
+ </CardContainer >
294
+ {{/if }}
287
295
{{/if }}
288
296
</div >
289
297
0 commit comments