diff --git a/package.json b/package.json index 592b2fd..ddcfb43 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "skate-spots", "private": true, - "version": "1.2.35", + "version": "1.2.36", "type": "module", "homepage": "https://skate-spots.com", "scripts": { diff --git a/src/pages/MapPage.tsx b/src/pages/MapPage.tsx index 628e7d5..fda8625 100644 --- a/src/pages/MapPage.tsx +++ b/src/pages/MapPage.tsx @@ -98,10 +98,16 @@ function MiniStashCard({ item, onDelete }: { item: StashItem; onDelete: () => vo const hasImage = item.images && item.images.length > 0; return ( -
+
{/* Wishlist badge */} {isWishlist && ( @@ -833,27 +839,28 @@ export default function MapPage() { return true; }); - // Apply trust filter — when 'trusted', sort trusted content to the top - // rather than hiding untrusted content (avoids penalising new users/anon browsers) - // Strict filtering (verified/following) still hides low-trust content as expected - if (trustScores && trustFilter !== 'all') { - if (trustFilter === 'trusted') { - // Soft mode: sort trusted first, keep everything visible - filtered.sort((a, b) => { - const scoreA = getTrustScore(a.pubkey) ?? -1; - const scoreB = getTrustScore(b.pubkey) ?? -1; - const trustedA = scoreA >= 60 ? 1 : 0; - const trustedB = scoreB >= 60 ? 1 : 0; - return trustedB - trustedA; - }); - } else { - // Strict modes (verified, following) — actually filter - filtered = filterByTrustLevel(filtered, trustFilter, getTrustScore); - } + // Apply trust filter. + // • 'trusted' (soft): keep everything visible but float trusted content to + // the top. This must be folded into the MAIN sort below as its primary + // key — running it as a separate .sort() first is pointless because the + // sort() that follows would immediately re-order everything and wipe it + // out (which it silently did for the default trusted+recent combo). + // • 'verified'/'following' (strict): actually hide low-trust content. + const softTrust = trustFilter === 'trusted'; + if (trustScores && trustFilter !== 'all' && !softTrust) { + filtered = filterByTrustLevel(filtered, trustFilter, getTrustScore); } - // Apply sorting + // Trust tier (1 = trusted, 0 = not) used as the primary sort key in soft mode. + const trustTier = (pubkey: string) => ((getTrustScore(pubkey) ?? -1) >= 60 ? 1 : 0); + + // Apply sorting. In soft-trust mode, trusted content sorts first and the + // chosen `sortBy` becomes the tiebreaker WITHIN each trust tier. filtered.sort((a, b) => { + if (softTrust && trustScores) { + const tierDiff = trustTier(b.pubkey) - trustTier(a.pubkey); + if (tierDiff !== 0) return tierDiff; + } switch (sortBy) { case 'trust': { const scoreA = getTrustScore(a.pubkey) || 0;