Skip to content

Commit

Permalink
Update logic to get twitter username in SpeakerDetail component droid…
Browse files Browse the repository at this point in the history
  • Loading branch information
JNicolao committed Oct 30, 2024
1 parent 0e48893 commit 06e0452
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion components/sessions/SpeakersDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ export const SpeakersDetails = ({ session }: { session: Session }) => {
if (!showChild) {
return null
}

const getTwitterUsername = (url: string) => {
if (url.includes('twitter.com/')) {
return url.split('twitter.com/')[1]
}
if (url.includes('x.com/')) {
return url.split('x.com/')[1]
}
return null
}

return (
<div className="w-full flex-wrap lg:w-4/12 flex border-r-0 pr-0 lg:pr-4 mb-6 md:mb-0">
<div className="w-full py-4">
Expand Down Expand Up @@ -63,7 +74,7 @@ export const SpeakersDetails = ({ session }: { session: Session }) => {
>
@
{speaker.twitter
? speaker.twitter.split('twitter.com/')[1]
? getTwitterUsername(speaker.twitter)
: speaker.name}
</a>
</a>
Expand Down

0 comments on commit 06e0452

Please sign in to comment.