Skip to content

Commit 11bb844

Browse files
committed
complete chat styles
1 parent 5875702 commit 11bb844

7 files changed

Lines changed: 63 additions & 4 deletions

File tree

client/packages/lowcoder/src/comps/comps/chatComp/chatComp.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
ChatInputStyle,
2828
ChatSendButtonStyle,
2929
ChatNewThreadButtonStyle,
30+
ChatThreadItemStyle,
3031
} from "comps/controls/styleControlConstants";
3132
import { AnimationStyle } from "comps/controls/styleControlConstants";
3233

@@ -176,6 +177,7 @@ export const chatChildrenMap = {
176177
inputStyle: styleControl(ChatInputStyle),
177178
sendButtonStyle: styleControl(ChatSendButtonStyle),
178179
newThreadButtonStyle: styleControl(ChatNewThreadButtonStyle),
180+
threadItemStyle: styleControl(ChatThreadItemStyle),
179181
animationStyle: styleControl(AnimationStyle),
180182

181183
// Exposed Variables (not shown in Property View)
@@ -301,6 +303,7 @@ const ChatTmpComp = new UICompBuilder(
301303
inputStyle={props.inputStyle}
302304
sendButtonStyle={props.sendButtonStyle}
303305
newThreadButtonStyle={props.newThreadButtonStyle}
306+
threadItemStyle={props.threadItemStyle}
304307
animationStyle={props.animationStyle}
305308
/>
306309
);

client/packages/lowcoder/src/comps/comps/chatComp/chatPropertyView.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ export const ChatPropertyView = React.memo((props: any) => {
118118
{children.newThreadButtonStyle.getPropertyView()}
119119
</Section>
120120

121+
<Section name={trans("chat.threadItemStyle")}>
122+
{children.threadItemStyle.getPropertyView()}
123+
</Section>
124+
121125
<Section name={sectionNames.animationStyle} hasTooltip={true}>
122126
{children.animationStyle.getPropertyView()}
123127
</Section>

client/packages/lowcoder/src/comps/comps/chatComp/components/ChatCore.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export function ChatCore({
2525
inputStyle,
2626
sendButtonStyle,
2727
newThreadButtonStyle,
28+
threadItemStyle,
2829
animationStyle
2930
}: ChatCoreProps) {
3031
return (
@@ -44,6 +45,7 @@ export function ChatCore({
4445
inputStyle={inputStyle}
4546
sendButtonStyle={sendButtonStyle}
4647
newThreadButtonStyle={newThreadButtonStyle}
48+
threadItemStyle={threadItemStyle}
4749
animationStyle={animationStyle}
4850
/>
4951
</ChatProvider>

client/packages/lowcoder/src/comps/comps/chatComp/components/ChatCoreMain.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ const ChatContainer = styled.div<{
3636
$inputStyle?: any;
3737
$sendButtonStyle?: any;
3838
$newThreadButtonStyle?: any;
39+
$threadItemStyle?: any;
3940
$animationStyle?: any;
4041
}>`
4142
display: flex;
@@ -106,7 +107,7 @@ const ChatContainer = styled.div<{
106107
}
107108
108109
/* New Thread Button Styles */
109-
.aui-thread-list-root button[type="button"]:first-child {
110+
.aui-thread-list-root > button {
110111
background-color: ${(props) => props.$newThreadButtonStyle?.newThreadBackground || "#3b82f6"} !important;
111112
color: ${(props) => props.$newThreadButtonStyle?.newThreadText || "#ffffff"} !important;
112113
border-color: ${(props) => props.$newThreadButtonStyle?.newThreadBackground || "#3b82f6"} !important;
@@ -116,10 +117,14 @@ const ChatContainer = styled.div<{
116117
.aui-thread-list-item {
117118
cursor: pointer;
118119
transition: background-color 0.2s ease;
120+
background-color: ${(props) => props.$threadItemStyle?.threadItemBackground || "transparent"};
121+
color: ${(props) => props.$threadItemStyle?.threadItemText || "inherit"};
122+
border: 1px solid ${(props) => props.$threadItemStyle?.threadItemBorder || "transparent"};
119123
120124
&[data-active="true"] {
121-
background-color: #dbeafe;
122-
border: 1px solid #bfdbfe;
125+
background-color: ${(props) => props.$threadItemStyle?.activeThreadBackground || "#dbeafe"};
126+
color: ${(props) => props.$threadItemStyle?.activeThreadText || "inherit"};
127+
border: 1px solid ${(props) => props.$threadItemStyle?.activeThreadBorder || "#bfdbfe"};
123128
}
124129
}
125130
`;
@@ -145,6 +150,7 @@ interface ChatCoreMainProps {
145150
inputStyle?: any;
146151
sendButtonStyle?: any;
147152
newThreadButtonStyle?: any;
153+
threadItemStyle?: any;
148154
animationStyle?: any;
149155
}
150156

@@ -164,6 +170,7 @@ export function ChatCoreMain({
164170
inputStyle,
165171
sendButtonStyle,
166172
newThreadButtonStyle,
173+
threadItemStyle,
167174
animationStyle
168175
}: ChatCoreMainProps) {
169176
const { state, actions } = useChatContext();
@@ -401,6 +408,7 @@ export function ChatCoreMain({
401408
$inputStyle={inputStyle}
402409
$sendButtonStyle={sendButtonStyle}
403410
$newThreadButtonStyle={newThreadButtonStyle}
411+
$threadItemStyle={threadItemStyle}
404412
$animationStyle={animationStyle}
405413
>
406414
<ThreadList />

client/packages/lowcoder/src/comps/comps/chatComp/types/chatTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export interface ChatCoreProps {
8989
inputStyle?: any;
9090
sendButtonStyle?: any;
9191
newThreadButtonStyle?: any;
92+
threadItemStyle?: any;
9293
animationStyle?: any;
9394
}
9495

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,39 @@ export const ChatNewThreadButtonStyle = [
24892489
},
24902490
] as const;
24912491

2492+
export const ChatThreadItemStyle = [
2493+
{
2494+
name: "threadItemBackground",
2495+
label: trans("style.threadItemBackground"),
2496+
color: "transparent",
2497+
},
2498+
{
2499+
name: "threadItemText",
2500+
label: trans("style.threadItemText"),
2501+
color: "inherit",
2502+
},
2503+
{
2504+
name: "threadItemBorder",
2505+
label: trans("style.threadItemBorder"),
2506+
color: "transparent",
2507+
},
2508+
{
2509+
name: "activeThreadBackground",
2510+
label: trans("style.activeThreadBackground"),
2511+
color: "#dbeafe",
2512+
},
2513+
{
2514+
name: "activeThreadText",
2515+
label: trans("style.activeThreadText"),
2516+
color: "inherit",
2517+
},
2518+
{
2519+
name: "activeThreadBorder",
2520+
label: trans("style.activeThreadBorder"),
2521+
color: "#bfdbfe",
2522+
},
2523+
] as const;
2524+
24922525
export type QRCodeStyleType = StyleConfigType<typeof QRCodeStyle>;
24932526
export type TimeLineStyleType = StyleConfigType<typeof TimeLineStyle>;
24942527
export type AvatarStyleType = StyleConfigType<typeof AvatarStyle>;
@@ -2613,6 +2646,7 @@ export type ChatMessagesStyleType = StyleConfigType<typeof ChatMessagesStyle>;
26132646
export type ChatInputStyleType = StyleConfigType<typeof ChatInputStyle>;
26142647
export type ChatSendButtonStyleType = StyleConfigType<typeof ChatSendButtonStyle>;
26152648
export type ChatNewThreadButtonStyleType = StyleConfigType<typeof ChatNewThreadButtonStyle>;
2649+
export type ChatThreadItemStyleType = StyleConfigType<typeof ChatThreadItemStyle>;
26162650

26172651
export function widthCalculator(margin: string) {
26182652
const marginArr = margin?.trim().replace(/\s+/g, " ").split(" ") || "";

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,12 @@ export const en = {
615615
"sendButtonIcon": "Send Button Icon Color",
616616
"newThreadBackground": "New Thread Button Background",
617617
"newThreadText": "New Thread Button Text",
618+
"threadItemBackground": "Thread Item Background",
619+
"threadItemText": "Thread Item Text",
620+
"threadItemBorder": "Thread Item Border",
621+
"activeThreadBackground": "Active Thread Background",
622+
"activeThreadText": "Active Thread Text",
623+
"activeThreadBorder": "Active Thread Border",
618624

619625
"radiusTip": "Specifies the radius of the element's corners. Example: 5px, 50%, or 1em.",
620626
"gapTip": "Specifies the gap between rows and columns in a grid or flex container. Example: 10px, 1rem, or 5%.",
@@ -1507,7 +1513,8 @@ export const en = {
15071513
"messagesStyle": "Messages Style",
15081514
"inputStyle": "Input Field Style",
15091515
"sendButtonStyle": "Send Button Style",
1510-
"newThreadButtonStyle": "New Thread Button Style"
1516+
"newThreadButtonStyle": "New Thread Button Style",
1517+
"threadItemStyle": "Thread Item Style"
15111518
},
15121519

15131520
"chatBox": {

0 commit comments

Comments
 (0)