Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add links to speaker in meetup page #236

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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