Skip to content

Commit

Permalink
Use Data Hub API for events CollectionList (#6802)
Browse files Browse the repository at this point in the history
* Refactor CollectionItem to allow tags to be rendered in the same way as in activity cards

* Refactor events collection page to use the API instead of ActivityStream

* Update tests

* Cleanup dead code
  • Loading branch information
cgsunkel authored and marijnkampf committed May 23, 2024
1 parent b7b0eec commit 8a254d9
Show file tree
Hide file tree
Showing 15 changed files with 580 additions and 747 deletions.
Binary file modified cypress-image-diff-screenshots/baseline/event-spec-eventPage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions src/apps/events/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ const attendeesRouter = require('./attendees/router')

const {
fetchAventriEvent,
fetchAllActivityFeedEvents,
fetchAventriEventRegistrationStatusAttendees,
} = require('../companies/apps/activity-feed/controllers')

router.get('/create', renderEventsView)
router.get(urls.events.activity.data.route, fetchAllActivityFeedEvents)
router.use(handleRoutePermissions(APP_PERMISSIONS))

router.get('/aventri/:aventriEventId/details', renderEventsView)
Expand Down
112 changes: 0 additions & 112 deletions src/client/components/ActivityFeedFilteredCollectionList/index.jsx

This file was deleted.

35 changes: 25 additions & 10 deletions src/client/components/CollectionList/CollectionItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ const StyledBadgesWrapper = styled('div')`
}
`

const StyledInlineTagWrapper = styled('div')({
display: 'flex',
flexWrap: 'wrap',
gap: SPACING.SCALE_2,
paddingBottom: '10px',
})

const StyledHeader = styled(H3)`
font-size: ${HEADING_SIZES.SMALL}px;
`
Expand Down Expand Up @@ -64,6 +71,18 @@ const StyledFooterWrapper = styled('div')`
margin-right: 10px;
text-align: right;
`

const renderTags = (tags) =>
tags.map((tag, index) => (
<Tag
key={`tag_${index}`}
colour={tag.colour}
data-test={tag.dataTest ? tag.dataTest : 'collection-item-tag'}
>
{tag.text}
</Tag>
))

const CollectionItem = ({
headingText,
subheading,
Expand All @@ -79,21 +98,14 @@ const CollectionItem = ({
buttons,
footerRenderer,
footerdata,
showTagsInMetadata = false,
}) => (
<ItemWrapper data-test="collection-item">
{/* tags take precidence over badges as they are the newer style, however not all components
have been updated so the component needs to handle rendering both props */}
{tags && (
{tags && !showTagsInMetadata && (
<StyledBadgesWrapper data-test="collection-item-tags">
{tags.map((tag, index) => (
<Tag
key={`tag_${index}`}
colour={tag.colour}
data-test="collection-item-tag"
>
{tag.text}
</Tag>
))}
{renderTags(tags)}
</StyledBadgesWrapper>
)}

Expand Down Expand Up @@ -134,6 +146,9 @@ const CollectionItem = ({
)
) : null}

{showTagsInMetadata && (
<StyledInlineTagWrapper>{renderTags(tags)}</StyledInlineTagWrapper>
)}
{metadataRenderer ? (
metadataRenderer(metadata)
) : (
Expand Down
Loading

0 comments on commit 8a254d9

Please sign in to comment.