-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #276 from performant-software/feature/cdc27_events
CDC #27 - Events
- Loading branch information
Showing
68 changed files
with
2,637 additions
and
788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// @flow | ||
|
||
import React, { useCallback } from 'react'; | ||
import EventUtils from '../utils/Event'; | ||
import LoadAnimation from './LoadAnimation'; | ||
import { useEventsService, useLoader } from '../hooks/CoreData'; | ||
|
||
type Props = { | ||
/** | ||
* Identifier for the event to fetch. | ||
*/ | ||
id: string | ||
}; | ||
|
||
/** | ||
* This component renders the details for a single event. | ||
*/ | ||
const EventDetails = (props: Props) => { | ||
const EventsService = useEventsService(); | ||
|
||
/** | ||
* Loads the event record. | ||
* | ||
* @type {function(*, *): Promise<*>} | ||
*/ | ||
const onLoad = useCallback(() => EventsService.fetchOne(props.id), [props.id]); | ||
|
||
const { data: { event } = {}, loading } = useLoader(onLoad); | ||
|
||
if (loading) { | ||
return ( | ||
<LoadAnimation /> | ||
); | ||
} | ||
|
||
if (!event) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1 | ||
className='pr-6 py-1 font-bold text-2xl' | ||
> | ||
{ event.name } | ||
</h1> | ||
<div | ||
className='py-1' | ||
> | ||
{ EventUtils.getDateView(event) } | ||
</div> | ||
<p | ||
className='py-1 text-muted' | ||
> | ||
{ event.description } | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default EventDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.