Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(temporary): add an alert for the next session #213

Merged
merged 6 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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