Skip to content

Commit

Permalink
Add links to speaker in meetup page (#236)
Browse files Browse the repository at this point in the history
* Add links to speaker in meetup page

* Fix test and rubocop
  • Loading branch information
auliafaizahr authored Jul 30, 2024
1 parent fa8d922 commit 29b7cd8
Show file tree
Hide file tree
Showing 2 changed files with 111 additions and 2 deletions.
89 changes: 87 additions & 2 deletions app/javascript/components/pages/PastMeetup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,93 @@ const SpeakerBiosBlock = ({ speakers }) => {
<h4 className="text-xl font-bold text-gray md:text-2xl">About the speakers</h4>
</div>
<div className="flex flex-wrap items-center gap-5">
{speakers?.map(({ id, bio }) => (
<div key={id}>{bio}</div>
{speakers?.map(({ id, bio, name, links }) => (
<div key={id}>
<div>{bio}</div>
{Object.keys(links).length > 0 && (
<div className="flex items-center">
<p className="mr-3">More from {name}:</p>
{links.twitter && (
<a
href={links.twitter}
aria-label="Twitter"
target="_blank"
rel="noopener noreferrer"
>
<i
className="bi bi-twitter-x social-icon h-4 w-4 fill-current mx-1"
style={{ width: '15px' }}
/>
</a>
)}
{links.github && (
<a
href={links.github}
aria-label="Github"
target="_blank"
rel="noopener noreferrer"
>
<i
className="bi bi-github social-icon h-4 w-4 fill-current mx-1"
style={{ width: '15px' }}
/>
</a>
)}
{links.linkedin && (
<a
href={links.linkedin}
aria-label="Linkedin"
target="_blank"
rel="noopener noreferrer"
>
<i
className="bi bi-linkedin social-icon h-4 w-4 fill-current mx-1"
style={{ width: '15px' }}
/>
</a>
)}
{links.mastodon && (
<a
href={links.mastodon}
aria-label="Mastodon"
target="_blank"
rel="noopener noreferrer"
>
<i
className="bi bi-mastodon social-icon h-4 w-4 fill-current"
style={{ width: '15px' }}
></i>
</a>
)}
{links.website && (
<a
href={links.website}
aria-label="Website"
target="_blank"
rel="noopener noreferrer"
>
<i
className="bi bi-globe social-icon h-4 w-4 fill-current"
style={{ width: '15px' }}
/>
</a>
)}
{links.other && (
<a
href={links.other}
aria-label="Other"
target="_blank"
rel="noopener noreferrer"
>
<i
className="bi bi-link-45deg social-icon h-4 w-4 fill-current mx-1"
style={{ width: '15px' }}
/>
</a>
)}
</div>
)}
</div>
))}
</div>
</div>
Expand Down
24 changes: 24 additions & 0 deletions spec/system/visit_site_pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,30 @@
expect(page).to have_text(meetup.title)
end

it 'visits past meetup and displays speaker with valid links' do
meetup = create(:event, date: Date.new(2024, 2, 17), title: 'Meetup February 2024')
speaker = create(:speaker, :with_valid_links)
speaker2 = create(:speaker, :with_valid_links, links: {mastodon: Faker::Internet.url})
create(:talk, speaker: speaker, event: meetup)
create(:talk, speaker: speaker2, event: meetup)

visit "/meetups/#{meetup.date.year}/#{meetup.date.month}/#{meetup.date.day}"

expect(page).to have_link(href: speaker2.links['mastodon'].to_s, exact: true)
expect(meetup.speakers.count).to eq(2)
end

it 'visits past meetup and displays available valid links speaker only' do
meetup = create(:event, date: Date.new(2024, 2, 17), title: 'Meetup February 2024')
speaker = create(:speaker, links: { mastodon: Faker::Internet.url })
create(:talk, speaker: speaker, event: meetup)

visit "/meetups/#{meetup.date.year}/#{meetup.date.month}/#{meetup.date.day}"

expect(page).not_to have_link(href: speaker.links['twitter'].to_s, exact: true)
expect(meetup.speakers.count).to eq(1)
end

context 'visit to unknown path' do
before do
method = Rails.application.method(:env_config)
Expand Down

0 comments on commit 29b7cd8

Please sign in to comment.