fix(mobile): show Refresh thumbnail only when preview missing or broken

The Refresh thumbnail button appeared on every scene, which is noise for the majority
that already have a good preview (report 26c114ed). Show it only when no source has a
usable thumbnail or the only thumbnails are rotting (sxyprn/trafficdeposit), which is
exactly when a manual refresh helps (the original d3376a71 case).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jtrzupek 2026-06-14 11:17:18 +02:00
parent 29da1fbaa6
commit 08410fddd1

View file

@ -238,17 +238,27 @@ export function SceneDetailScreen() {
<Hero data={data} />
<View style={styles.body}>
{data.playback_sources.some((s) => s.origin?.startsWith('tube:')) && (
<Pressable
style={styles.refreshThumbBtn}
onPress={() => refreshThumbMutation.mutate()}
disabled={refreshThumbMutation.isPending}
>
<Text style={styles.refreshThumbText}>
{refreshThumbMutation.isPending ? 'Refreshing thumbnail…' : '↻ Refresh thumbnail'}
</Text>
</Pressable>
)}
{/* Refresh tylko gdy BRAK dobrej miniatury (brak w ogóle lub rotting sxyprn/
trafficdeposit) feedback 26c114ed: na scenach z dobrą miniaturą przycisk
był zbędnym szumem. Dla zepsutych/stałych nadal się pojawia (cel d3376a71). */}
{(() => {
const hasTube = data.playback_sources.some((s) => s.origin?.startsWith('tube:'));
const hasGoodThumb = data.playback_sources.some(
(s) => s.thumbnail_url && !/trafficdeposit|sxyprn|\/proxy\/sxyprn-thumb/i.test(s.thumbnail_url),
);
if (!hasTube || hasGoodThumb) return null;
return (
<Pressable
style={styles.refreshThumbBtn}
onPress={() => refreshThumbMutation.mutate()}
disabled={refreshThumbMutation.isPending}
>
<Text style={styles.refreshThumbText}>
{refreshThumbMutation.isPending ? 'Refreshing thumbnail…' : '↻ Refresh thumbnail'}
</Text>
</Pressable>
);
})()}
{(data.code || data.director) && (
<View style={styles.metaRow}>