Skip to content

Commit

Permalink
Linkify urls in playlist comments
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Oct 7, 2022
1 parent c530ccf commit 53a4ea6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ui/src/album/AlbumDetails.js
Expand Up @@ -33,7 +33,7 @@ import {
import config from '../config'
import { intersperse } from '../utils'
import AlbumExternalLinks from './AlbumExternalLinks'
import AnchorMe from '../common/AnchorMe'
import AnchorMe from '../common/Linkify'

const useStyles = makeStyles(
(theme) => ({
Expand Down
6 changes: 3 additions & 3 deletions ui/src/common/AnchorMe.js → ui/src/common/Linkify.js
Expand Up @@ -13,7 +13,7 @@ const useStyles = makeStyles(
{ name: 'RaLink' }
)

const AnchorMe = ({ text, ...rest }) => {
const Linkify = ({ text, ...rest }) => {
const classes = useStyles()
const linkify = useCallback((text) => {
const urlRegex =
Expand Down Expand Up @@ -66,8 +66,8 @@ const AnchorMe = ({ text, ...rest }) => {
return <>{parsedText}</>
}

AnchorMe.propTypes = {
Linkify.propTypes = {
text: PropTypes.string,
}

export default React.memo(AnchorMe)
export default React.memo(Linkify)
5 changes: 4 additions & 1 deletion ui/src/playlist/PlaylistDetails.js
Expand Up @@ -3,6 +3,7 @@ import { Card, CardContent, Typography } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import { useTranslate } from 'react-admin'
import { DurationField, SizeField } from '../common'
import Linkify from '../common/Linkify'

const useStyles = makeStyles(
(theme) => ({
Expand Down Expand Up @@ -51,7 +52,9 @@ const PlaylistDetails = (props) => {
<Typography variant="h5" className={classes.title}>
{record.name || translate('ra.page.loading')}
</Typography>
<Typography component="h6">{record.comment}</Typography>
<Typography component="h6">
<Linkify text={record.comment} />
</Typography>
<Typography component="p">
{record.songCount ? (
<span>
Expand Down

0 comments on commit 53a4ea6

Please sign in to comment.