Skip to content

Commit e323647

Browse files
authored
feat(amazonq): Update quick action styles and grouping (#4357)
* updated quick action styles and grouping fixed webview doesn't fit to parent panel * added css to loader configuration
1 parent 7c080a0 commit e323647

File tree

8 files changed

+99
-46
lines changed

8 files changed

+99
-46
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "bugfix",
3+
"description" : "Amazon Q Chat: Q panel doesn't fit to its parent"
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type" : "feature",
3+
"description" : "Amazon Q Chat: Updates quick action commands style and groupings"
4+
}

plugins/amazonq/mynah-ui/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugins/amazonq/mynah-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"lintfix": "eslint -c .eslintrc.js --fix --ext .ts ."
1313
},
1414
"dependencies": {
15-
"@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.5.6",
15+
"@aws/mynah-ui-chat": "npm:@aws/mynah-ui@4.6.4",
1616
"@types/node": "^14.18.5",
1717
"fs-extra": "^10.0.1",
1818
"ts-node": "^10.7.0",

plugins/amazonq/mynah-ui/src/mynah-ui/ui/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import { Connector } from './connector'
66
import { ChatItem, ChatItemType, MynahUI, MynahUIDataModel, NotificationType } from '@aws/mynah-ui-chat'
77
import './styles/dark.scss'
8-
import { ChatPrompt } from '@aws/mynah-ui-chat/dist/static'
98
import { TabsStorage, TabType } from './storages/tabsStorage'
109
import { WelcomeFollowupType } from './apps/amazonqCommonsConnector'
1110
import { TabDataGenerator } from './tabs/generator'
@@ -17,6 +16,7 @@ import { TextMessageHandler } from './messages/handler'
1716
import { MessageController } from './messages/controller'
1817
import {getActions, getDetails} from "./diffTree/actions";
1918
import {DiffTreeFileInfo} from "./diffTree/types";
19+
import './styles.css';
2020

2121
export const createMynahUI = (ideApi: any, featureDevInitEnabled: boolean, codeTransformInitEnabled: boolean) => {
2222
// eslint-disable-next-line prefer-const
@@ -99,7 +99,7 @@ export const createMynahUI = (ideApi: any, featureDevInitEnabled: boolean, codeT
9999
}
100100
}
101101
},
102-
onFileActionClick: (tabID: string, messageId: string, filePath: string, actionName: string): void => {},
102+
onFileActionClick: (): void => {},
103103
onCWCOnboardingPageInteractionMessage: (message: ChatItem): string | undefined => {
104104
return messageController.sendMessageToTab(message, 'cwc')
105105
},

plugins/amazonq/mynah-ui/src/mynah-ui/ui/quickActions/generator.ts

Lines changed: 70 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import { QuickActionCommandGroup } from '@aws/mynah-ui-chat/dist/static'
6+
import {QuickActionCommand, QuickActionCommandGroup} from '@aws/mynah-ui-chat/dist/static'
77
import { TabType } from '../storages/tabsStorage'
88

99
export interface QuickActionGeneratorProps {
@@ -21,51 +21,83 @@ export class QuickActionGenerator {
2121
}
2222

2323
public generateForTab(tabType: TabType): QuickActionCommandGroup[] {
24-
switch (tabType) {
25-
case 'featuredev':
26-
return []
27-
default:
28-
return [
24+
const quickActionCommands = [
25+
{
26+
commands: [
2927
...(this.isFeatureDevEnabled
3028
? [
31-
{
32-
groupName: 'Application Development',
33-
commands: [
34-
{
35-
command: '/dev',
36-
placeholder: 'Briefly describe a task or issue',
37-
description:
38-
'Use all project files as context for code suggestions (increases latency).',
39-
},
40-
],
41-
},
42-
]
29+
{
30+
command: '/dev',
31+
placeholder: 'Briefly describe a task or issue',
32+
description:
33+
'Use all project files as context for code suggestions (increases latency).',
34+
},
35+
]
4336
: []),
4437
...(this.isCodeTransformEnabled
4538
? [
46-
{
47-
commands: [
48-
{
49-
command: '/transform',
50-
description: 'Transform your Java 8 or 11 Maven project to Java 17',
51-
},
52-
],
53-
},
54-
]
55-
: []),
56-
{
57-
commands: [
58-
{
59-
command: '/help',
60-
description: 'Learn more about Amazon Q',
61-
},
6239
{
63-
command: '/clear',
64-
description: 'Clear this session',
40+
command: '/transform',
41+
description: 'Transform your Java 8 or 11 Maven project to Java 17',
6542
},
66-
],
43+
]
44+
: []),
45+
],
46+
},
47+
{
48+
commands: [
49+
{
50+
command: '/help',
51+
description: 'Learn more about Amazon Q',
52+
},
53+
{
54+
command: '/clear',
55+
description: 'Clear this session',
6756
},
68-
]
57+
],
58+
},
59+
]
60+
61+
const commandUnavailability: Record<
62+
TabType,
63+
{
64+
description: string
65+
unavailableItems: string[]
66+
}
67+
> = {
68+
cwc: {
69+
description: '',
70+
unavailableItems: [],
71+
},
72+
featuredev: {
73+
description: "This command isn't available in /dev",
74+
unavailableItems: ['/dev', '/transform', '/help', '/clear'],
75+
},
76+
codetransform: {
77+
description: "This command isn't available in /transform",
78+
unavailableItems: ['/dev', '/transform'],
79+
},
80+
unknown: {
81+
description: '',
82+
unavailableItems: [],
83+
},
6984
}
85+
86+
return quickActionCommands.map((commandGroup: QuickActionCommandGroup) => {
87+
return {
88+
commands: commandGroup.commands.map((commandItem: QuickActionCommand) => {
89+
const commandNotAvailable = commandUnavailability[tabType].unavailableItems.includes(
90+
commandItem.command
91+
)
92+
return {
93+
...commandItem,
94+
disabled: commandNotAvailable,
95+
description: commandNotAvailable
96+
? commandUnavailability[tabType].description
97+
: commandItem.description,
98+
}
99+
}) as QuickActionCommand[],
100+
}
101+
}) as QuickActionCommandGroup[]
70102
}
71103
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* Copyright 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2+
/* SPDX-License-Identifier: Apache-2.0 */
3+
4+
body,
5+
html {
6+
background-color: var(--mynah-color-bg);
7+
color: var(--mynah-color-text-default);
8+
height: 100%;
9+
width: 100%;
10+
overflow: hidden;
11+
margin: 0;
12+
padding: 0;
13+
}

plugins/amazonq/mynah-ui/webpack.media.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const config = {
3535
experiments: { asyncWebAssembly: true },
3636
module: {
3737
rules: [
38-
{test: /\.scss$/, use: ['style-loader', 'css-loader', 'sass-loader']},
38+
{test: /\.(sa|sc|c)ss$/, use: ['style-loader', 'css-loader', 'sass-loader']},
3939
{
4040
test: /\.ts$/,
4141
exclude: /node_modules/,

0 commit comments

Comments
 (0)