Skip to content

Commit 5a9fae0

Browse files
committed
update logic to extract twitter username
1 parent ce78b1b commit 5a9fae0

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

components/sessions/SpeakersDetails.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ export const SpeakersDetails = ({ session }: { session: Session }) => {
1414
if (!showChild) {
1515
return null
1616
}
17+
18+
const getTwitterUsername = (url: string) => {
19+
if (url.includes('twitter.com/')) {
20+
return url.split('twitter.com/')[1]
21+
}
22+
if (url.includes('x.com/')) {
23+
return url.split('x.com/')[1]
24+
}
25+
return null
26+
}
1727
return (
1828
<div className="w-full flex-wrap lg:w-4/12 flex border-r-0 pr-0 lg:pr-4 mb-6 md:mb-0">
1929
<div className="w-full py-4">
@@ -63,7 +73,7 @@ export const SpeakersDetails = ({ session }: { session: Session }) => {
6373
>
6474
@
6575
{speaker.twitter
66-
? speaker.twitter.split('twitter.com/')[1]
76+
? getTwitterUsername(speaker.twitter)
6777
: speaker.name}
6878
</a>
6979
</a>

0 commit comments

Comments
 (0)