Skip to content

Commit

Permalink
feat(temporary): add an alert for the next session (#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Afonso-santos authored Dec 6, 2023
1 parent f30950c commit 6349bec
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 74 deletions.
10 changes: 9 additions & 1 deletion apps/app/pages/events.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Col, Row, Typography } from "antd";
import { Alert, Col, Row, Typography } from "antd";
import AppLayout from "~/layouts/AppLayout";
import { withAuth } from "~/components/Auth";
import Event from "~/components/Event";
Expand All @@ -13,6 +13,13 @@ function Events() {

return (
<AppLayout>
<Alert
message="A sessão de dia 16 de dezembro será realizada ás 14:30."
type="warning"
showIcon
closable
style={{ marginBottom: "1rem" }}
/>
<Title level={2}>Eventos</Title>
<Row className={styles.row} align="top" justify="start" gutter={[16, 16]}>
{events?.map((info) => (
Expand All @@ -23,6 +30,7 @@ function Events() {
</Row>
</AppLayout>
);
1;
}

export default withAuth(Events);
160 changes: 87 additions & 73 deletions apps/app/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { Button, Col, Popconfirm, Row, Typography } from "antd";
import { Alert, Button, Col, Popconfirm, Row, Typography } from "antd";
import { useAuth } from "@coderdojobraga/ui";
import { withAuth } from "~/components/Auth/withAuth";
import AppLayout from "~/layouts/AppLayout";
Expand Down Expand Up @@ -68,81 +68,95 @@ function Dashboard() {
}, [role]);

return (
<AppLayout>
<Title level={2}>Painel Principal</Title>
<Row justify="space-between" gutter={8}>
<Title level={3}>Próximo Evento</Title>
<Row gutter={[8, 8]}>
<Col>
{role === EUser.Organizer ? (
<Popconfirm
title="Tens a certeza que queres notificar?"
cancelText="Não"
okText="Sim"
onConfirm={(_) => notify_signup_ninjas()}
>
<Button type="primary">Notificar abertura</Button>
</Popconfirm>
) : (
<></>
)}
</Col>
<Col>
{role === EUser.Organizer ? (
<Popconfirm
title="Tens a certeza que queres notificar?"
cancelText="Não"
okText="Sim"
onConfirm={(_) => notify_selected_ninjas()}
>
<Button type="primary">Notificar selecionados</Button>
</Popconfirm>
) : (
<></>
)}
</Col>
<>
<AppLayout>
<Alert
message="A sessão de dia 16 de dezembro será realizada ás 14:30."
type="warning"
showIcon
closable
style={{ marginBottom: "1rem" }}
/>
<Title level={2}>Painel Principal</Title>
<Row justify="space-between" gutter={8}>
<Title level={3}>Próximo Evento</Title>
<Row gutter={[8, 8]}>
<Col>
{role === EUser.Organizer ? (
<Popconfirm
title="Tens a certeza que queres notificar?"
cancelText="Não"
okText="Sim"
onConfirm={(_) => notify_signup_ninjas()}
>
<Button type="primary">Notificar abertura</Button>
</Popconfirm>
) : (
<></>
)}
</Col>
<Col>
{role === EUser.Organizer ? (
<Popconfirm
title="Tens a certeza que queres notificar?"
cancelText="Não"
okText="Sim"
onConfirm={(_) => notify_selected_ninjas()}
>
<Button type="primary">Notificar selecionados</Button>
</Popconfirm>
) : (
<></>
)}
</Col>
</Row>
</Row>
<Row className={styles.row} align="top" justify="space-between">
{events?.length > 0 && nextEvent() ? (
<Event
event={nextEvent()}
collapsed={false}
isLoading={isLoadingEvents}
/>
) : (
<Typography>Aguarda que o próximo evento seja divulgado</Typography>
)}
</Row>
</Row>
<Row className={styles.row} align="top" justify="space-between">
{events?.length > 0 && nextEvent() ? (
<Event
event={nextEvent()}
collapsed={false}
isLoading={isLoadingEvents}
/>
<Title level={3}>Eventos</Title>
<Row
className={styles.row}
align="top"
justify="start"
gutter={[16, 16]}
>
{events?.slice(0, 3).map((event: any) => (
<Col key={event.id}>
<Event event={event} isLoading={isLoadingEvents} />
</Col>
))}
</Row>
{role === EUser.Guardian ? (
<>
<Title level={3}>Ninjas</Title>
<Row
className={styles.row}
align="top"
justify="start"
gutter={[16, 16]}
>
{ninjas &&
ninjas.slice(0, 5).map((ninja: any) => (
<Col key={ninja.id}>
<Ninja {...ninja} />
</Col>
))}
</Row>
</>
) : (
<Typography>Aguarda que o próximo evento seja divulgado</Typography>
<></>
)}
</Row>
<Title level={3}>Eventos</Title>
<Row className={styles.row} align="top" justify="start" gutter={[16, 16]}>
{events?.slice(0, 3).map((event: any) => (
<Col key={event.id}>
<Event event={event} isLoading={isLoadingEvents} />
</Col>
))}
</Row>
{role === EUser.Guardian ? (
<>
<Title level={3}>Ninjas</Title>
<Row
className={styles.row}
align="top"
justify="start"
gutter={[16, 16]}
>
{ninjas &&
ninjas.slice(0, 5).map((ninja: any) => (
<Col key={ninja.id}>
<Ninja {...ninja} />
</Col>
))}
</Row>
</>
) : (
<></>
)}
</AppLayout>
</AppLayout>
</>
);
}

Expand Down

0 comments on commit 6349bec

Please sign in to comment.