diff --git a/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx b/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx index ddc270b15..3feb34a2e 100755 --- a/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx +++ b/ui/v2.5/src/components/Tagger/scenes/StashSearchResult.tsx @@ -95,7 +95,13 @@ function matchPhashes( } }); - return matches; + // convert to tuple and sort by distance descending + const entries = Object.entries(matches); + entries.sort((a, b) => { + return a[1] - b[1]; + }); + + return entries; } const getFingerprintStatus = ( @@ -122,7 +128,7 @@ const getFingerprintStatus = ( const phashList = (
- {Object.entries(phashMatches).map((fp) => { + {phashMatches.map((fp: [string, number]) => { const hash = fp[0]; const d = fp[1]; return ( @@ -137,37 +143,43 @@ const getFingerprintStatus = ( if (checksumMatch || phashMatches.length > 0) return ( -
- - {phashMatches.length > 0 ? ( - - {phashMatches.length > 1 ? ( - - ) : ( - , - }} - /> - )} - - ) : ( - , - }} - /> +
+ {phashMatches.length > 0 && ( +
+ + + {phashMatches.length > 1 ? ( + + ) : ( + , + }} + /> + )} + +
+ )} + {checksumMatch && ( +
+ + , + }} + /> +
)}
);