@@ -13,7 +13,9 @@ import { useIntersect } from '../../../../../hooks/useIntersect.js'
1313import { useConfig } from '../../../../../providers/Config/index.js'
1414import { useTranslation } from '../../../../../providers/Translation/index.js'
1515import { canUseDOM } from '../../../../../utilities/canUseDOM.js'
16+ import { formatAdminURL } from '../../../../../utilities/formatAdminURL.js'
1617import { formatDocTitle } from '../../../../../utilities/formatDocTitle/index.js'
18+ import { Link } from '../../../../Link/index.js'
1719import { useListRelationships } from '../../../RelationshipProvider/index.js'
1820import { FileCell } from '../File/index.js'
1921import './index.scss'
@@ -43,6 +45,7 @@ export const RelationshipCell: React.FC<RelationshipCellProps> = ({
4345
4446 const { config, getEntityConfig } = useConfig ( )
4547 const { collections, routes } = config
48+ const { admin : adminRoute } = routes
4649 const [ intersectionRef , entry ] = useIntersect ( )
4750 const [ values , setValues ] = useState < Value [ ] > ( [ ] )
4851 const { documents, getRelationships } = useListRelationships ( )
@@ -128,11 +131,22 @@ export const RelationshipCell: React.FC<RelationshipCellProps> = ({
128131 }
129132 }
130133
134+ const documentHref = formatAdminURL ( {
135+ adminRoute,
136+ path : `/collections/${ relationTo } /${ encodeURIComponent ( value ) } ` ,
137+ } )
138+
131139 return (
132140 < React . Fragment key = { i } >
133141 { document === false && `${ t ( 'general:untitled' ) } - ID: ${ value } ` }
134142 { document === null && `${ t ( 'general:loading' ) } ...` }
135- { document ? fileField || label : null }
143+ { document
144+ ? fileField || (
145+ < Link href = { documentHref } prefetch = { false } >
146+ { label }
147+ </ Link >
148+ )
149+ : null }
136150 { values . length > i + 1 && ', ' }
137151 </ React . Fragment >
138152 )
0 commit comments