Restore ALT badges in quoted posts (#10964)

Co-authored-by: Eric Bailey <git@esb.lol>
This commit is contained in:
Jerry Chen
2026-06-22 13:05:50 -06:00
committed by GitHub
parent dd452a4336
commit 495d1fe9a7
4 changed files with 17 additions and 27 deletions
-1
View File
@@ -142,7 +142,6 @@ export function ImageEmbed({
onPress(0, [containerRef], [dims]) onPress(0, [containerRef], [dims])
} }
onPressIn={() => onPressIn(0)} onPressIn={() => onPressIn(0)}
hideBadge={rest.isWithinQuote}
/> />
</ImageContextMenu> </ImageContextMenu>
</View> </View>
+8 -7
View File
@@ -65,7 +65,6 @@ export function ConstrainedImage({
export function AutoSizedImage({ export function AutoSizedImage({
image, image,
crop = 'constrained', crop = 'constrained',
hideBadge,
onPress, onPress,
onLongPress, onLongPress,
onPressIn, onPressIn,
@@ -74,7 +73,6 @@ export function AutoSizedImage({
}: { }: {
image: AppBskyEmbedImages.ViewImage image: AppBskyEmbedImages.ViewImage
crop?: 'none' | 'square' | 'constrained' crop?: 'none' | 'square' | 'constrained'
hideBadge?: boolean
onPress?: ( onPress?: (
containerRef: AnimatedRef<any>, containerRef: AnimatedRef<any>,
fetchedDims: Dimensions | null, fetchedDims: Dimensions | null,
@@ -146,7 +144,7 @@ export function AutoSizedImage({
/> />
<MediaInsetBorder /> <MediaInsetBorder />
{(hasAlt || isCropped) && !hideBadge ? ( {hasAlt || isCropped ? (
<View <View
accessible={false} accessible={false}
style={[ style={[
@@ -165,8 +163,10 @@ export function AutoSizedImage({
]}> ]}>
{isCropped && ( {isCropped && (
<View <View
accessible={false}
style={[ style={[
a.rounded_xs, a.rounded_sm,
a.p_xs,
t.atoms.bg_contrast_25, t.atoms.bg_contrast_25,
{ {
padding: 3, padding: 3,
@@ -186,17 +186,18 @@ export function AutoSizedImage({
)} )}
{hasAlt && ( {hasAlt && (
<View <View
accessible={false}
style={[ style={[
a.justify_center, a.justify_center,
a.rounded_xs, a.rounded_sm,
a.p_xs,
t.atoms.bg_contrast_25, t.atoms.bg_contrast_25,
{ {
padding: 3,
opacity: 0.8, opacity: 0.8,
}, },
largeAlt && [ largeAlt && [
{ {
padding: 5, padding: 6,
}, },
], ],
]}> ]}>
+4 -7
View File
@@ -115,7 +115,6 @@ export function Gallery({
const bps = useBreakpoints() const bps = useBreakpoints()
const window = useWindowDimensions() const window = useWindowDimensions()
const isWithinChat = viewContext === PostEmbedViewContext.ChatMessage const isWithinChat = viewContext === PostEmbedViewContext.ChatMessage
const hideBadges = isWithinQuote
const contentHeight = useMemo(() => { const contentHeight = useMemo(() => {
if (isWithinChat) { if (isWithinChat) {
return 120 return 120
@@ -250,7 +249,6 @@ export function Gallery({
onPress?.(index, [containerRef], [dims]) onPress?.(index, [containerRef], [dims])
} }
onPressIn={() => onPressIn?.(index)} onPressIn={() => onPressIn?.(index)}
hideBadge={isWithinQuote}
/> />
))} ))}
</View> </View>
@@ -300,7 +298,6 @@ export function Gallery({
: undefined : undefined
return ( return (
<GalleryImage <GalleryImage
hideBadges={hideBadges}
largeAltBadge={largeAltBadge} largeAltBadge={largeAltBadge}
image={item} image={item}
contentHeight={contentHeight} contentHeight={contentHeight}
@@ -396,7 +393,6 @@ function GalleryImage({
imageCount, imageCount,
onWidthChange, onWidthChange,
itemRef, itemRef,
hideBadges,
largeAltBadge, largeAltBadge,
onContainerRef, onContainerRef,
onThumbDims, onThumbDims,
@@ -410,7 +406,6 @@ function GalleryImage({
imageCount: number imageCount: number
onWidthChange: (index: number, width: number) => void onWidthChange: (index: number, width: number) => void
itemRef: (node: View | null) => void itemRef: (node: View | null) => void
hideBadges?: boolean
largeAltBadge?: boolean largeAltBadge?: boolean
onContainerRef: (index: number, ref: AnimatedRef<any>) => void onContainerRef: (index: number, ref: AnimatedRef<any>) => void
onThumbDims: (index: number, dims: Dimensions) => void onThumbDims: (index: number, dims: Dimensions) => void
@@ -499,7 +494,7 @@ function GalleryImage({
useAppleWebpCodec useAppleWebpCodec
/> />
{!hideBadges && imageCount > 1 ? ( {imageCount > 1 ? (
<View <View
accessible={false} accessible={false}
pointerEvents="none" pointerEvents="none"
@@ -532,7 +527,7 @@ function GalleryImage({
</View> </View>
) : null} ) : null}
{(hasAlt || isCropped) && !hideBadges ? ( {hasAlt || isCropped ? (
<View <View
accessible={false} accessible={false}
style={[ style={[
@@ -549,6 +544,7 @@ function GalleryImage({
]}> ]}>
{isCropped && ( {isCropped && (
<View <View
accessible={false}
style={[ style={[
a.rounded_sm, a.rounded_sm,
a.p_xs, a.p_xs,
@@ -568,6 +564,7 @@ function GalleryImage({
)} )}
{hasAlt && ( {hasAlt && (
<View <View
accessible={false}
style={[ style={[
a.justify_center, a.justify_center,
a.rounded_sm, a.rounded_sm,
+5 -12
View File
@@ -12,7 +12,7 @@ import {useLargeAltBadgeEnabled} from '#/state/preferences/large-alt-badge'
import {atoms as a, tokens, useTheme} from '#/alf' import {atoms as a, tokens, useTheme} from '#/alf'
import {MediaInsetBorder} from '#/components/MediaInsetBorder' import {MediaInsetBorder} from '#/components/MediaInsetBorder'
import {ImageContextMenu} from '#/components/Post/Embed/ImageContextMenu' import {ImageContextMenu} from '#/components/Post/Embed/ImageContextMenu'
import {PostEmbedViewContext} from '#/components/Post/Embed/types' import {type PostEmbedViewContext} from '#/components/Post/Embed/types'
import {Text} from '#/components/Typography' import {Text} from '#/components/Typography'
type EventFunction = (index: number) => void type EventFunction = (index: number) => void
@@ -42,8 +42,6 @@ export function GalleryItem({
onPress, onPress,
onPressIn, onPressIn,
onLongPress, onLongPress,
viewContext,
isWithinQuote,
insetBorderStyle, insetBorderStyle,
containerRefs, containerRefs,
thumbDimsRef, thumbDimsRef,
@@ -53,9 +51,6 @@ export function GalleryItem({
const largeAltBadge = useLargeAltBadgeEnabled() const largeAltBadge = useLargeAltBadgeEnabled()
const image = images[index] const image = images[index]
const hasAlt = !!image.alt const hasAlt = !!image.alt
const hideBadges =
isWithinQuote ??
viewContext === PostEmbedViewContext.FeedEmbedRecordWithMedia
const aspect = const aspect =
image.aspectRatio && image.aspectRatio.height > 0 image.aspectRatio && image.aspectRatio.height > 0
@@ -114,26 +109,24 @@ export function GalleryItem({
<MediaInsetBorder style={insetBorderStyle} /> <MediaInsetBorder style={insetBorderStyle} />
</Pressable> </Pressable>
</ImageContextMenu> </ImageContextMenu>
{hasAlt && !hideBadges ? ( {hasAlt ? (
<View <View
accessible={false} accessible={false}
style={[ style={[
a.absolute, a.absolute,
a.flex_row, a.flex_row,
a.align_center, a.align_center,
a.rounded_xs, a.rounded_sm,
a.p_xs,
t.atoms.bg_contrast_25, t.atoms.bg_contrast_25,
{ {
gap: 3,
padding: 3,
bottom: a.p_xs.padding, bottom: a.p_xs.padding,
right: a.p_xs.padding, right: a.p_xs.padding,
opacity: 0.8, opacity: 0.8,
}, },
largeAltBadge && [ largeAltBadge && [
{ {
gap: 4, padding: 6,
padding: 5,
}, },
], ],
]}> ]}>