Skip to content

Commit 779e6a5

Browse files
committed
Address code review comments to improve ApplyButton
1 parent 86e6060 commit 779e6a5

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

packages/host/app/components/ai-assistant/apply-button/index.gts

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const AiAssistantApplyButton: TemplateOnlyComponent<Signature> = <template>
4545
@size='small'
4646
class='apply-button'
4747
tabindex='-1'
48+
disabled
4849
{{setCssVar boxel-button-text-color='var(--boxel-200)'}}
4950
data-test-apply-state='preparing'
5051
...attributes
@@ -94,6 +95,9 @@ const AiAssistantApplyButton: TemplateOnlyComponent<Signature> = <template>
9495
border: 0;
9596
min-width: 74px;
9697
}
98+
.state-indicator.preparing .apply-button:disabled {
99+
opacity: 1;
100+
}
97101
.state-indicator.preparing .apply-button:focus {
98102
--boxel-button-color: inherit;
99103
filter: none;

packages/host/app/components/ai-assistant/apply-button/usage.gts

+9-6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ import FreestyleUsage from 'ember-freestyle/components/freestyle/usage';
88

99
import ApplyButton, { type ApplyButtonState } from './index';
1010

11+
let noop = () => {};
12+
1113
export default class AiAssistantApplyButtonUsage extends Component {
1214
@tracked state: ApplyButtonState = 'ready';
1315

14-
@action handleApplyButtonClick() {
16+
@action cycleState() {
1517
switch (this.state) {
1618
case 'ready':
1719
this.state = 'applying';
@@ -37,11 +39,12 @@ export default class AiAssistantApplyButtonUsage extends Component {
3739
ready, applying, applied, failed, and preparing states.
3840
</:description>
3941
<:example>
40-
<div class='example-container'>
41-
<ApplyButton
42-
@state={{this.state}}
43-
{{on 'click' this.handleApplyButtonClick}}
44-
/>
42+
<div
43+
class='example-container'
44+
style='--ai-bot-message-background-color: #3b394b;'
45+
{{on 'click' this.cycleState}}
46+
>
47+
<ApplyButton @state={{this.state}} {{on 'click' noop}} />
4548
</div>
4649
</:example>
4750
<:api as |Args|>

packages/host/app/components/matrix/preparing-room-message-command.gts

-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ const RoomMessageCommand: TemplateOnlyComponent<Signature> = <template>
1313
</div>
1414
</div>
1515

16-
{{! template-lint-disable no-whitespace-for-layout }}
17-
{{! ignore the above error because ember-template-lint complains about the whitespace in the multi-line comment below }}
1816
<style scoped>
1917
.command-button-bar {
2018
display: flex;

0 commit comments

Comments
 (0)