diff --git a/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/Results/ResultsModalOption.tsx b/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/Results/ResultsModalOption.tsx index 03a0427..149f711 100644 --- a/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/Results/ResultsModalOption.tsx +++ b/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/Results/ResultsModalOption.tsx @@ -2,6 +2,7 @@ import { AccordionIcon } from '@chakra-ui/react'; import { makeStyles } from '@material-ui/core/styles'; import React from 'react'; import { ResultsDisplay } from '../../../../../../types/CoveyTownSocket'; +import TextWithHyperlink from '../TextWithHyperlink'; interface ResultsModalOptionProps { result: ResultsDisplay; @@ -91,7 +92,9 @@ export default function ResultsModalOption({ }} className={classes.bar}>
-
{result.option}
+
+ +
{youVotedFor && (
diff --git a/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/TextWithHyperlink.tsx b/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/TextWithHyperlink.tsx new file mode 100644 index 0000000..3dee75a --- /dev/null +++ b/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/TextWithHyperlink.tsx @@ -0,0 +1,30 @@ +import React from 'react'; + +export default function TextWithHyperlink(props: { + text: string; + className: string; + selected: boolean; +}) { + const urlRegex = /(https?:\/\/[^\s]+)/gi; + const match = props.text.match(urlRegex); + + if (match && match.length > 0) { + return ( +
+

+ {props.text} +

+ + + + + +
+ ); + } + + return

{props.text}

; +} diff --git a/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/VotePoll/VotePollModalBody.tsx b/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/VotePoll/VotePollModalBody.tsx index 7ee0b5f..6c84e18 100644 --- a/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/VotePoll/VotePollModalBody.tsx +++ b/frontend/src/components/VideoCall/VideoFrontend/components/PollsWindow/VotePoll/VotePollModalBody.tsx @@ -1,6 +1,7 @@ import { Button, Stack, Tag, TagLabel, Tooltip } from '@chakra-ui/react'; import { makeStyles } from '@material-ui/core/styles'; import React, { useCallback } from 'react'; +import TextWithHyperlink from '../TextWithHyperlink'; const useStyles = makeStyles({ specialMessage: { @@ -120,7 +121,9 @@ export default function VotePollModalBody({
{question}
-
Asked by {creator}
+
+ Asked by {creator} +
updateOptions(option.id)}> -

{option.text}

+ {option.selected && } ))}