File tree Expand file tree Collapse file tree
core/strategies/resultFormatters
ui/formatters/authorities Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,11 +4,11 @@ import { createCompositeKeyBuilder } from '../../utils';
44const parseTypeLabel = ( typeUri : string ) : string => {
55 const lastSlash = typeUri . lastIndexOf ( '/' ) ;
66
7- return lastSlash !== - 1 ? typeUri . slice ( lastSlash + 1 ) : typeUri ;
7+ return lastSlash === - 1 ? typeUri : typeUri . slice ( lastSlash + 1 ) ;
88} ;
99
1010const formatIdentifiers = ( identifiers ?: LDAuthorityIdentifier [ ] ) : string =>
11- identifiers ?. map ( i => i . value . trim ( ) ) . join ( ', ' ) ?? '' ;
11+ identifiers ?. map ( ( { value } ) => value . trim ( ) ) . join ( ', ' ) ?? '' ;
1212
1313export class LDAuthoritiesResultFormatter implements IResultFormatter < SearchResultsTableRow > {
1414 format ( data : unknown [ ] ) : SearchResultsTableRow [ ] {
Original file line number Diff line number Diff line change @@ -7,12 +7,9 @@ interface AuthorityLabelFormatterProps {
77 onTitleClick ?: ( id : string ) => void ;
88}
99
10- export const AuthorityLabelFormatter : FC < AuthorityLabelFormatterProps > = ( { row } ) => {
10+ export const AuthorityLabelFormatter : FC < AuthorityLabelFormatterProps > = ( { row, onTitleClick } ) => {
1111 const title = row . label ?. label as string ;
1212
13- // TODO: add event handler to display preview
14- const onTitleClick = ( ) => { } ;
15-
1613 if ( ! title ) {
1714 return < span /> ;
1815 }
@@ -21,7 +18,7 @@ export const AuthorityLabelFormatter: FC<AuthorityLabelFormatterProps> = ({ row
2118 < Button
2219 type = { ButtonType . Link }
2320 className = "authority-link"
24- onClick = { onTitleClick }
21+ onClick = { ( ) => onTitleClick ?. ( row . __meta . id ) }
2522 data-testid = { `authority-preview-link-${ row . __meta . id } ` }
2623 >
2724 { title }
You can’t perform that action at this time.
0 commit comments