Skip to content

Commit c2286a8

Browse files
authored
style: improve ai native layout (#3495)
* style: improve ai native layout * style: improve chat * style: improve chat
1 parent 7ea550b commit c2286a8

9 files changed

Lines changed: 90 additions & 48 deletions

File tree

packages/ai-native/src/browser/chat/chat.module.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.ai_chat_view {
1+
#ai_chat_view {
22
display: flex;
33
flex-direction: column;
44
height: 100%;

packages/ai-native/src/browser/chat/chat.view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ export const AIChatView = observer(() => {
456456
}, [layoutService]);
457457

458458
return (
459-
<div className={styles.ai_chat_view}>
459+
<div id={styles.ai_chat_view}>
460460
<div className={styles.header_container}>
461461
<div className={styles.left}>
462462
<span className={styles.title}>{aiAssistantName}</span>

packages/ai-native/src/browser/components/components.module.less

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
height: 100%;
55
.stop {
66
position: absolute;
7-
bottom: -34px;
7+
bottom: -38px;
88
padding-top: 12px;
9-
// TODO
109
left: -8px;
1110
width: 105%;
1211
}
@@ -17,7 +16,7 @@
1716
font-size: 12px;
1817
color: var(--design-text-foreground);
1918
cursor: pointer;
20-
margin-left: 10px;
19+
margin: 4px 0 0 10px;
2120

2221
span {
2322
color: var(--design-text-foreground);
@@ -100,7 +99,7 @@
10099
border: 1px solid var(--kt-input-border);
101100
background-color: var(--design-chatInput-background);
102101
&.active {
103-
border-color: #3c8dff;
102+
border-color: rgba(60, 141, 255, 0.65);
104103
}
105104
.theme_container {
106105
padding: 8px 12px 2px;
@@ -192,7 +191,7 @@
192191
}
193192

194193
.block {
195-
margin: 0 8px;
194+
margin: 0 16px 0 8px;
196195
.ai_enhance_icon {
197196
background-color: var(--kt-icon-hoverBackground);
198197
}
@@ -216,7 +215,6 @@
216215
position: relative;
217216
border: none;
218217
background-color: transparent;
219-
box-sizing: border-box;
220218
:global {
221219
.kt-input-addon-after {
222220
align-items: flex-end;
@@ -305,6 +303,7 @@
305303
margin-top: 4px;
306304
.monaco_wrapper {
307305
position: relative;
306+
min-width: 130px;
308307
> pre {
309308
margin-bottom: 10px;
310309
}
@@ -509,12 +508,14 @@
509508
align-items: start;
510509
line-height: 22px;
511510
> * {
511+
display: block;
512512
margin-top: 4px;
513513
}
514514
}
515515
}
516516

517517
.markdown_container {
518+
line-height: 22px;
518519
h1,
519520
h2,
520521
h3,
@@ -535,16 +536,10 @@
535536
}
536537
}
537538

538-
.tree_container {
539-
background-color: var(--panel-background);
540-
border-radius: 8px;
541-
padding: 7px 0;
542-
}
543539
li {
544540
list-style: auto;
545541
}
546542
}
547-
548543
.tree_container {
549544
background-color: var(--panel-background);
550545
border-radius: 8px;

packages/ai-native/src/browser/layout/ai-layout.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,21 @@ export const AILayout = () => {
1111
return (
1212
<BoxPanel direction='top-to-bottom'>
1313
<SlotRenderer id='top' defaultSize={35} slot='top' z-index={2} />
14-
<SplitPanel id='main-horizontal-ai' flex={1} direction={'left-to-right'} useDomSize={true}>
15-
<SplitPanel id='main-horizontal' flex={1} flexGrow={1} direction={'left-to-right'} useDomSize={true}>
14+
<SplitPanel
15+
id='main-horizontal-ai'
16+
flex={1}
17+
direction={'left-to-right'}
18+
useDomSize={true}
19+
resizeHandleClassName={'design-slot_resize_horizontal'}
20+
>
21+
<SplitPanel
22+
id='main-horizontal'
23+
flex={1}
24+
flexGrow={1}
25+
direction={'left-to-right'}
26+
useDomSize={true}
27+
resizeHandleClassName={'design-slot_resize_horizontal'}
28+
>
1629
<SlotRenderer
1730
slot='left'
1831
isTabbar={true}

packages/ai-native/src/browser/layout/layout.module.less

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
padding-bottom: 38px;
6868
}
6969

70-
.rce-ai-msg {
70+
.rce-container-mbox.rce-ai-msg {
7171
margin: 8px 32px 8px 16px;
7272

7373
> .rce-mbox {
@@ -98,8 +98,12 @@
9898

9999
.rce-container-mbox {
100100
overflow: initial;
101-
// margin: 8px 16px;
102101
min-width: initial;
102+
margin: 8px 16px;
103+
}
104+
105+
.rce-container-mbox:nth-child(2) {
106+
margin-top: 8px !important;
103107
}
104108

105109
.rce-user-msg {
@@ -109,6 +113,7 @@
109113
margin-right: 0;
110114
margin-left: 0;
111115
max-width: 100%;
116+
box-sizing: border-box;
112117
}
113118
}
114119

@@ -119,6 +124,10 @@
119124
}
120125
}
121126

127+
.right_tab_renderer {
128+
border: none;
129+
}
130+
122131
.right_slot_container_wrap {
123132
height: 100%;
124133
display: flex;
@@ -129,11 +138,32 @@
129138
display: flex;
130139
align-items: center;
131140
justify-content: space-between;
132-
border-bottom: 1px solid var(--sideBar-border);
133141
padding: 0 10px;
142+
background-color: var(--editorGroupHeader-tabsBackground);
134143
}
135144

136145
.container {
137146
flex: 1;
138147
}
139148
}
149+
150+
.extra_bottom_icon {
151+
&:hover {
152+
background-color: transparent !important;
153+
opacity: 1;
154+
}
155+
156+
span {
157+
width: 32px;
158+
height: 32px;
159+
font-size: 16px;
160+
border-radius: 8px;
161+
display: flex;
162+
align-items: center;
163+
justify-content: center;
164+
165+
&:hover {
166+
background-color: var(--activityBar-activeBorder);
167+
}
168+
}
169+
}

packages/ai-native/src/browser/layout/tabbar.view.tsx

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
import cls from 'classnames';
2-
import React, { useCallback, useEffect } from 'react';
2+
import React, { useCallback, useEffect, useMemo } from 'react';
33

4-
import { ComponentRegistryInfo, SlotLocation, useContextMenus, useInjectable } from '@opensumi/ide-core-browser';
4+
import {
5+
AINativeConfigService,
6+
ComponentRegistryInfo,
7+
SlotLocation,
8+
useContextMenus,
9+
useInjectable,
10+
} from '@opensumi/ide-core-browser';
511
import { EDirection } from '@opensumi/ide-core-browser/lib/components';
612
import {
713
EnhanceIcon,
@@ -115,6 +121,7 @@ export const AIRightTabRenderer = ({
115121
components: ComponentRegistryInfo[];
116122
}) => {
117123
const tabbarService: TabbarService = useInjectable(TabbarServiceFactory)(SlotLocation.right);
124+
const aiNativeConfigService: AINativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
118125

119126
const handleClose = useCallback(() => {
120127
tabbarService.updateCurrentContainerId('');
@@ -143,9 +150,15 @@ export const AIRightTabRenderer = ({
143150
);
144151
}, []);
145152

153+
const rightTabRenderClassName = useMemo(
154+
() => (aiNativeConfigService.layout!.useMergeRightWithLeftPanel ? styles.right_tab_renderer : ''),
155+
[aiNativeConfigService],
156+
);
157+
146158
return (
147159
<DesignRightTabRenderer
148160
components={components}
161+
className={rightTabRenderClassName}
149162
tabbarView={() => <RightTabbarRenderer barSize={0} style={{ width: 0 }} />}
150163
tabpanelView={() => <BaseTabPanelView PanelView={ContainerViewFn} />}
151164
/>

packages/design/src/browser/layout/tabbar.view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export const DesignRightTabRenderer = ({
4040
tabpanelView?: FC<{}>;
4141
}) => (
4242
<RightTabRenderer
43-
className={cls(className, 'design_right_slot')}
43+
className={cls('design_right_slot', className)}
4444
components={components}
4545
tabbarView={tabbarView}
4646
tabpanelView={tabpanelView}

packages/design/src/browser/style/design.module.less

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ div[class*='design-editor_tab_block_container__'] {
514514
margin-right: 1px;
515515

516516
.design-tab_panel {
517-
border-right: none;
517+
border: none;
518518
}
519519

520520
.design-file_tree_node {
@@ -644,27 +644,6 @@ div[class*='design-editor_tab_block_container__'] {
644644
display: none;
645645
}
646646

647-
.design-extra_bottom_icon {
648-
&:hover {
649-
background-color: transparent !important;
650-
opacity: 1;
651-
}
652-
653-
span {
654-
width: 32px;
655-
height: 32px;
656-
font-size: 16px;
657-
border-radius: 8px;
658-
display: flex;
659-
align-items: center;
660-
justify-content: center;
661-
662-
&:hover {
663-
background-color: var(--activityBar-activeBorder);
664-
}
665-
}
666-
}
667-
668647
.design-outline_node {
669648
border-radius: 4px;
670649
}
@@ -689,7 +668,6 @@ div[class*='design-editor_tab_block_container__'] {
689668

690669
.design-left_tab_bar,
691670
.design-right_tab_bar {
692-
padding-top: 10px;
693671
border-right: none;
694672
border-top: none;
695673
width: 48px;
@@ -714,13 +692,16 @@ div[class*='design-editor_tab_block_container__'] {
714692
}
715693
}
716694
}
695+
696+
.design-right_tab_bar {
697+
padding-top: 10px;
698+
border-right: none;
699+
border-top: none;
700+
}
717701
}
718702

719703
:global(.design_right_slot) {
720704
background-color: var(--panel-background);
721-
border: 1px solid var(--sideBar-border);
722-
border-radius: 12px;
723-
overflow: hidden;
724705
height: 100%;
725706
}
726707

packages/design/src/browser/style/global.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,13 @@ html {
293293
background-color: var(--design-monaco-background) !important;
294294
}
295295
}
296+
297+
/**
298+
* layout 面板
299+
**/
300+
.design-slot_resize_horizontal {
301+
width: 2px;
302+
height: 100%;
303+
margin: 0 2px;
304+
position: relative;
305+
}

0 commit comments

Comments
 (0)