Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/pages/instance/Chatwoot/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import { Chatwoot as ChatwootType } from "@/types/evolution.types";
const stringOrUndefined = z
.string()
.optional()
.transform((value) => (value === "" ? undefined : value));
.transform((value) => {
const trimmed = value?.trim();
return !trimmed || trimmed === "" ? undefined : trimmed;
});

const formSchema = z.object({
enabled: z.boolean(),
Expand Down Expand Up @@ -117,7 +120,7 @@ function Chatwoot() {
token: data.token,
url: data.url,
signMsg: data.signMsg || false,
signDelimiter: data.signDelimiter || "\\n",
signDelimiter: data.signDelimiter?.trim() || "\\n",
nameInbox: data.nameInbox || "",
organization: data.organization || "",
logo: data.logo || "",
Expand Down Expand Up @@ -196,6 +199,7 @@ function Chatwoot() {
/>
<FormSwitch name="reopenConversation" label={t("chatwoot.form.reopenConversation.label")} className="w-full justify-between" helper={t("chatwoot.form.reopenConversation.description")} />
<FormSwitch name="importContacts" label={t("chatwoot.form.importContacts.label")} className="w-full justify-between" helper={t("chatwoot.form.importContacts.description")} />
<FormSwitch name="mergeBrazilContacts" label={t("chatwoot.form.mergeBrazilContacts.label")} className="w-full justify-between" helper={t("chatwoot.form.mergeBrazilContacts.description")} />
<FormSwitch name="importMessages" label={t("chatwoot.form.importMessages.label")} className="w-full justify-between" helper={t("chatwoot.form.importMessages.description")} />
<FormInput name="daysLimitImportMessages" label={t("chatwoot.form.daysLimitImportMessages.label")}>
<Input type="number" />
Expand Down
3 changes: 3 additions & 0 deletions src/pages/instance/DashboardInstance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { CircleUser, MessageCircle, RefreshCw, UsersRound } from "lucide-react";
import { useEffect, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import QRCode from "react-qr-code";
import { toast } from "react-toastify";

import { InstanceStatus } from "@/components/instance-status";
import { InstanceToken } from "@/components/instance-token";
Expand Down Expand Up @@ -46,8 +47,10 @@ function DashboardInstance() {
try {
await restart(instanceName);
await reloadInstance();
toast.success(t("instance.dashboard.toast.restart.success"));
} catch (error) {
console.error("Error:", error);
toast.error(t("instance.dashboard.toast.restart.error"));
}
};

Expand Down
10 changes: 10 additions & 0 deletions src/translate/languages/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
"restart": "Restart",
"disconnect": "Disconnect"
},
"toast": {
"restart": {
"success": "Instance restarted successfully",
"error": "Error restarting instance"
}
},
"alert": "To connect, scan the QR code with your WhatsApp Web",
"contacts": "Contacts",
"chats": "Chats",
Expand Down Expand Up @@ -369,6 +375,10 @@
"label": "Import Contacts",
"description": "Import contacts from WhatsApp address book by connecting QR Code"
},
"mergeBrazilContacts": {
"label": "Merge Brazil Contacts",
"description": "Merge Brazilian contacts with and without country code (55)"
},
"importMessages": {
"label": "Import Messages",
"description": "Import messages from WhatsApp by connecting QR Code"
Expand Down
10 changes: 10 additions & 0 deletions src/translate/languages/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
"restart": "Reiniciar",
"disconnect": "Desconectar"
},
"toast": {
"restart": {
"success": "Instancia reiniciada con éxito",
"error": "Error al reiniciar instancia"
}
},
"alert": "Para conectar, escanea el Código QR con WhatsApp",
"contacts": "Contactos",
"chats": "Chats",
Expand Down Expand Up @@ -349,6 +355,10 @@
"label": "Importar Contactos",
"description": "Importar contactos del libro de direcciones de WhatsApp al conectar el Código QR"
},
"mergeBrazilContacts": {
"label": "Fusionar Contactos Brasil",
"description": "Fusiona contactos brasileños con y sin código de país (55)"
},
"importMessages": {
"label": "Importar Mensajes",
"description": "Importar mensajes de WhatsApp al conectar el Código QR"
Expand Down
10 changes: 10 additions & 0 deletions src/translate/languages/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@
"restart": "Reiniciar",
"disconnect": "Desconectar"
},
"toast": {
"restart": {
"success": "Instância reiniciada com sucesso",
"error": "Erro ao reiniciar instância"
}
},
"alert": "Para conectar, escaneie o QR Code com o WhatsApp",
"contacts": "Contatos",
"chats": "Chats",
Expand Down Expand Up @@ -349,6 +355,10 @@
"label": "Importar Contatos",
"description": "Importar contatos da agenda do WhatsApp ao conectar o QR Code"
},
"mergeBrazilContacts": {
"label": "Mesclar Contatos Brasil",
"description": "Mescla contatos brasileiros com e sem código de país (55)"
},
"importMessages": {
"label": "Importar Mensagens",
"description": "Importar mensagens do WhatsApp ao conectar o QR Code"
Expand Down
Loading