Skip to content

Commit a2158cc

Browse files
committed
cleanup events UI
1 parent a1e036e commit a2158cc

File tree

1 file changed

+25
-8
lines changed

1 file changed

+25
-8
lines changed

src/ui/pages/events/ViewEvents.page.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
1-
import { Text, Button, Table, Modal, Group, Transition, ButtonGroup, Title } from '@mantine/core';
1+
import {
2+
Text,
3+
Button,
4+
Table,
5+
Modal,
6+
Group,
7+
Transition,
8+
ButtonGroup,
9+
Title,
10+
Badge,
11+
Anchor,
12+
} from '@mantine/core';
213
import { useDisclosure } from '@mantine/hooks';
314
import { notifications } from '@mantine/notifications';
415
import { IconPlus, IconTrash } from '@tabler/icons-react';
@@ -65,13 +76,21 @@ export const ViewEventsPage: React.FC = () => {
6576
style={{ ...styles, display: shouldShow ? 'table-row' : 'none' }}
6677
key={`${event.id}-tr`}
6778
>
68-
<Table.Td>{event.title}</Table.Td>
79+
<Table.Td>
80+
{event.title} {event.featured ? <Badge color="green">Featured</Badge> : null}
81+
</Table.Td>
6982
<Table.Td>{dayjs(event.start).format('MMM D YYYY hh:mm')}</Table.Td>
7083
<Table.Td>{event.end ? dayjs(event.end).format('MMM D YYYY hh:mm') : 'N/A'}</Table.Td>
71-
<Table.Td>{event.location}</Table.Td>
72-
<Table.Td>{event.description}</Table.Td>
84+
<Table.Td>
85+
{event.locationLink ? (
86+
<Anchor target="_blank" size="sm" href={event.locationLink}>
87+
{event.location}
88+
</Anchor>
89+
) : (
90+
event.location
91+
)}
92+
</Table.Td>
7393
<Table.Td>{event.host}</Table.Td>
74-
<Table.Td>{event.featured ? 'Yes' : 'No'}</Table.Td>
7594
<Table.Td>{capitalizeFirstLetter(event.repeats || 'Never')}</Table.Td>
7695
<Table.Td>
7796
<ButtonGroup>
@@ -98,7 +117,7 @@ export const ViewEventsPage: React.FC = () => {
98117
useEffect(() => {
99118
const getEvents = async () => {
100119
const response = await api.get('/api/v1/events');
101-
const upcomingEvents = await api.get('/api/v1/events?upcomingOnly=true');
120+
const upcomingEvents = await api.get(`/api/v1/events?upcomingOnly=true&ts=${Date.now()}`);
102121
const upcomingEventsSet = new Set(upcomingEvents.data.map((x: EventGetResponse) => x.id));
103122
const events = response.data;
104123
events.sort((a: EventGetResponse, b: EventGetResponse) => {
@@ -188,9 +207,7 @@ export const ViewEventsPage: React.FC = () => {
188207
<Table.Th>Start</Table.Th>
189208
<Table.Th>End</Table.Th>
190209
<Table.Th>Location</Table.Th>
191-
<Table.Th>Description</Table.Th>
192210
<Table.Th>Host</Table.Th>
193-
<Table.Th>Featured</Table.Th>
194211
<Table.Th>Repeats</Table.Th>
195212
<Table.Th>Actions</Table.Th>
196213
</Table.Tr>

0 commit comments

Comments
 (0)