Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/unb-mds/LicitaBSB-24.1 into…
Browse files Browse the repository at this point in the history
… home-page
  • Loading branch information
Otavio4283 committed Aug 14, 2024
2 parents 67830ba + 18861f9 commit 0f75b3a
Show file tree
Hide file tree
Showing 12 changed files with 168 additions and 62 deletions.
12 changes: 8 additions & 4 deletions backend/newsletter/sendEmails.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Além disso, lembramos que também estamos compartilhando essas atualizações n
Atenciosamente,
Equipe Licita BSB`,
html: `<p>Olá,</p>
<p>Gostaríamos de informar que as dispensas de licitação mais recentes em Brasília foram atualizadas em nosso portal <strong>Licita BSB</strong>. Através do nosso site, você pode acessar essas informações de maneira fácil e compreensível.</p>
<p>Gostaríamos de informar que as licitações mais recentes em Brasília foram atualizadas em nosso portal <strong>Licita BSB</strong>. Através do nosso site, você pode acessar essas informações de maneira fácil e compreensível.</p>
<p>Além disso, lembramos que também estamos compartilhando essas atualizações na rede social X (antigo Twitter) através do nosso perfil: <a href="https://x.com/licitabsb" target="_blank">https://x.com/licitabsb</a>. Isso nos permite alcançar um público ainda maior e manter a população de Brasília informada sobre as decisões governamentais.</p>
<p>Atenciosamente,<br>Equipe Licita BSB</p>`
};
Expand All @@ -69,7 +69,7 @@ Equipe Licita BSB`,
await transporter.sendMail(mailOptions);
console.log(`Email successfully sent to: ${emailAddress}`);
} catch (error) {
console.error(`Failed to send email to: ${emailAddress}`, error);
console.error(`Failed to send email to: ${emailAddress}. Error: ${error.message}`);
}
};

Expand All @@ -82,10 +82,14 @@ const main = async () => {
}

for (const subscriber of subscribers) {
await sendMail(subscriber);
try {
await sendMail(subscriber);
} catch (error) {
console.error(`Error processing email: ${subscriber}. Continuing with the next one.`);
}
}

console.log('All emails sent.');
console.log('All emails attempted.');
};

main();
22 changes: 1 addition & 21 deletions backend/server/app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,21 +247,6 @@ def licitacao_maior_valor(request):
@swagger_auto_schema(
method='post',
operation_description="Subscribe an email to a Mailchimp list.",
request_body=openapi.Schema(
type=openapi.TYPE_OBJECT,
properties={
'email_address': openapi.Schema(type=openapi.TYPE_STRING),
'status': openapi.Schema(type=openapi.TYPE_STRING),
'merge_fields': openapi.Schema(
type=openapi.TYPE_OBJECT,
properties={
'FNAME': openapi.Schema(type=openapi.TYPE_STRING),
'LNAME': openapi.Schema(type=openapi.TYPE_STRING)
}
)
},
required=['email_address', 'status']
),
responses={
200: "Subscription successful!",
500: "Subscription failed."
Expand All @@ -276,13 +261,9 @@ def subscribe_email(request):
return Response({"detail": "Unauthorized origin."}, status=status.HTTP_403_FORBIDDEN)

email = request.data.get('email_address')
status = request.data.get('status')
merge_fields = request.data.get('merge_fields')

if not email:
return Response({"detail": "Email is required."}, status=status.HTTP_400_BAD_REQUEST)
if not status:
return Response({"detail": "Status is required."}, status=status.HTTP_400_BAD_REQUEST)

mailchimp_url = settings.DJANGO_URL_CHIMP
mailchimp_api_key = settings.DJANGO_API
Expand All @@ -292,8 +273,7 @@ def subscribe_email(request):
mailchimp_url,
json={
'email_address': email,
'status': status,
'merge_fields': merge_fields
'status': 'subscribed',
},
auth=HTTPBasicAuth('anystring', mailchimp_api_key) # 'anystring' pode ser qualquer valor
)
Expand Down
10 changes: 10 additions & 0 deletions frontend/assets/burger.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 14 additions & 9 deletions frontend/src/components/footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,24 @@ const Footer = () => {
</Link>
<ul>
<li>
<Link to={'/licitacoes'}>
<p>Licitações</p>
</Link>
<a href="/licitacoes" onClick={() => setShowSidebar((prev) => !prev)}>
Licitações
</a>
</li>
<li>
<a href="/artigos" onClick={() => setShowSidebar((prev) => !prev)}>
Conheça o Projeto
</a>
</li>
<li>
<Link to={'/sobrenos'}>
<p>Sobre a Equipe</p>
</Link>
<a href="/sobrenos" onClick={() => setShowSidebar((prev) => !prev)}>
Sobre Nós
</a>
</li>
<li>
<Link to={'/dashboard'}>
<p>Dashboard</p>
</Link>
<a href="/dashboard" onClick={() => setShowSidebar((prev) => !prev)}>
Dashboard
</a>
</li>
<li>
<p>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/footer/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
}
li a {
text-decoration: none;
font-size: 18px;
color: #e9e4df;
font-weight: 600;
}
}
@media (max-width: 740px) {
Expand Down
42 changes: 21 additions & 21 deletions frontend/src/components/header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import React, { useState } from 'react';
import logo from '../../../assets/logo.png';
import unb from '../../../assets/unb.png';
import search from '../../../assets/Search.svg';
import menuBurger from '../../../assets/burger.svg';
import styles from './style.module.css';
import { useNavigate } from 'react-router-dom';
import SidebarResponsive from '../sidebar-responsive';

const Header = () => {
const navigate = useNavigate();
const [input, setInput] = useState('');
const [showSidebar, setShowSidebar] = useState(false);

function handdleChange(e) {
setInput(e.target.value);
Expand All @@ -24,6 +27,7 @@ const Header = () => {

return (
<div className={styles.headerWrapper}>
<SidebarResponsive showSidebar={showSidebar} setShowSidebar={setShowSidebar}/>
<div className={styles.headerUnb}>
<img src={unb} alt="Logo da Universidade de brasília" />
</div>
Expand Down Expand Up @@ -52,12 +56,23 @@ const Header = () => {
</a>
</li>
<li className={styles.headerListItem}>
<a href="/dashboard" className={styles.headerLink}>
Dashboard
<a href="/graficos" className={styles.headerLink}>
Gráficos
</a>
</li>
</ul>
<div>
<div className={styles.responsiveCampoPesquisa}>
<a href="/licitacoes" style={{display: 'flex', alignItems: 'center'}}>
<img
src={search}
/>
</a>
<img
src={menuBurger}
onClick={() => setShowSidebar((prev) => !prev)}
/>
</div>
<div className={styles.campoPesquisa}>
<button
className={styles.botaoPesquisa}
Expand All @@ -82,23 +97,8 @@ const Header = () => {
</a>
</li>
<li className={styles.headerListItem}>
<a href="/SobreLicitacao" className={styles.headerLink}>
Sobre as Licitações
</a>
</li>
<li className={styles.headerListItem}>
<a href="/sobredispensadelicitacao" className={styles.headerLink}>
Sobre Dispensas
</a>
</li>
<li className={styles.headerListItem}>
<a href="/sobrebot" className={styles.headerLink}>
Sobre o Bot
</a>
</li>
<li className={styles.headerListItem}>
<a href="" className={styles.headerLink}>
Sobre o Projeto
<a href="/artigos" className={styles.headerLink}>
Conheça o Projeto
</a>
</li>
<li className={styles.headerListItem}>
Expand All @@ -107,8 +107,8 @@ const Header = () => {
</a>
</li>
<li className={styles.headerListItem}>
<a href="/dashboard" className={styles.headerLink}>
Dashboard
<a href="/graficos" className={styles.headerLink}>
Gráficos
</a>
</li>
</ul>
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/components/header/style.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,18 @@
outline: none;
}

.responsiveCampoPesquisa {
display: none;
}

/* Estilos Responsivos */
@media (max-width: 720px) {
body, html {
overflow-x: hidden;
}

.subHeader {
justify-content: center;
justify-content: space-between;
padding: 0 16px; /* Ajuste para evitar overflow */
}

Expand All @@ -108,6 +112,11 @@
.campoPesquisa {
display: none;
}

.responsiveCampoPesquisa {
display: flex;
gap: 16px;
}
}

@media (min-width: 720px) and (max-width: 1700px){
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/newsletter/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const SubscribeForm = () => {

const payload = {
email_address: email, // Ajuste o campo conforme necessário
status: 'subscribed'
status: 'subscribed',
};

try {
Expand Down
36 changes: 36 additions & 0 deletions frontend/src/components/sidebar-responsive/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import styles from './style.module.css'
import { Link } from 'react-router-dom';

export default function SidebarResponsive({showSidebar, setShowSidebar}) {
return (
<section style={{display: showSidebar ? 'flex' : 'none'}}>
<div className={styles.sidebarContainer} onClick={() => setShowSidebar((prev) => !prev)}>
</div>
<div className={styles.sidebar}>
<ul>
<li>
<a href="/licitacoes" onClick={() => setShowSidebar((prev) => !prev)}>
Licitações
</a>
</li>
<li>
<a href="/artigos" onClick={() => setShowSidebar((prev) => !prev)}>
Conheça o Projeto
</a>
</li>
<li>
<a href="/sobrenos" onClick={() => setShowSidebar((prev) => !prev)}>
Sobre Nós
</a>
</li>
<li>
<a href="/graficos" onClick={() => setShowSidebar((prev) => !prev)}>
Gráficos
</a>
</li>
</ul>
</div>
</section>
)
}
46 changes: 46 additions & 0 deletions frontend/src/components/sidebar-responsive/style.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.sidebarContainer{
width: 100vw;
height: 100vh;
position: absolute;
top: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.5);
}

.sidebar {
display: flex;
height: 100%;
width: 50%;
background-color: var(--azulMedio);
z-index: 500;
position: absolute;
top: 0;
right: 0;
padding: 32px;
}

.sidebar ul {
display: flex;
flex-direction: column;
gap: 32px;
align-items: flex-start;
justify-content: flex-start;
}

.sidebar ul li a {
color: var(--brancoTexto);
font-size: 16px;
font-weight: bold;
text-decoration: none;
font-family: 'IBM Plex Sans', sans-serif;
}

@media (min-width: 720px) {
.sidebarContainer{
display: none;
}

.sidebar {
display: none;
}
}
5 changes: 5 additions & 0 deletions frontend/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import Root from './root';
import './styles/global.css';
import ArticleRoot from './article-root';
import Articles from './pages/articles';
import Dashboard from './pages/dashboard';

const router = createBrowserRouter([
{
Expand Down Expand Up @@ -67,6 +68,10 @@ const router = createBrowserRouter([
{
path: "licitacoes/:id",
element: <BiddingPage />
},
{
path: "graficos",
element: <Dashboard />
}
]
}
Expand Down
Loading

0 comments on commit 0f75b3a

Please sign in to comment.