Skip to content

Commit e467355

Browse files
authored
Merge pull request #418 from easyops-cn/steve/parse-module
fix(): fix elevo theme variant
2 parents c71800f + ec661da commit e467355

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ export function LowLevelChatHistory(
366366
<WrappedMiniActions
367367
className="actions"
368368
actions={projectActions}
369+
themeVariant="elevo"
369370
onActionClick={(e) => {
370371
onProjectActionClick({ action: e.detail, project });
371372
}}

bricks/ai-portal/src/elevo-sidebar/bricks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export const WrappedEasyopsAvatar = wrapBrick<
3939
>("eo-easyops-avatar");
4040
export const WrappedMiniActions = wrapBrick<
4141
EoMiniActions,
42-
EoMiniActionsProps,
42+
EoMiniActionsProps & { themeVariant?: "default" | "elevo" },
4343
EoMiniActionsEvents,
4444
EoMiniActionsEventsMapping
4545
>("eo-mini-actions", {

bricks/ai-portal/src/show-case/index.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useMemo } from "react";
22
import { createDecorators } from "@next-core/element";
33
import { ReactNextElement, wrapBrick } from "@next-core/react-element";
44
import "@next-core/theme";
@@ -54,11 +54,19 @@ class ShowCase extends ReactNextElement implements ShowCaseProps {
5454
}
5555

5656
function ShowCaseComponent({ caseTitle, summary, url }: ShowCaseProps) {
57+
const bgClass = useMemo(() => {
58+
// Get a deterministic class based on the caseTitle
59+
if (!caseTitle) return bgClasses[0];
60+
let hash = 0;
61+
for (let i = 0; i < caseTitle.length; i++) {
62+
hash = caseTitle.charCodeAt(i) + ((hash << 5) - hash);
63+
}
64+
const index = Math.abs(hash) % bgClasses.length;
65+
return bgClasses[index];
66+
}, [caseTitle]);
67+
5768
return (
58-
<WrappedLink
59-
className={`link ${bgClasses[Math.floor(Math.random() * bgClasses.length)]}`}
60-
url={url}
61-
>
69+
<WrappedLink className={`link ${bgClass}`} url={url}>
6270
<span className="title">{caseTitle}</span>
6371
<span className="description">{summary}</span>
6472
<span className="mask" />

shared/tsx-converter/lib/components.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export interface NumberInputProps extends InputProps {
9292
export interface TextareaProps extends InputProps {}
9393

9494
export interface SelectProps extends InputProps {
95-
options: FormItemOptions[];
95+
options: (FormItemOptions | string)[];
9696
onChange?: (e: CustomEvent<string | number | boolean | null>) => void;
9797
}
9898

0 commit comments

Comments
 (0)