Skip to content

Commit

Permalink
Disallow event signin/rsvp for pending+complete events for non-office…
Browse files Browse the repository at this point in the history
…rs (#204)

* Disallow event signin/rsvp for pending+complete events for non-officers

* Remove role checking for disabling event signin/rsvp buttons

* Combine event signin/rsvp buttons into 1 Grid container
  • Loading branch information
thai-truong authored Jan 3, 2021
1 parent 69ab04e commit e9fc9bc
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/pages/EventDetailsPage/components/EventDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
} from '@HOCs/RenderPermissions';
import { Tags, Card, GetLocation } from '@SharedComponents';
import { EventResponse as EventInfo } from '@Services/api/models';
import { EventStatusEnum } from '@Services/EventService';

interface EventDetailsComponentProps {
eventInfo: EventInfo;
Expand All @@ -37,6 +38,7 @@ function EventDetailsComponent(props: EventDetailsComponentProps) {
canvaURL = null,
signInURL,
rsvpURL,
status,
} = eventInfo;

const urls = {
Expand All @@ -47,6 +49,21 @@ function EventDetailsComponent(props: EventDetailsComponentProps) {
canva: { url: canvaURL, label: 'Canva' },
};

const renderSignInRSVPButtons = () =>
status === EventStatusEnum.Ready ? (
<Grid container justify='flex-end' spacing={1}>
<Grid item>
<SignInButton eventId={eventId} />
</Grid>

<Grid item>
<RSVPButton eventId={eventId} />
</Grid>
</Grid>
) : (
<></>
);

return (
<Grid container justify='center' spacing={3}>
<Grid item xs={12}>
Expand All @@ -70,16 +87,7 @@ function EventDetailsComponent(props: EventDetailsComponentProps) {
})}
</Grid>

<Grid item>
<Grid container justify='flex-end' spacing={1}>
<Grid item>
<SignInButton eventId={eventId} />
</Grid>
<Grid item>
<RSVPButton eventId={eventId} />
</Grid>
</Grid>
</Grid>
<Grid item>{renderSignInRSVPButtons()}</Grid>
</Grid>
</Grid>
</Grid>
Expand Down

0 comments on commit e9fc9bc

Please sign in to comment.