- Aguardando
+ {i18n.t("tickets.tabs.open.pendingHeader")}
{countTickets("pending", null)}
@@ -495,8 +492,10 @@ const Tickets = () => {
showAllTickets={showAllTickets}
ticketId={ticketId}
handleAcepptTicket={handleAcepptTicket}
- noTicketsTitle="Tudo resolvido!"
- noTicketsMessage="Nenhum ticket pendente."
+ noTicketsTitle={i18n.t("tickets.tabs.open.pendingNoTicketsTitle")}
+ noTicketsMessage={i18n.t(
+ "tickets.tabs.open.pendingNoTicketsMessage"
+ )}
status="pending"
userId={null}
/>
@@ -541,8 +540,8 @@ const Tickets = () => {
showAllTickets={showAllTickets}
ticketId={ticketId}
handleAcepptTicket={handleAcepptTicket}
- noTicketsTitle="Nada encontrado!"
- noTicketsMessage="Tente buscar por outro termo."
+ noTicketsTitle={i18n.t("tickets.tabs.search.noTicketsTitle")}
+ noTicketsMessage={i18n.t("tickets.tabs.search.noTicketsMessage")}
status="all"
/>
{loading &&
}
diff --git a/frontend/src/components/TicketsList/index.js b/frontend/src/components/TicketsList/index.js
index fae0bcb..4051645 100644
--- a/frontend/src/components/TicketsList/index.js
+++ b/frontend/src/components/TicketsList/index.js
@@ -12,6 +12,8 @@ import Divider from "@material-ui/core/Divider";
import Badge from "@material-ui/core/Badge";
import Button from "@material-ui/core/Button";
+import { i18n } from "../../translate/i18n";
+
const useStyles = makeStyles(theme => ({
ticket: {
position: "relative",
@@ -185,7 +187,7 @@ const TicketsList = ({
className="hidden-button"
onClick={e => handleAcepptTicket(ticket.id)}
>
- Aceitar
+ {i18n.t("ticketsList.buttons.accept")}
) : null}
diff --git a/frontend/src/context/Auth/useAuth.js b/frontend/src/context/Auth/useAuth.js
index 3cd88da..e7611ea 100644
--- a/frontend/src/context/Auth/useAuth.js
+++ b/frontend/src/context/Auth/useAuth.js
@@ -3,6 +3,7 @@ import { useHistory } from "react-router-dom";
import { toast } from "react-toastify";
+import { i18n } from "../../translate/i18n";
import api from "../../services/api";
const useAuth = () => {
@@ -23,7 +24,6 @@ const useAuth = () => {
history.location.pathname === "/signup"
) {
setLoading(false);
-
return;
}
try {
@@ -35,7 +35,7 @@ const useAuth = () => {
} catch (err) {
setLoading(false);
setIsAuth(false);
- toast.error("Erro de autenticação. Por favor, faça login novamente");
+ toast.error(i18n.t("auth.toasts.fail"));
}
};
checkAuth();
@@ -50,9 +50,10 @@ const useAuth = () => {
localStorage.setItem("userId", res.data.userId);
api.defaults.headers.Authorization = `Bearer ${res.data.token}`;
setIsAuth(true);
+ toast.success(i18n.t("auth.toasts.success"));
history.push("/chat");
} catch (err) {
- toast.error("Erro de autenticação. Verifique os dados de login");
+ toast.error(i18n.t("auth.toasts.fail"));
}
};
diff --git a/frontend/src/pages/Chat/index.js b/frontend/src/pages/Chat/index.js
index 0957b63..bc77923 100644
--- a/frontend/src/pages/Chat/index.js
+++ b/frontend/src/pages/Chat/index.js
@@ -7,6 +7,8 @@ import { makeStyles } from "@material-ui/core/styles";
import Tickets from "../../components/Tickets/";
import MessagesList from "../../components/MessagesList/";
+import { i18n } from "../../translate/i18n";
+
const useStyles = makeStyles(theme => ({
chatContainer: {
flex: 1,
@@ -61,7 +63,7 @@ const Chat = () => {
>
) : (
- Selecione um contato para começar a conversar
+ {i18n.t("chat.noTicketMessage")}
)}
diff --git a/frontend/src/pages/Contacts/index.js b/frontend/src/pages/Contacts/index.js
index 16057e3..b90e4f7 100644
--- a/frontend/src/pages/Contacts/index.js
+++ b/frontend/src/pages/Contacts/index.js
@@ -28,7 +28,7 @@ import ContactsSekeleton from "../../components/ContactsSekeleton";
import ContactModal from "../../components/ContactModal";
import ConfirmationModal from "../../components/ConfirmationModal/";
-let socket;
+import { i18n } from "../../translate/i18n";
const useStyles = makeStyles(theme => ({
mainContainer: {
@@ -105,13 +105,7 @@ const Contacts = () => {
}, [searchParam, page, rowsPerPage]);
useEffect(() => {
- socket = openSocket(process.env.REACT_APP_BACKEND_URL);
- return () => {
- socket.disconnect();
- };
- }, []);
-
- useEffect(() => {
+ const socket = openSocket(process.env.REACT_APP_BACKEND_URL);
socket.on("contact", data => {
if ((data.action === "update" || data.action === "create") && !loading) {
updateContacts(data.contact);
@@ -121,6 +115,10 @@ const Contacts = () => {
deleteContact(data.contactId);
}
});
+
+ return () => {
+ socket.disconnect();
+ };
}, [loading]);
const updateContacts = contact => {
@@ -206,8 +204,10 @@ const Contacts = () => {
{
}
>
{deletingContact
- ? "Tem certeza que deseja deletar este contato? Todos os tickets relacionados serão perdidos."
- : "Deseja importas todos os contatos do telefone? Essa função é experimental, você terá que recarregar a página após a importação "}
+ ? `${i18n.t("contacts.confirmationModal.deleteMessage")}`
+ : `${i18n.t("contacts.confirmationModal.importMessage")}`}
- Contatos
+ {i18n.t("contacts.title")}
{
color="primary"
onClick={e => setConfirmOpen(true)}
>
- Importar contatos
+ {i18n.t("contacts.buttons.import")}
@@ -261,10 +261,12 @@ const Contacts = () => {
- Nome
- Whatsapp
- Email
- Ações
+ {i18n.t("contacts.table.name")}
+ {i18n.t("contacts.table.whatsapp")}
+ {i18n.t("contacts.table.email")}
+
+ {i18n.t("contacts.table.actions")}
+
diff --git a/frontend/src/pages/Dashboard/Chart.js b/frontend/src/pages/Dashboard/Chart.js
index ad7aec7..adf53ba 100644
--- a/frontend/src/pages/Dashboard/Chart.js
+++ b/frontend/src/pages/Dashboard/Chart.js
@@ -11,6 +11,8 @@ import {
} from "recharts";
import { startOfHour, parseISO, format } from "date-fns";
+import { i18n } from "../../translate/i18n";
+
import Title from "./Title";
import api from "../../services/api";
@@ -69,7 +71,9 @@ const Chart = () => {
return (
- {`Tickets hoje: ${tickets.length}`}
+ {`${i18n.t("dashboard.charts.perDay.title")}${
+ tickets.length
+ }`}
{
return (
{"Copyright © "}
-
+
Canove
{" "}
{new Date().getFullYear()}
@@ -50,7 +50,7 @@ const useStyles = makeStyles(theme => ({
},
}));
-const Login = ({ showToast }) => {
+const Login = () => {
const classes = useStyles();
const [user, setUser] = useState({ email: "", password: "" });
@@ -69,7 +69,7 @@ const Login = ({ showToast }) => {
- Login
+ {i18n.t("login.title")}