Skip to content

Commit 5336c7a

Browse files
fix: datapilot code block ui (#1452)
1 parent 058fed6 commit 5336c7a

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

webview_panels/src/modules/dataPilot/components/queryAnalysis/QueryAnalysis.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { QueryAnalysisCommands } from "./commands";
1010
import { AltimateIcon } from "@assets/icons";
1111
import { QueryAnalysisType } from "./types";
1212
import { useMemo } from "react";
13+
import classes from "../../datapilot.module.scss";
1314

1415
const QUERY_HAPPY_LIMIT = 10;
1516
const DefaultActions = [
@@ -52,7 +53,7 @@ const QueryAnalysis = (): JSX.Element | null => {
5253
<Stack direction="column">
5354
<DatapilotHeader />
5455

55-
<CodeBlock code={chat.query} language="sql" fileName={chat.fileName} />
56+
<CodeBlock code={chat.query} language="sql" fileName={chat.fileName} classname={classes.codeblock}/>
5657
{showLineLimitWarning ? (
5758
<Card>
5859
<CardTitle>

webview_panels/src/modules/dataPilot/datapilot.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,7 @@ body {
153153
}}
154154
}
155155
}
156+
157+
.codeblock{
158+
--code-bg: transparent;
159+
}

webview_panels/src/uiCore/components/codeblock/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,32 @@ interface Props {
1010
fileName?: string;
1111
showLineNumbers?: boolean;
1212
titleActions?: ReactNode;
13+
classname?: string;
1314
}
1415
const CodeBlockComponent = ({
1516
code,
1617
language,
1718
fileName,
1819
showLineNumbers,
1920
titleActions,
21+
classname
2022
}: Props): JSX.Element => {
2123
const {
2224
state: { theme },
2325
} = useAppContext();
2426
const codeBlockTheme = theme === Themes.Dark ? "dark" : "light";
27+
const editorTheme = theme === Themes.Dark ? "vsc-dark-plus" : "vs";
2528
return (
2629
<div className={classes.codeblock}>
2730
<CodeblockLib
2831
showLineNumbers={showLineNumbers}
2932
code={code}
3033
fileName={fileName}
3134
theme={codeBlockTheme}
35+
editorTheme={editorTheme}
3236
language={language}
3337
titleActions={titleActions}
38+
className={classname}
3439
/>
3540
</div>
3641
);

0 commit comments

Comments
 (0)