@@ -17,7 +17,7 @@ import {
17
17
CardHeader ,
18
18
} from ' @cardstack/boxel-ui/components' ;
19
19
20
- import { MenuItem , bool , cn } from ' @cardstack/boxel-ui/helpers' ;
20
+ import { MenuItem , bool , cn , eq , not } from ' @cardstack/boxel-ui/helpers' ;
21
21
import { ArrowLeft } from ' @cardstack/boxel-ui/icons' ;
22
22
23
23
import { cardTypeDisplayName , cardTypeIcon } from ' @cardstack/runtime-common' ;
@@ -42,6 +42,8 @@ import { type ApplyButtonState } from '../ai-assistant/apply-button';
42
42
import CodeBlock from ' ../ai-assistant/code-block' ;
43
43
import Preview from ' ../preview' ;
44
44
45
+ import PreparingRoomMessageCommand from ' ./preparing-room-message-command' ;
46
+
45
47
interface Signature {
46
48
Element: HTMLDivElement ;
47
49
Args: {
@@ -51,6 +53,7 @@ interface Signature {
51
53
runCommand: () => void ;
52
54
isError? : boolean ;
53
55
isPending? : boolean ;
56
+ isStreaming: boolean ;
54
57
monacoSDK: MonacoSDK ;
55
58
};
56
59
}
@@ -166,78 +169,81 @@ export default class RoomMessageCommand extends Component<Signature> {
166
169
{{#if @ messageCommand.description }}
167
170
<div class =' command-description' >{{@ messageCommand.description }} </div >
168
171
{{/if }}
169
- <div
170
- class =' command-button-bar'
171
- {{! 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.
172
- 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 }}
173
- {{! TODO : Convert to non-EC async method after fixing CS-6987 }}
174
- data-test-command-card-idle ={{this .commandService.run.isIdle }}
175
- >
176
- <Button
177
- class =' view-code-button'
178
- {{on ' click' this . toggleViewCode}}
179
- @ kind ={{if this . isDisplayingCode ' primary-dark' ' secondary-dark' }}
180
- @ size =' extra-small'
181
- data-test-view-code-button
182
- >
183
- {{if this . isDisplayingCode ' Hide Code' ' View Code' }}
184
- </Button >
185
- <ApplyButton
186
- @ state ={{this .applyButtonState }}
187
- {{on ' click' @ runCommand}}
188
- data-test-command-apply ={{this .applyButtonState }}
189
- />
190
- </div >
191
- {{#if this . isDisplayingCode }}
192
- <CodeBlock
193
- {{this .scrollBottomIntoView }}
194
- @ monacoSDK ={{@ monacoSDK }}
195
- @ code ={{this .previewCommandCode }}
196
- @ language =' json'
197
- as | codeBlock |
172
+ {{#if @ isStreaming }}
173
+ <PreparingRoomMessageCommand />
174
+ {{else }}
175
+ <div
176
+ class =' command-button-bar'
177
+ data-test-command-card-idle ={{not
178
+ ( eq @ messageCommand.status ' applying' )
179
+ }}
198
180
>
199
- <codeBlock.actions as | actions | >
200
- <actions.copyCode />
201
- </codeBlock.actions >
202
- <codeBlock.editor />
203
- </CodeBlock >
204
- {{/if }}
205
- {{#if this . failedCommandState }}
206
- <div class =' failed-command-result' >
207
- <span class =' failed-command-text' >
208
- {{this .failedCommandState.message }}
209
- </span >
210
181
<Button
211
- {{ on ' click ' @ runCommand }}
212
- class = ' retry-button '
213
- @ size = ' small '
214
- @ kind = ' secondary-dark '
215
- data-test-retry-command -button
182
+ class = ' view-code-button '
183
+ {{ on ' click ' this . toggleViewCode }}
184
+ @ kind = {{ if this . isDisplayingCode ' primary-dark ' ' secondary-dark ' }}
185
+ @ size = ' extra-small '
186
+ data-test-view-code -button
216
187
>
217
- Retry
188
+ {{ if this . isDisplayingCode ' Hide Code ' ' View Code ' }}
218
189
</Button >
219
- </div >
220
- {{/if }}
221
- {{#if this . commandResultCard.card }}
222
- <CardContainer
223
- @ displayBoundaries ={{ false }}
224
- class =' command-result-card-preview'
225
- data-test-command-result-container
226
- >
227
- <CardHeader
228
- @ cardTypeDisplayName ={{this .headerTitle }}
229
- @ cardTypeIcon ={{cardTypeIcon this . commandResultCard.card}}
230
- @ moreOptionsMenuItems ={{this .moreOptionsMenuItems }}
231
- class =' header'
232
- data-test-command-result-header
233
- />
234
- <Preview
235
- @ card ={{this .commandResultCard.card }}
236
- @ format =' embedded'
237
- @ displayContainer ={{ false }}
238
- data-test-boxel-command-result
190
+ <ApplyButton
191
+ @ state ={{this .applyButtonState }}
192
+ {{on ' click' @ runCommand}}
193
+ data-test-command-apply ={{this .applyButtonState }}
239
194
/>
240
- </CardContainer >
195
+ </div >
196
+ {{#if this . isDisplayingCode }}
197
+ <CodeBlock
198
+ {{this .scrollBottomIntoView }}
199
+ @ monacoSDK ={{@ monacoSDK }}
200
+ @ code ={{this .previewCommandCode }}
201
+ @ language =' json'
202
+ as | codeBlock |
203
+ >
204
+ <codeBlock.actions as | actions | >
205
+ <actions.copyCode />
206
+ </codeBlock.actions >
207
+ <codeBlock.editor />
208
+ </CodeBlock >
209
+ {{/if }}
210
+ {{#if this . failedCommandState }}
211
+ <div class =' failed-command-result' >
212
+ <span class =' failed-command-text' >
213
+ {{this .failedCommandState.message }}
214
+ </span >
215
+ <Button
216
+ {{on ' click' @ runCommand}}
217
+ class =' retry-button'
218
+ @ size =' small'
219
+ @ kind =' secondary-dark'
220
+ data-test-retry-command-button
221
+ >
222
+ Retry
223
+ </Button >
224
+ </div >
225
+ {{/if }}
226
+ {{#if this . commandResultCard.card }}
227
+ <CardContainer
228
+ @ displayBoundaries ={{ false }}
229
+ class =' command-result-card-preview'
230
+ data-test-command-result-container
231
+ >
232
+ <CardHeader
233
+ @ cardTypeDisplayName ={{this .headerTitle }}
234
+ @ cardTypeIcon ={{cardTypeIcon this . commandResultCard.card}}
235
+ @ moreOptionsMenuItems ={{this .moreOptionsMenuItems }}
236
+ class =' header'
237
+ data-test-command-result-header
238
+ />
239
+ <Preview
240
+ @ card ={{this .commandResultCard.card }}
241
+ @ format =' embedded'
242
+ @ displayContainer ={{ false }}
243
+ data-test-boxel-command-result
244
+ />
245
+ </CardContainer >
246
+ {{/if }}
241
247
{{/if }}
242
248
</div >
243
249
0 commit comments