Skip to content

Commit c6fe04c

Browse files
committed
evolutionBot
1 parent 58afdc0 commit c6fe04c

File tree

14 files changed

+277
-248
lines changed

14 files changed

+277
-248
lines changed

src/components/sidebar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ function Sidebar() {
8383
icon: Zap,
8484
children: [
8585
{
86-
id: "genericBot",
87-
title: t("sidebar.genericBot"),
88-
path: "generic",
86+
id: "evolutionBot",
87+
title: t("sidebar.evolutionBot"),
88+
path: "evolutionBot",
8989
},
9090
{
9191
id: "chatwoot",

src/pages/instance/GenericBot/DefaultSettingsGenericBot.tsx renamed to src/pages/instance/EvolutionBot/DefaultSettingsEvolutionBot.tsx

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ import { Input } from "@/components/ui/input";
2727
import { useInstance } from "@/contexts/InstanceContext";
2828

2929
import {
30-
findDefaultSettingsGenericBot,
31-
findGenericBot,
32-
setDefaultSettingsGenericBot,
33-
} from "@/services/genericBot.service";
30+
findDefaultSettingsEvolutionBot,
31+
findEvolutionBot,
32+
setDefaultSettingsEvolutionBot,
33+
} from "@/services/evolutionBot.service";
3434

3535
import {
36-
GenericBot,
37-
GenericBotSettings,
36+
EvolutionBot,
37+
EvolutionBotSettings,
3838
Instance,
3939
} from "@/types/evolution.types";
4040

@@ -60,12 +60,12 @@ const fetchData = async (
6060
const storedToken = localStorage.getItem("token");
6161

6262
if (storedToken && instance && instance.name) {
63-
const getSettings: GenericBotSettings[] =
64-
await findDefaultSettingsGenericBot(instance.name, storedToken);
63+
const getSettings: EvolutionBotSettings[] =
64+
await findDefaultSettingsEvolutionBot(instance.name, storedToken);
6565

6666
setSettings(getSettings);
6767

68-
const getBots: GenericBot[] = await findGenericBot(
68+
const getBots: EvolutionBot[] = await findEvolutionBot(
6969
instance.name,
7070
storedToken,
7171
);
@@ -79,21 +79,21 @@ const fetchData = async (
7979
}
8080
};
8181

82-
function DefaultSettingsGenericBot() {
82+
function DefaultSettingsEvolutionBot() {
8383
const { t } = useTranslation();
8484
const { instance } = useInstance();
8585

8686
const [open, setOpen] = useState(false);
87-
const [settings, setSettings] = useState<GenericBotSettings>();
88-
const [bots, setBots] = useState<GenericBot[]>([]);
87+
const [settings, setSettings] = useState<EvolutionBotSettings>();
88+
const [bots, setBots] = useState<EvolutionBot[]>([]);
8989

9090
const form = useForm<z.infer<typeof FormSchema>>({
9191
resolver: zodResolver(FormSchema),
9292
defaultValues: {
9393
expire: "0",
94-
keywordFinish: t("genericBot.form.examples.keywordFinish"),
94+
keywordFinish: t("evolutionBot.form.examples.keywordFinish"),
9595
delayMessage: "1000",
96-
unknownMessage: t("genericBot.form.examples.unknownMessage"),
96+
unknownMessage: t("evolutionBot.form.examples.unknownMessage"),
9797
listeningFromMe: false,
9898
stopBotFromMe: false,
9999
keepOpen: false,
@@ -135,7 +135,7 @@ function DefaultSettingsGenericBot() {
135135
throw new Error("instance not found.");
136136
}
137137

138-
const settingsData: GenericBotSettings = {
138+
const settingsData: EvolutionBotSettings = {
139139
expire: parseInt(data.expire),
140140
keywordFinish: data.keywordFinish,
141141
delayMessage: parseInt(data.delayMessage),
@@ -148,12 +148,12 @@ function DefaultSettingsGenericBot() {
148148
ignoreJids: data.ignoreJids,
149149
};
150150

151-
await setDefaultSettingsGenericBot(
151+
await setDefaultSettingsEvolutionBot(
152152
instance.name,
153153
instance.token,
154154
settingsData,
155155
);
156-
toast.success(t("genericBot.toast.defaultSettings.success"));
156+
toast.success(t("evolutionBot.toast.defaultSettings.success"));
157157
// eslint-disable-next-line @typescript-eslint/no-explicit-any
158158
} catch (error: any) {
159159
console.error("Error:", error);
@@ -171,7 +171,7 @@ function DefaultSettingsGenericBot() {
171171
<Button variant="secondary" size="sm">
172172
<Cog size={16} className="mr-1" />
173173
<span className="hidden sm:inline">
174-
{t("genericBot.defaultSettings")}
174+
{t("evolutionBot.defaultSettings")}
175175
</span>
176176
</Button>
177177
</DialogTrigger>
@@ -180,7 +180,7 @@ function DefaultSettingsGenericBot() {
180180
onCloseAutoFocus={onReset}
181181
>
182182
<DialogHeader>
183-
<DialogTitle>{t("genericBot.defaultSettings")}</DialogTitle>
183+
<DialogTitle>{t("evolutionBot.defaultSettings")}</DialogTitle>
184184
</DialogHeader>
185185
<FormProvider {...form}>
186186
<form
@@ -191,7 +191,7 @@ function DefaultSettingsGenericBot() {
191191
<div className="space-y-4">
192192
<FormSelect
193193
name="botIdFallback"
194-
label={t("genericBot.form.botIdFallback.label")}
194+
label={t("evolutionBot.form.botIdFallback.label")}
195195
options={
196196
bots
197197
?.filter((bot) => !!bot.id)
@@ -203,59 +203,59 @@ function DefaultSettingsGenericBot() {
203203
/>
204204
<FormInput
205205
name="expire"
206-
label={t("genericBot.form.expire.label")}
206+
label={t("evolutionBot.form.expire.label")}
207207
>
208208
<Input type="number" />
209209
</FormInput>
210210
<FormInput
211211
name="keywordFinish"
212-
label={t("genericBot.form.keywordFinish.label")}
212+
label={t("evolutionBot.form.keywordFinish.label")}
213213
>
214214
<Input />
215215
</FormInput>
216216
<FormInput
217217
name="delayMessage"
218-
label={t("genericBot.form.delayMessage.label")}
218+
label={t("evolutionBot.form.delayMessage.label")}
219219
>
220220
<Input type="number" />
221221
</FormInput>
222222
<FormInput
223223
name="unknownMessage"
224-
label={t("genericBot.form.unknownMessage.label")}
224+
label={t("evolutionBot.form.unknownMessage.label")}
225225
>
226226
<Input />
227227
</FormInput>
228228
<FormSwitch
229229
name="listeningFromMe"
230-
label={t("genericBot.form.listeningFromMe.label")}
230+
label={t("evolutionBot.form.listeningFromMe.label")}
231231
reverse
232232
/>
233233
<FormSwitch
234234
name="stopBotFromMe"
235-
label={t("genericBot.form.stopBotFromMe.label")}
235+
label={t("evolutionBot.form.stopBotFromMe.label")}
236236
reverse
237237
/>
238238
<FormSwitch
239239
name="keepOpen"
240-
label={t("genericBot.form.keepOpen.label")}
240+
label={t("evolutionBot.form.keepOpen.label")}
241241
reverse
242242
/>
243243
<FormInput
244244
name="debounceTime"
245-
label={t("genericBot.form.debounceTime.label")}
245+
label={t("evolutionBot.form.debounceTime.label")}
246246
>
247247
<Input type="number" />
248248
</FormInput>
249249

250250
<FormTags
251251
name="ignoreJids"
252-
label={t("genericBot.form.ignoreJids.label")}
253-
placeholder={t("genericBot.form.ignoreJids.placeholder")}
252+
label={t("evolutionBot.form.ignoreJids.label")}
253+
placeholder={t("evolutionBot.form.ignoreJids.placeholder")}
254254
/>
255255
</div>
256256
</div>
257257
<DialogFooter>
258-
<Button type="submit">{t("genericBot.button.save")}</Button>
258+
<Button type="submit">{t("evolutionBot.button.save")}</Button>
259259
</DialogFooter>
260260
</form>
261261
</FormProvider>
@@ -264,4 +264,4 @@ function DefaultSettingsGenericBot() {
264264
);
265265
}
266266

267-
export { DefaultSettingsGenericBot };
267+
export { DefaultSettingsEvolutionBot };

0 commit comments

Comments
 (0)