@@ -865,7 +865,6 @@ function OverviewChanges({
865865 gridRow : "5" ,
866866 } }
867867 />
868-
869868 < TrackChangesDetailItem
870869 kind = "extra_tracks"
871870 sx = { {
@@ -928,54 +927,55 @@ function TrackChangesDetailItem({
928927} : {
929928 kind : string ;
930929} & BoxProps ) {
931- const { extra_tracks, extra_items, candidate } = useTrackDiffContext ( ) ;
930+ const { extra_tracks, extra_items, candidate, nChanges, pairs } =
931+ useTrackDiffContext ( ) ;
932932
933933 const [ open , setOpen ] = useState ( false ) ;
934934
935935 const icon = < PenaltyTypeIcon type = { kind } /> ;
936936 let text = "Track Changes" ;
937- let i : string ;
937+ let dialogTitle : string | null = null ;
938+ let pl : string ;
938939 let color : string | undefined = undefined ;
939940 let tooltip : string | undefined = undefined ;
940941 let content : ReactNode | null = null ;
942+
941943 switch ( kind ) {
942944 case "track_changes" :
943- content = < TrackChanges /> ;
944945 if ( candidate . penalties . includes ( "tracks" ) ) {
945946 // TODO: get number of changed tracks, but that is currently
946947 // deeply nested in the subcomponent...
947948 text = "Tracks changed" ;
949+ dialogTitle = `${ nChanges } of ${ pairs . length } tracks changed` ;
948950 color = "diffs.changed" ;
949951 tooltip =
950952 "Shows which items (on disk) are mapped to tracks (from the candidate). Changes are highlighted in red and green." ;
953+ content = < TrackChanges /> ;
951954 } else {
952955 text = "No severe track changes" ;
953956 }
954957 break ;
955958 case "extra_items" :
956- content = < ExtraTracks /> ;
957- if ( candidate . penalties . includes ( "unmatched_tracks" ) ) {
958- i = "item" + ( extra_items . length !== 1 ? "s" : "" ) ;
959- text = `${ extra_items . length } ${ i } items on disk not part of the candidate` ;
959+ if ( candidate . penalties . includes ( "missing_tracks" ) ) {
960+ pl = "track" + ( extra_tracks . length !== 1 ? "s" : "" ) ;
961+ text = `${ extra_tracks . length } ${ pl } missing on disk` ;
960962 color = "diffs.changed" ;
961963 tooltip =
962- "Items that could not be matched to tracks, they will be ignored if this candidate is chosen." ;
964+ "Tracks found online that could not be matched to tracks on disk (usually because they are missing)." ;
965+ content = < ExtraTracks /> ;
963966 } else {
964- text = "All items found on disk" ;
965- content = undefined ;
967+ text = "All tracks online present on disk" ;
966968 }
967969 break ;
968970 case "extra_tracks" :
969- content = < ExtraItems /> ;
970- if ( candidate . penalties . includes ( "missing_tracks" ) ) {
971- i = "track" + ( extra_tracks . length !== 1 ? "s" : "" ) ;
972- text = `${ extra_tracks . length } ${ i } missing on disk` ;
971+ if ( candidate . penalties . includes ( "unmatched_tracks" ) ) {
972+ pl = "item" + ( extra_items . length !== 1 ? "s" : "" ) ;
973+ text = `${ extra_items . length } ${ pl } tracks on disk not part of the candidate` ;
973974 color = "diffs.changed" ;
974- tooltip =
975- "Tracks that could not be matched to any items on disk (usually because they are missing)." ;
975+ tooltip = "Tracks on disk that could not be matched to tracks online." ;
976+ content = < ExtraItems /> ;
976977 } else {
977- text = "All tracks found online" ;
978- content = undefined ;
978+ text = "All tracks on disk found online" ;
979979 }
980980 break ;
981981 default :
@@ -1000,7 +1000,7 @@ function TrackChangesDetailItem({
10001000 onClose = { ( ) => {
10011001 setOpen ( false ) ;
10021002 } }
1003- title = { text }
1003+ title = { dialogTitle || text }
10041004 title_icon = { icon }
10051005 >
10061006 < DialogContent > { content } </ DialogContent >
0 commit comments