Skip to content

Commit 9e6e738

Browse files
author
smallstone
committed
Refactor MessageMarkdown and StopButton components
1 parent 80ee13a commit 9e6e738

File tree

2 files changed

+45
-44
lines changed

2 files changed

+45
-44
lines changed

src/views/components/MessageMarkdown/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ Generate a professionally written and formatted release note in markdown with th
380380
},
381381
}}
382382
>
383-
{children}
383+
{trasnlateChildren}
384384
</ReactMarkdown>
385385
);
386386
});
Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,50 @@
1-
import * as React from 'react';
2-
import { Button } from '@mantine/core';
3-
import { IconPlayerStop } from '@tabler/icons-react';
4-
import messageUtil from '@/util/MessageUtil';
1+
import * as React from "react";
2+
import { Button } from "@mantine/core";
3+
import { IconPlayerStop } from "@tabler/icons-react";
4+
import messageUtil from "@/util/MessageUtil";
55
import { observer } from "mobx-react-lite";
66
import { useMst } from "@/views/stores/RootStore";
77

8-
98
const StopButton = observer(() => {
10-
const { chat } = useMst();
11-
return (
12-
<Button
13-
size="xs"
14-
sx={{
15-
backgroundColor:"#ED6A45",
16-
fontFamily: 'var(--vscode-editor-font-familyy)',
17-
fontSize: 'var(--vscode-editor-font-size)',
18-
color:"#fff",
19-
"&:hover":{
20-
backgroundColor:"#ED6A45",
21-
opacity: 0.8,
22-
},
23-
"&:focus":{
24-
backgroundColor:"#ED6A45",
25-
opacity: 0.8,
26-
}
27-
}}
28-
styles={{
29-
icon: {
30-
color:"#fff",
31-
},
32-
label: {
33-
fontSize: 'var(--vscode-editor-font-size)',
34-
color:"#fff",
35-
}
36-
}}
37-
leftIcon={<IconPlayerStop color='var(--vscode-button-foreground)' />}
38-
onClick={() => {
39-
chat.stopGenerating(false, '', chat.currentMessage);
40-
messageUtil.sendMessage({
41-
command: 'stopDevChat'
42-
});
43-
}}
44-
variant="white">
45-
Stop generating
46-
</Button>);
9+
const { chat } = useMst();
10+
return (
11+
<Button
12+
size="xs"
13+
sx={{
14+
backgroundColor: "#ED6A45",
15+
fontFamily: "var(--vscode-editor-font-familyy)",
16+
fontSize: "var(--vscode-editor-font-size)",
17+
color: "#fff",
18+
"&:hover": {
19+
backgroundColor: "#ED6A45",
20+
opacity: 0.8,
21+
},
22+
"&:focus": {
23+
backgroundColor: "#ED6A45",
24+
opacity: 0.8,
25+
},
26+
}}
27+
styles={{
28+
icon: {
29+
color: "#fff",
30+
},
31+
label: {
32+
fontSize: "var(--vscode-editor-font-size)",
33+
color: "#fff",
34+
},
35+
}}
36+
leftIcon={<IconPlayerStop color="#fff" />}
37+
onClick={() => {
38+
chat.stopGenerating(false, "", chat.currentMessage);
39+
messageUtil.sendMessage({
40+
command: "stopDevChat",
41+
});
42+
}}
43+
variant="white"
44+
>
45+
Stop generating
46+
</Button>
47+
);
4748
});
4849

49-
export default StopButton;
50+
export default StopButton;

0 commit comments

Comments
 (0)