-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from 4lysson-a/dev
- Loading branch information
Showing
18 changed files
with
261 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.data | ||
.idea | ||
data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
"applicationId": "" | ||
} | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 24 additions & 25 deletions
49
frontend/src/components/layout/(private)/CompanyProvider/index.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,34 @@ | ||
import React from 'react'; | ||
import Loading from '@/components/shared/Loading'; | ||
import React from "react"; | ||
import Loading from "@/components/shared/Loading"; | ||
|
||
export default function CompanyProvider({ children }) { | ||
const isFirstTime = React.useRef(true); | ||
const isFirstTime = React.useRef(true); | ||
|
||
const [overlook, setOverlook] = React.useState(false); | ||
const [overlook, setOverlook] = React.useState(false); | ||
|
||
React.useEffect(() => { | ||
if (isFirstTime.current) { | ||
isFirstTime.current = false; | ||
React.useEffect(async() => { | ||
if (isFirstTime.current) { | ||
isFirstTime.current = false; | ||
|
||
async function getData() { | ||
try { | ||
const res = []; | ||
async function getData() { | ||
try { | ||
const res = []; | ||
|
||
if (res) { | ||
setOverlook(true); | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
} | ||
if (res) { | ||
setOverlook(true); | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
} | ||
} | ||
|
||
getData(); | ||
return; | ||
} | ||
}, []); | ||
await getData(); | ||
} | ||
}, []); | ||
|
||
if (overlook) { | ||
return children; | ||
} | ||
if (overlook) { | ||
return children; | ||
} | ||
|
||
return <Loading />; | ||
return <Loading />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Video, Link, Frame, Badge, Title } from "@/pages/Blog/common"; | ||
|
||
<Badge text="Notas da versão v0.3.9" /> | ||
|
||
<div align="center"> | ||
|
||
![image](https://github.com/user-attachments/assets/da7d8698-b012-44f6-ac40-dcd69dfcc520) | ||
|
||
</div> | ||
|
||
<br /> | ||
|
||
Agora, você pode configurar a mensagem que seu cliente verá ao te enviar o pedido via whatsapp! | ||
|
||
Configure o nome, preço e descrição do item, e o cliente verá essa mensagem ao te enviar o pedido via whatsapp. | ||
|
||
## O que há de novo? | ||
|
||
- **Correção de bugs e melhorias**: Corrigimos alguns bugs que atrapalhavam a experiência do usuário. | ||
- **Adicionamos botões de voltar e fechar em alguns modais**: Agora, você pode fechar e voltar com mais facilidade. | ||
- **Atualização de dependências**: Atualizamos as dependências do projeto para garantir a segurança e a estabilidade do sistema. | ||
- **Configure a mensagem do seu cliente**: Agora, você pode configurar a mensagem que seu cliente verá ao te enviar o pedido via whatsapp! | ||
|
||
|
||
<br /> | ||
<br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
import React from "react"; | ||
|
||
import { NativeModal } from "@/components/shared/Modals"; | ||
import Separator from "@/components/shared/Separator"; | ||
import useAuth from "@/hooks/zustand/(private)/useAuth"; | ||
import SimpleCircularLoading from "@/components/shared/Loading/SimpleCircularLoading"; | ||
|
||
export default function UserForm() { | ||
const input = React.useRef(); | ||
|
||
const [companys] = useAuth(s => [s.companys]); | ||
|
||
const [open, setOpen] = React.useState(false); | ||
const [edit, setEdit] = React.useState(false); | ||
const [loading, setLoading] = React.useState(false); | ||
|
||
const savedMsg = companys[0].get("message"); | ||
const [message, setMessage] = React.useState(savedMsg); | ||
|
||
const handleClick = type => { | ||
switch (type) { | ||
case "open": | ||
setOpen(true); | ||
break; | ||
case "close": | ||
setOpen(false); | ||
break; | ||
default: | ||
setOpen(!open); | ||
} | ||
}; | ||
|
||
const handleChangeMessage = message => { | ||
companys[0].set("message", message); | ||
companys[0].save(); | ||
}; | ||
|
||
const handleSave = () => { | ||
try { | ||
setLoading(true); | ||
handleChangeMessage(input.current.value); | ||
setMessage(input.current.value); | ||
} finally { | ||
setTimeout(() => { | ||
setLoading(false); | ||
setEdit(false); | ||
setOpen(false); | ||
}, 1000); | ||
} | ||
}; | ||
|
||
const highlightPlaceholders = text => { | ||
const placeholders = ["{nome}", "{valor}", "{produtos}"]; | ||
const parts = text.split(new RegExp(`(${placeholders.join("|")})`, "g")); | ||
return parts.map((part, index) => | ||
placeholders.includes(part) ? ( | ||
<span key={index} style={{ color: "var(--primary)", fontWeight: "bold" }}> | ||
{part} | ||
</span> | ||
) : ( | ||
part | ||
) | ||
); | ||
}; | ||
|
||
return ( | ||
<div className="flex flex-col gap-5 relative"> | ||
<div className="flex flex-col gap-3"> | ||
<h2 className="text-2xl">Formulário dos usuários</h2> | ||
<p className="text-[var(--texts)]"> | ||
Configure como os usuários vão te chamar no whatsapp customizando a mensagem. | ||
</p> | ||
</div> | ||
|
||
<button | ||
onClick={() => handleClick("open")} | ||
className="p-3 relative bg-[var(--card)] rounded-xl font-bold text-[var(--texts)] transition duration-200 text-center active:scale-95" | ||
> | ||
Customizar mensagem | ||
</button> | ||
|
||
{open && ( | ||
<NativeModal key="user_form" onClose={() => handleClick("close")} isOpen={open}> | ||
<div className="flex flex-col gap-4"> | ||
<div className="flex flex-col gap-10"> | ||
<div className="flex flex-col gap-4"> | ||
<h1 className="text-2xl mt-[-60px]">Gerenciar mensagem</h1> | ||
<p className="text-xl"> | ||
Personalize a mensagem que será enviada para os usuários, você pode usar as tags{" "} | ||
<span className="text-primary">{"{nome}"}</span>,{" "} | ||
<span className="text-primary">{"{valor}"}</span> e{" "} | ||
<span className="text-primary">{"{produtos}"}</span> para inserir o nome do usuário, | ||
valor e produtos. | ||
</p> | ||
<p className="text-sm"> | ||
é importante que você mantenha as tags{" "} | ||
<span className="text-primary">{"{nome}"}</span>,{" "} | ||
<span className="text-primary">{"{valor}"}</span> e{" "} | ||
<span className="text-primary">{"{produtos}"}</span> na mensagem para que o nome do | ||
usuário, valor e produtos sejam inseridos corretamente. | ||
</p> | ||
</div> | ||
</div> | ||
|
||
<Separator /> | ||
|
||
<div className="flex flex-col gap-2"> | ||
<p>Mensagem atual</p> | ||
{edit ? ( | ||
<textarea | ||
ref={input} | ||
cols="30" | ||
rows="10" | ||
placeholder={message} | ||
className="bg-card rounded-xl text-texts p-6 text-xl" | ||
></textarea> | ||
) : ( | ||
<div | ||
style={{ | ||
whiteSpace: "pre-wrap" | ||
}} | ||
className="bg-card rounded-xl text-texts p-6 text-xl" | ||
> | ||
{highlightPlaceholders(message)} | ||
</div> | ||
)} | ||
</div> | ||
|
||
<div className="flex w-full items-center gap-4 pt-6 justify-between"> | ||
<button | ||
disabled={loading} | ||
onClick={handleSave} | ||
className="bg-primary disabled:opacity-50 flex items-center justify-center gap-2 font-bold text-card p-4 w-full px-6 rounded-xl" | ||
> | ||
{loading && ( | ||
<div className="w-4 flex"> | ||
<SimpleCircularLoading /> | ||
</div> | ||
)} | ||
Salvar | ||
</button> | ||
<button | ||
disabled={loading} | ||
onClick={() => setEdit(!edit)} | ||
className="bg-transparent disabled:opacity-50 border text-primary font-bold border-primary p-4 w-full px-6 rounded-xl" | ||
> | ||
{edit ? "Cancelar" : "Editar"} | ||
</button> | ||
</div> | ||
</div> | ||
</NativeModal> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.