Skip to content

Commit

Permalink
chore: cleanup images, officially retire OpaqueImageView (#11264)
Browse files Browse the repository at this point in the history
* remove stable palette image flag

* delete OpaqueImageView2 component, default to OpaqueImageView

* remove usage in ArticleCard

* remove usage in ArtistShow

* remove usage in ArtistAutosuggestRow

* remove usage in ArtworkListImage

* remove usage in SavedItemRow

* remove usage in ShowItemRow

* remove usage in SaleArtworkTileRailCard

* remove usage in Toast

* remove usage in ArtistSeriesHeader

* remove usage in ArtistSeriesListItem

* remove usage in TabFairItemRow

* remove comment in DeepZoomTile

* remove all simple usages

* remove more simple usages

* remove my collection usage

* use util from palette

* replace usage in ShowContextCard

* replace usage in ImageZoomView

* delete OpaqueImageView code

* fix artist list item test

* fix collection header test

* fix collectionArtistSeriesRail test

* fix showContextCard test

* fix saleArtworkTileRailCard tests

* fix broken FairEventSectionCard

* fix broken ActiveBid

* fix broken ImagePreview

* fix broken conversation components
  • Loading branch information
brainbicycle authored Dec 11, 2024
1 parent 4e7c837 commit 4b6a47d
Show file tree
Hide file tree
Showing 55 changed files with 279 additions and 604 deletions.
27 changes: 16 additions & 11 deletions src/app/Components/ArticleCard.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { Spacer, Flex, useTheme, Text, Touchable, SkeletonBox, SkeletonText } from "@artsy/palette-mobile"
import {
Spacer,
Flex,
useTheme,
Text,
Touchable,
SkeletonBox,
SkeletonText,
Image,
} from "@artsy/palette-mobile"
import { ArticleCard_article$data } from "__generated__/ArticleCard_article.graphql"
import { OpaqueImageView } from "app/Components/OpaqueImageView2"
import { navigate } from "app/system/navigation/navigate"
import { compact } from "lodash"
import { DateTime } from "luxon"
Expand Down Expand Up @@ -42,8 +50,8 @@ export const ArticleCard: React.FC<ArticleCardProps> = ({ article, onPress, isFl
(isFluid ? (
<>
<View style={{ width }}>
<OpaqueImageView
imageURL={imageURL}
<Image
src={imageURL}
// aspect ratio is fixed to 1.33 to match the old image aspect ratio
aspectRatio={1.33}
// 40 here comes from the mx={2} from the parent component
Expand All @@ -52,8 +60,8 @@ export const ArticleCard: React.FC<ArticleCardProps> = ({ article, onPress, isFl
</View>
</>
) : (
<OpaqueImageView
imageURL={imageURL}
<Image
src={imageURL}
width={ARTICLE_CARD_IMAGE_WIDTH}
height={ARTICLE_CARD_IMAGE_HEIGHT}
/>
Expand Down Expand Up @@ -97,10 +105,7 @@ export const ArticleCardContainer = createFragmentContainer(ArticleCard, {

export const SkeletonArticleCard: React.FC = () => (
<Flex maxWidth={ARTICLE_CARD_IMAGE_WIDTH}>
<SkeletonBox
height={ARTICLE_CARD_IMAGE_HEIGHT}
width={ARTICLE_CARD_IMAGE_WIDTH}
/>
<SkeletonBox height={ARTICLE_CARD_IMAGE_HEIGHT} width={ARTICLE_CARD_IMAGE_WIDTH} />
<Spacer y={1} />
<SkeletonText variant="lg-display" mb={0.5}>
10 Shows we suggest you don't miss during Berlin Art Week
Expand All @@ -113,4 +118,4 @@ export const SkeletonArticleCard: React.FC = () => (
Art • Sep 10, 2024
</SkeletonText>
</Flex>
)
)
19 changes: 10 additions & 9 deletions src/app/Components/Artist/ArtistShows/ArtistShow.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ActionType, ContextModule, OwnerType, TappedShowGroup } from "@artsy/cohesion"
import { Touchable } from "@artsy/palette-mobile"
import { Image, Touchable } from "@artsy/palette-mobile"
import { ArtistShow_show$data, ArtistShow_show$key } from "__generated__/ArtistShow_show.graphql"
import OpaqueImageView from "app/Components/OpaqueImageView/OpaqueImageView"
import { navigate } from "app/system/navigation/navigate"
import { useFeatureFlag } from "app/utils/hooks/useFeatureFlag"
import { hrefForPartialShow } from "app/utils/router"
Expand Down Expand Up @@ -42,13 +41,15 @@ export const ArtistShow: React.FC<Props> = ({ styles, show, index, imageDimensio
<Touchable onPress={handleTap} haptic>
<View style={[styles?.container]}>
<View style={[styles?.imageMargin]}>
<OpaqueImageView
imageURL={imageURL}
width={imageDimensions.width}
height={imageDimensions.height}
blurhash={showBlurhash ? image?.blurhash : undefined}
style={[{ overflow: "hidden", borderRadius: 2, flex: 0 }]}
/>
{!!imageURL && (
<Image
src={imageURL}
width={imageDimensions.width}
height={imageDimensions.height}
blurhash={showBlurhash ? image?.blurhash : undefined}
style={[{ overflow: "hidden", borderRadius: 2, flex: 0 }]}
/>
)}
</View>
{/* this wrapper required to make numberOfLines work when parent is a row */}
<View style={{ flex: 1 }}>
Expand Down
21 changes: 11 additions & 10 deletions src/app/Components/ArtistAutosuggest/ArtistAutosuggestRow.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Spacer, Flex } from "@artsy/palette-mobile"
import { Spacer, Flex, Image } from "@artsy/palette-mobile"
import { AutosuggestResult } from "app/Components/AutosuggestResults/AutosuggestResults"
import OpaqueImageView from "app/Components/OpaqueImageView/OpaqueImageView"
import { ResultWithHighlight } from "app/Scenes/Search/components/ResultWithHighlight"
import { TouchableWithoutFeedback } from "react-native"

Expand All @@ -19,14 +18,16 @@ export const ArtistAutosuggestRow: React.FC<Props> = ({ result, highlight, onRes
testID={`artist-suggestion-${result.internalID}`}
>
<Flex height={IMAGE_SIZE} flexDirection="row" alignItems="center">
<OpaqueImageView
imageURL={result.imageUrl}
width={IMAGE_SIZE}
height={IMAGE_SIZE}
style={{
overflow: "hidden",
}}
/>
{!!result.imageUrl && (
<Image
src={result.imageUrl}
width={IMAGE_SIZE}
height={IMAGE_SIZE}
style={{
overflow: "hidden",
}}
/>
)}
<Spacer x={1} />
<Flex flex={1}>
{!!result.displayLabel && (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Flex, FlexProps } from "@artsy/palette-mobile"
import { Flex, FlexProps, Image } from "@artsy/palette-mobile"
import { ArtworkListNoImage } from "app/Components/ArtworkLists/components/ArtworkListNoImage"
import { OpaqueImageView } from "app/Components/OpaqueImageView2"
import { FC } from "react"

export interface ArtworkListImageProps extends FlexProps {
Expand All @@ -18,7 +17,7 @@ export const ArtworkListImage: FC<ArtworkListImageProps> = ({
return (
<Flex bg="black5" {...rest}>
{imageURL ? (
<OpaqueImageView imageURL={imageURL} width={size} height={size} useRawURL={true} />
<Image src={imageURL} width={size} height={size} performResize={false} />
) : (
<ArtworkListNoImage
width={size}
Expand Down
9 changes: 2 additions & 7 deletions src/app/Components/Cards/MediumCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Spacer, Flex, Box, BoxProps, useTheme, Text } from "@artsy/palette-mobile"
import { OpaqueImageView as NewOpaqueImageView } from "app/Components/OpaqueImageView2"
import { Spacer, Flex, Box, BoxProps, useTheme, Text, Image } from "@artsy/palette-mobile"
import LinearGradient from "react-native-linear-gradient"
import { CardTag, CardTagProps } from "./CardTag"

Expand Down Expand Up @@ -30,11 +29,7 @@ export const MediumCard: React.FC<MediumCardProps> = ({ image, title, subtitle,
{...rest}
>
<Flex flex={2} backgroundColor="black10">
<NewOpaqueImageView
imageURL={image}
height={MEDIUM_CARD_HEIGHT}
width={MEDIUM_CARD_WIDTH}
/>
<Image src={image} height={MEDIUM_CARD_HEIGHT} width={MEDIUM_CARD_WIDTH} />
</Flex>
<LinearGradient
colors={["rgba(0, 0, 0, 0)", "rgba(0, 0, 0, 1)"]}
Expand Down
5 changes: 2 additions & 3 deletions src/app/Components/Lists/SavedItemRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Spacer, Flex, useColor, Text, Touchable } from "@artsy/palette-mobile"
import OpaqueImageView from "app/Components/OpaqueImageView/OpaqueImageView"
import { Spacer, Flex, useColor, Text, Touchable, Image } from "@artsy/palette-mobile"
import { navigate } from "app/system/navigation/navigate"

interface SavedItemRowProps {
Expand Down Expand Up @@ -37,7 +36,7 @@ export const SavedItemRow: React.FC<SavedItemRowProps> = ({
borderRadius={square_image ? 2 : size / 2}
overflow="hidden"
>
<OpaqueImageView imageURL={imageURL} width={size} height={size} />
{!!imageURL && <Image src={imageURL} width={size} height={size} />}
</Flex>
<Spacer x={2} />
<Text variant="sm" weight="medium">
Expand Down
5 changes: 2 additions & 3 deletions src/app/Components/Lists/ShowItemRow.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Flex, Box, ClassTheme, Text, Button, Touchable } from "@artsy/palette-mobile"
import { Flex, Box, ClassTheme, Text, Button, Touchable, Image } from "@artsy/palette-mobile"
import { themeGet } from "@styled-system/theme-get"
import { ShowItemRowMutation } from "__generated__/ShowItemRowMutation.graphql"
import { ShowItemRow_show$data } from "__generated__/ShowItemRow_show.graphql"
import { Pin } from "app/Components/Icons/Pin"
import OpaqueImageView from "app/Components/OpaqueImageView/OpaqueImageView"
import { exhibitionDates } from "app/Scenes/Map/exhibitionPeriodParser"
import { navigate } from "app/system/navigation/navigate"
import { hrefForPartialShow } from "app/utils/router"
Expand Down Expand Up @@ -131,7 +130,7 @@ export class ShowItemRow extends React.Component<Props, State> {
</DefaultImageContainer>
) : (
<DefaultImageContainer>
<OpaqueImageView width={62} height={62} imageURL={imageURL} />
<Image width={62} height={62} src={imageURL} />
</DefaultImageContainer>
)}
<Flex flexDirection="column" flexGrow={1} width={165} mr={1}>
Expand Down
3 changes: 0 additions & 3 deletions src/app/Components/OpaqueImageView/OpaqueImageView.tsx

This file was deleted.

37 changes: 0 additions & 37 deletions src/app/Components/OpaqueImageView/createGeminiUrl.tsx

This file was deleted.

Loading

0 comments on commit 4b6a47d

Please sign in to comment.