Skip to content

Commit

Permalink
Relations: Show related speakers on Talk and Listing
Browse files Browse the repository at this point in the history
  • Loading branch information
ksuess committed Oct 7, 2024
1 parent 5e1fd55 commit 235b16e
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 46 deletions.
90 changes: 46 additions & 44 deletions packages/volto-ploneconf/src/components/Views/Talk.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { isEmpty } from 'lodash';
import {
Container as SemanticContainer,
Grid,
Header,
Image,
Label,
Segment,
} from 'semantic-ui-react';
import { flattenToAppURL } from '@plone/volto/helpers';
import { Component, UniversalLink } from '@plone/volto/components';
import { When } from '@plone/volto/components/theme/View/EventDatesInfo';
import DefaultImageSVG from '@plone/volto/components/manage/Blocks/Listing/default-image.svg';
import config from '@plone/volto/registry';

const TalkView = (props) => {
Expand All @@ -28,6 +32,13 @@ const TalkView = (props) => {
<p className="documentDescription">{content.description}</p>
)}
<Segment floated="right">
{content.image?.scales && (
<Image
src={flattenToAppURL(content.image?.scales?.preview?.download)}
size="medium"
alt={content.title}
/>
)}
{content.start && !content.hide_date && (
<>
<Header dividing sub>
Expand Down Expand Up @@ -67,50 +78,41 @@ const TalkView = (props) => {
</Segment>
<div dangerouslySetInnerHTML={{ __html: content.details.data }} />
<Segment clearing>
{content.speaker && <Header dividing>{content.speaker}</Header>}
{content.website ? (
<p>
<a href={content.website}>{content.company || content.website}</a>
</p>
) : (
<p>{content.company}</p>
)}
{content.email && (
<p>
Email: <a href={`mailto:${content.email}`}>{content.email}</a>
</p>
)}
{content.twitter && (
<p>
X:{' '}
<a href={`https://x.com/${content.twitter}`}>
{content.twitter.startsWith('@')
? content.twitter
: '@' + content.twitter}
</a>
</p>
)}
{content.github && (
<p>
Github:{' '}
<a href={`https://github.com/${content.github}`}>
{content.github}
</a>
</p>
)}
<Image
src={flattenToAppURL(content.image?.scales?.preview?.download)}
size="small"
floated="right"
alt={content.speaker}
avatar
/>
{content.speaker_biography && (
<div
dangerouslySetInnerHTML={{
__html: content.speaker_biography.data,
}}
/>
<Header dividing>Speaker</Header>
{content.speaker?.length > 0 && (
<Grid>
<Grid.Row columns={5}>
{content.speaker.map((el) => (
<Grid.Column>
<UniversalLink href={el['@id']}>
{isEmpty(el.image_scales) ? (
<img
src={
config.getComponent({
name: 'DefaultImage',
dependencies: ['listing', 'summary'],
}).component || DefaultImageSVG
}
alt={el.title}
className="ui image"
/>
) : (
<Component
componentName="PreviewImage"
item={el}
image_field={isEmpty(el.image_scales) ? null : 'image'}
showDefault={true}
alt={el.title}
responsive={true}
className="ui image"
/>
)}
<div>{el.title}</div>
</UniversalLink>
</Grid.Column>
))}
</Grid.Row>
</Grid>
)}
</Segment>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ const TalkListingBlockVariation = ({
<Segment>
<div className="listing-item" key={item['@id']}>
<ConditionalLink item={item} condition={!isEditMode}>
<Component componentName="PreviewImage" item={item} alt="" />
<Component
componentName="PreviewImage"
item={item}
alt={item.title}
/>
<div className="listing-body">
<When
start={item.start}
Expand All @@ -47,7 +51,9 @@ const TalkListingBlockVariation = ({
open_end={item.open_end}
/>
<h3>{item.title || item.id}</h3>
<p>{item.speaker}</p>
{item.speaker?.length > 0 && (
<p>{item.speaker.map((el) => el.title).join(', ')}</p>
)}
<p>
{item.room && (
<>
Expand Down

0 comments on commit 235b16e

Please sign in to comment.