Skip to content

Commit 6393fe7

Browse files
committed
Lint
1 parent 98f7451 commit 6393fe7

File tree

6 files changed

+61
-48
lines changed

6 files changed

+61
-48
lines changed

services/web/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"@types/superagent": "^8.1.9",
7474
"copy-webpack-plugin": "^6.3.2",
7575
"eslint-config-react-app": "^7.0.1",
76-
"prettier": "3.3.3"
76+
"prettier": "^3.3.3"
7777
},
7878
"browser": {
7979
"crypto": false

services/web/src/components/bot/ActionProvider.tsx

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ interface State {
3434
type SetStateFunc = (stateUpdater: (state: State) => State) => void;
3535

3636
class ActionProvider {
37-
private createChatBotMessage: (message: string, options?: Partial<ChatBotMessage>) => ChatBotMessage;
37+
private createChatBotMessage: (
38+
message: string,
39+
options?: Partial<ChatBotMessage>,
40+
) => ChatBotMessage;
3841
private setState: SetStateFunc;
3942
private createClientMessage: (message: string) => ChatBotMessage;
4043

4144
constructor(
42-
createChatBotMessage: (message: string, options?: Partial<ChatBotMessage>) => ChatBotMessage,
45+
createChatBotMessage: (
46+
message: string,
47+
options?: Partial<ChatBotMessage>,
48+
) => ChatBotMessage,
4349
setStateFunc: SetStateFunc,
44-
createClientMessage: (message: string) => ChatBotMessage
50+
createClientMessage: (message: string) => ChatBotMessage,
4551
) {
4652
this.createChatBotMessage = createChatBotMessage;
4753
this.setState = setStateFunc;
@@ -54,7 +60,7 @@ class ActionProvider {
5460
{
5561
loading: true,
5662
terminateLoading: true,
57-
}
63+
},
5864
);
5965
this.addMessageToState(message);
6066
};
@@ -69,7 +75,7 @@ class ActionProvider {
6975
{
7076
loading: true,
7177
terminateLoading: true,
72-
}
78+
},
7379
);
7480
this.addMessageToState(message);
7581
} else {
@@ -88,7 +94,7 @@ class ActionProvider {
8894
{
8995
loading: true,
9096
terminateLoading: true,
91-
}
97+
},
9298
);
9399
this.addMessageToState(message);
94100
return;
@@ -110,7 +116,7 @@ class ActionProvider {
110116
{
111117
loading: true,
112118
terminateLoading: true,
113-
}
119+
},
114120
);
115121
this.addMessageToState(errormessage);
116122
return;
@@ -121,7 +127,7 @@ class ActionProvider {
121127
{
122128
loading: true,
123129
terminateLoading: true,
124-
}
130+
},
125131
);
126132
this.addMessageToState(successmessage);
127133
this.addInitializedToState();
@@ -144,7 +150,7 @@ class ActionProvider {
144150
{
145151
loading: true,
146152
terminateLoading: true,
147-
}
153+
},
148154
);
149155
this.addMessageToState(errormessage);
150156
return;
@@ -166,7 +172,7 @@ class ActionProvider {
166172
{
167173
loading: true,
168174
terminateLoading: true,
169-
}
175+
},
170176
);
171177
this.addMessageToState(message);
172178
} else {
@@ -175,7 +181,7 @@ class ActionProvider {
175181
{
176182
loading: true,
177183
terminateLoading: true,
178-
}
184+
},
179185
);
180186
this.addMessageToState(message);
181187
}
@@ -198,7 +204,7 @@ class ActionProvider {
198204
{
199205
loading: true,
200206
terminateLoading: true,
201-
}
207+
},
202208
);
203209
this.addMessageToState(errormessage);
204210
return;
@@ -209,7 +215,7 @@ class ActionProvider {
209215
{
210216
loading: true,
211217
terminateLoading: true,
212-
}
218+
},
213219
);
214220
this.addMessageToState(successmessage);
215221
this.addInitializedToState();

services/web/src/components/bot/Bot.tsx

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ import { APIService } from "../../constants/APIConstant";
2020
import MessageParser from "./MessageParser";
2121
import ActionProvider from "./ActionProvider";
2222
import Chatbot from "react-chatbot-kit";
23-
import {
24-
Row,
25-
Col,
26-
} from "antd";
23+
import { Row, Col } from "antd";
2724
import { Space } from "antd";
28-
import Icon, { CloseSquareOutlined, DeleteOutlined, WechatWorkOutlined } from "@ant-design/icons";
25+
import Icon, {
26+
CloseSquareOutlined,
27+
DeleteOutlined,
28+
WechatWorkOutlined,
29+
} from "@ant-design/icons";
2930
import "./chatbot.css";
3031

3132
const superagent = require("superagent");
@@ -39,7 +40,7 @@ const PandaSvg = (): JSX.Element => (
3940
</svg>
4041
);
4142

42-
const ChatIcon = ({ size = '26pt' }: { size?: string | number }) => (
43+
const ChatIcon = ({ size = "26pt" }: { size?: string | number }) => (
4344
<WechatWorkOutlined style={{ fontSize: size }} />
4445
);
4546

@@ -72,26 +73,34 @@ const ChatBotComponent: React.FC<ChatBotComponentProps> = (props) => {
7273

7374
const headerText = (): JSX.Element => {
7475
return (
75-
<div style={{ backgroundColor: "#04AA6D", color: "white", padding: "1px", borderRadius: "1px" }}>
76-
<Space style={{ margin: "5px" }}>
77-
&nbsp; &nbsp; Exploit CrapBot &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
78-
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
79-
<a
80-
style={{
81-
color: "white",
82-
fontWeight: "bold",
83-
background: "#0a5e9c",
84-
borderRadius: "0px",
85-
}}
86-
href="##"
87-
onClick={(e) => {
88-
e.preventDefault();
89-
toggleBot((prev) => !prev);
90-
}}
91-
>
92-
<CloseSquareOutlined style={{ margin: "2px" }} />
93-
</a>
94-
</Space>
76+
<div
77+
style={{
78+
backgroundColor: "#04AA6D",
79+
color: "white",
80+
padding: "1px",
81+
borderRadius: "1px",
82+
}}
83+
>
84+
<Space style={{ margin: "5px" }}>
85+
&nbsp; &nbsp; Exploit CrapBot &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
86+
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
87+
&nbsp;
88+
<a
89+
style={{
90+
color: "white",
91+
fontWeight: "bold",
92+
background: "#0a5e9c",
93+
borderRadius: "0px",
94+
}}
95+
href="##"
96+
onClick={(e) => {
97+
e.preventDefault();
98+
toggleBot((prev) => !prev);
99+
}}
100+
>
101+
<CloseSquareOutlined style={{ margin: "2px" }} />
102+
</a>
103+
</Space>
95104
</div>
96105
);
97106
};
@@ -142,7 +151,6 @@ const ChatBotComponent: React.FC<ChatBotComponentProps> = (props) => {
142151
state: chatbotState,
143152
};
144153

145-
146154
const saveMessages = (messages: any[]): void => {
147155
localStorage.setItem("chat_messages", JSON.stringify(messages));
148156
};
@@ -156,8 +164,6 @@ const ChatBotComponent: React.FC<ChatBotComponentProps> = (props) => {
156164
localStorage.removeItem("chat_messages");
157165
};
158166

159-
160-
161167
console.log("Config state", config_chatbot);
162168
return (
163169
<Row>
@@ -187,4 +193,4 @@ const ChatBotComponent: React.FC<ChatBotComponentProps> = (props) => {
187193
);
188194
};
189195

190-
export default ChatBotComponent;
196+
export default ChatBotComponent;

services/web/src/components/bot/MessageParser.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class MessageParser {
8080
this.state.initializationRequired = await this.initializationRequired();
8181
console.log("State init:", this.state);
8282
return this.actionProvider.handleInitialize(
83-
this.state.initializationRequired
83+
this.state.initializationRequired,
8484
);
8585
} else if (
8686
message_l === "clear" ||
@@ -91,7 +91,7 @@ class MessageParser {
9191
} else if (this.state.initializing) {
9292
return this.actionProvider.handleInitialized(
9393
message,
94-
this.state.accessToken
94+
this.state.accessToken,
9595
);
9696
} else if (this.state.initializationRequired) {
9797
return this.actionProvider.handleNotInitialized();

services/web/src/components/bot/config.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ interface Config {
3434
const config: Config = {
3535
initialMessages: [
3636
createChatBotMessage(
37-
`Hi, Welcome to crAPI! I'm ${botName}, and I'm here to be exploited.`, {}
37+
`Hi, Welcome to crAPI! I'm ${botName}, and I'm here to be exploited.`,
38+
{},
3839
),
3940
],
4041
botName,

0 commit comments

Comments
 (0)