Skip to content

Commit 4ff9c8d

Browse files
authored
Merge pull request #480 from easyops-cn/steve/chat-panel
Steve/chat-panel
2 parents deea44c + ba89adf commit 4ff9c8d

File tree

5 files changed

+51
-10
lines changed

5 files changed

+51
-10
lines changed

bricks/ai-portal/src/chat-input/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ export interface ChatInputProps {
7575
submitDisabled?: boolean;
7676
supportsTerminate?: boolean;
7777
terminating?: boolean;
78+
autoFade?: boolean;
7879
uploadOptions?: UploadOptions;
7980
aiEmployees?: AIEmployee[];
8081
commands?: Command[];
@@ -117,6 +118,9 @@ class ChatInput extends ReactNextElement implements ChatInputProps {
117118
@property({ type: Boolean })
118119
accessor terminating: boolean | undefined;
119120

121+
@property({ type: Boolean, render: false })
122+
accessor autoFade: boolean | undefined;
123+
120124
@property({ attribute: false })
121125
accessor uploadOptions: UploadOptions | undefined;
122126

bricks/ai-portal/src/chat-input/styles.shadow.css

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,29 @@ button {
2424
}
2525

2626
.container {
27+
position: relative;
2728
background-color: #fff;
28-
border: 2px solid #7891ff;
29+
border: 2px solid transparent;
2930
border-radius: 12px;
31+
background-image:
32+
linear-gradient(#fff, #fff),
33+
linear-gradient(
34+
338deg,
35+
rgba(198, 183, 247, 1),
36+
rgba(157, 198, 255, 1),
37+
rgba(153, 196, 255, 1)
38+
);
39+
background-origin: border-box;
40+
background-clip: padding-box, border-box;
3041
box-shadow:
3142
0px 9px 28px 8px rgba(0, 0, 0, 0.05),
3243
0px 6px 16px 0px rgba(0, 0, 0, 0.08),
3344
0px 3px 6px -4px rgba(0, 0, 0, 0.12);
3445
cursor: text;
3546
}
3647

37-
.container:not(:has(textarea:focus)) {
38-
background-color: rgba(255, 255, 255, 0.5);
48+
:host([auto-fade]) .container:not(:has(textarea:focus)) {
49+
background: rgba(255, 255, 255, 0.5);
3950
border-color: #99c4ff;
4051
backdrop-filter: blur(10px);
4152
}

bricks/ai-portal/src/elevo-sidebar/SpaceNav.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ import { NavLink } from "./NavLink.js";
88
import type { SidebarLink } from "./interfaces.js";
99
import { ADD_ICON, MODEL_ICON } from "./constants.js";
1010
import { useNavLinkActive } from "./useNavLinkActive.js";
11+
import type { GeneralIconProps } from "@next-bricks/icons/general-icon";
1112

1213
export interface SpaceNavProps {
1314
returnUrl: string;
1415
introUrl: string;
1516
spaceDetail: {
1617
instanceId: string;
1718
name: string;
19+
icon?: GeneralIconProps & {
20+
color?: string;
21+
};
1822
};
1923
spaceObjects?: SidebarLink[];
2024
spaceServiceflows?: SidebarLink[];
@@ -39,14 +43,26 @@ export function SpaceNav({
3943
const [serviceflowsCollapsed, setServiceflowsCollapsed] = useState(false);
4044
const introActive = useNavLinkActive(introUrl);
4145

46+
const avatarIcon = spaceDetail?.icon;
47+
const avatarColor = avatarIcon?.color || "gray";
48+
const { color, ...iconProps } = avatarIcon || {};
49+
4250
return (
4351
<>
4452
<WrappedLink url={returnUrl} className="return-link">
53+
<WrappedIcon className="icon" lib="lucide" icon="chevron-left" />
54+
<div
55+
className="avatar"
56+
style={{
57+
color: `var(--theme-${avatarColor}-color)`,
58+
}}
59+
>
60+
<WrappedIcon {...iconProps} />
61+
</div>
4562
<div className="heading">
4663
<div className="title">{spaceDetail?.name}</div>
4764
<div className="sub-title">{t(K.COLLABORATION_SPACES)}</div>
4865
</div>
49-
<WrappedIcon className="icon" lib="lucide" icon="arrow-left" />
5066
</WrappedLink>
5167
<div className="divider" />
5268
<div className="history" ref={rootRef}>

bricks/ai-portal/src/elevo-sidebar/styles.shadow.css

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,31 +395,40 @@
395395

396396
.title {
397397
font-weight: 500;
398-
font-size: 18px;
398+
font-size: 14px;
399399
}
400400

401401
.sub-title {
402402
font-size: 12px;
403-
color: #8c8c8c;
403+
color: rgba(0, 0, 0, 0.45);
404404
}
405405

406406
.icon {
407407
font-size: 16px;
408-
color: #8c8c8c;
408+
color: #646a73;
409409
}
410410

411-
&:not(:hover) .icon {
412-
display: none;
411+
.avatar {
412+
background: #fff;
413+
border-radius: 8px;
414+
border: 1px solid rgba(0, 0, 0, 0.1);
415+
width: 36px;
416+
height: 36px;
417+
display: flex;
418+
align-items: center;
419+
justify-content: center;
420+
font-size: 18px;
413421
}
414422
}
415423

416424
.return-link::part(link) {
417425
display: flex;
418426
align-items: center;
419427
justify-content: center;
428+
gap: 10px;
420429
padding: 6px 8px;
421430
border-radius: 8px;
422-
color: #000;
431+
color: #262626;
423432
}
424433

425434
.return-link::part(link):hover {

bricks/ai-portal/src/shared/ChatBox/ChatBox.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export function ChatBox({ state, canChat }: ChatBoxProps): JSX.Element {
4949
submitDisabled={!canChat}
5050
supportsTerminate={supports?.intercept}
5151
terminating={terminating}
52+
autoFade
5253
aiEmployees={aiEmployees}
5354
commands={commands}
5455
suggestionsPlacement="top"

0 commit comments

Comments
 (0)