Skip to content

Commit

Permalink
Merge branch 'main' into improvement/adm-nvbr
Browse files Browse the repository at this point in the history
  • Loading branch information
devgabrielnascimento committed Jun 4, 2024
2 parents 70e5880 + a069e96 commit c117291
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/components/categoria/listaCategoria/ListaCategoria.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useContext, useEffect, useState } from "react";
import { useContext, useEffect, useRef, useState } from "react";
import { Triangle } from "react-loader-spinner";
import { useNavigate } from "react-router-dom";
import { AuthContext } from "../../../contexts/AuthContext";
Expand All @@ -9,6 +9,7 @@ import { toastAlerta } from "../../../utils/toastAlerta";

function ListaCategoria() {
const [categoria, setCategoria] = useState<Categoria[]>([]);
const alertShown = useRef(false);

const navigate = useNavigate();

Expand All @@ -30,8 +31,13 @@ function ListaCategoria() {

useEffect(() => {
if (token === "") {
if (!alertShown.current) {
toastAlerta("Você precisa estar logado", "erro");
alertShown.current = true;
}
navigate("/login");
} else {
buscarCategoria();
}
}, [token]);

Expand Down
15 changes: 8 additions & 7 deletions src/pages/contato/Contato.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ContactPage = () => {
};

const handlePhoneChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const phoneValue = e.target.value.replace(/\D/g, ""); // Remove todos os caracteres não numéricos
const phoneValue = e.target.value.replace(/\D/g, "");
let formattedPhone = "";

if (phoneValue.length <= 11) {
Expand Down Expand Up @@ -77,6 +77,7 @@ const ContactPage = () => {
Entre em Contato
</h1>
<p className="text-3x1 text-left text-primary font-semibold">Mande uma mensagem para a gente!</p>

<form onSubmit={handleSubmit} className="">
<div>
<label htmlFor="name" className="block text-gray-700">
Expand All @@ -90,7 +91,7 @@ const ContactPage = () => {
value={formData.name}
onChange={handleChange}
required
className="border-2 border-b-primary rounded p-2 focus:border-2 focus:border-b-accent placeholder-gray-400 text-black w-full"
className="border-2 border-b-primary rounded p-2 focus:outline-none placeholder-gray-400 text-black w-full"
/>
</div>
<div>
Expand All @@ -101,11 +102,11 @@ const ContactPage = () => {
type="email"
id="email"
name="email"
placeholder="E-mail"
placeholder=""
value={formData.email}
onChange={handleEmailChange}
required
className="border-2 border-b-primary rounded p-2 focus:border-2 focus:border-b-accent placeholder-gray-400 text-black w-full"
className="border-2 border-b-primary rounded p-2 focus:outline-none placeholder-gray-400 text-black w-full"
/>
</div>
<div>
Expand All @@ -119,10 +120,10 @@ const ContactPage = () => {
value={formData.phone}
onChange={handlePhoneChange}
required
className="border-2 border-b-primary p-2 focus:border-2 focus:border-b-accent placeholder-gray-400 text-black w-full"
className="border-2 border-b-primary p-2 focus:outline-none placeholder-gray-400 text-black w-full"
/>
</div>
<div>
<div className="">
<label htmlFor="message" className="block text-gray-700">
Mensagem:
</label>
Expand All @@ -133,7 +134,7 @@ const ContactPage = () => {
value={formData.message}
onChange={handleChange}
required
className="border-2 border-b-primary rounded p-2 focus:border-2 bg-transparent focus:border-b-accent placeholder-gray-400 text-black w-full"
className="border-2 border-b-primary rounded p-2 focus:outline-none bg-transparent placeholder-gray-400 text-black w-full"
style={{ minHeight: "150px" }}
></textarea>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function Login() {
name="usuario"
autoComplete="on"
placeholder="E-mail"
className="font-light border-slate border-b-2 p-2 bg-white placeholder-primary border-0 text-primary w-full focus:border-primary focus:ring-0 !outline-none "
className="font-light border-slate border-b-2 p-2 bg-white placeholder-primary border-0 text-primary w-full focus:border-primary focus:ring-0 !outline-none "
value={usuarioLogin.usuario}
onChange={(e: ChangeEvent<HTMLInputElement>) =>
atualizarEstado(e)
Expand Down

0 comments on commit c117291

Please sign in to comment.