Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #875 from artsy/get-rid-of-temp-workaround
Browse files Browse the repository at this point in the history
[ImageView] Get rid of `skipGemini` flag
  • Loading branch information
mzikherman authored Dec 6, 2017
2 parents df52bd0 + d7328a6 commit 2ac6319
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 62 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- Change inquiry status bar background to white - maxim
- Move pagination from home/sale index to LotsByfollowedArtists, misc QA - chris
- Only load a single Works For You page at a time - alloy
- Get rid of image view flag that would skip on-the-fly resizing - alloy

### 1.4.0-beta.9

Expand Down
5 changes: 0 additions & 5 deletions src/lib/Components/OpaqueImageView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ interface Props {
/** Any additional styling for the imageview */
style?: any

skipGemini?: boolean

/**
* An aspect ratio created with: width / height.
*
Expand Down Expand Up @@ -82,9 +80,6 @@ export default class OpaqueImageView extends React.Component<Props, State> {

imageURL() {
const imageURL = this.props.imageURL
if (this.props.skipGemini) {
return imageURL
}
if (imageURL) {
// Either scale or crop, based on if an aspect ratio is available.
const type = this.state.aspectRatio ? "fit" : "fill"
Expand Down
13 changes: 5 additions & 8 deletions src/lib/Scenes/Home/Components/Sales/Components/SaleListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ export class SaleListItem extends React.Component<RelayProps, null> {

render() {
const item = this.props.sale
const image = item.cover_image
const timestamp = (item.live_start_at ? liveDate(item) : timedDate(item)).toUpperCase()
const imageURL = (item.cover_image || { cropped: { url: "" } }).cropped.url
const containerWidth = this.containerWidth

const Container = styled.View`
Expand All @@ -100,7 +100,7 @@ export class SaleListItem extends React.Component<RelayProps, null> {
return (
<TouchableWithoutFeedback onPress={this.handleTap}>
<Container>
<Image imageURL={imageURL} skipGemini={true} />
<Image imageURL={image && image.url} />
<Content>
<Header>
<Title numberOfLines={2}>
Expand Down Expand Up @@ -137,9 +137,8 @@ export default createFragmentContainer(SaleListItem, {
registration_ends_at
live_start_at
cover_image {
cropped(width: 158, height: 196, version: "medium") {
url
}
url(version: "large")
aspect_ratio
}
}
`,
Expand All @@ -158,9 +157,7 @@ interface RelayProps {
registration_ends_at: string | null
live_start_at: string | null
cover_image: {
cropped: {
url: string | null
} | null
url: string | null
}
} | null
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ const props = {
live_start_at: moment().add(5, "hour").toISOString(),
live_url_if_open: null,
cover_image: {
cropped: {
url:
"https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
url: "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ exports[`renders correctly 1`] = `
testID={undefined}
>
<AROpaqueImageView
imageURL="https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg"
skipGemini={true}
imageURL="https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg"
style={
Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ exports[`looks correct when rendered 1`] = `
"data": Array [
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg",
},
"end_at": null,
"href": "/auction/wright-noma",
"id": "wright-noma",
"is_live_open": true,
"is_open": true,
Expand All @@ -34,11 +33,10 @@ exports[`looks correct when rendered 1`] = `
},
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
"end_at": null,
"href": "/auction/freemans-modern-and-contemporary-works-of-art",
"id": "freemans-modern-and-contemporary-works-of-art",
"is_live_open": false,
"is_open": true,
Expand Down Expand Up @@ -79,11 +77,10 @@ exports[`looks correct when rendered 1`] = `
"sales": Array [
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg",
},
"end_at": null,
"href": "/auction/wright-noma",
"id": "wright-noma",
"is_live_open": true,
"is_open": true,
Expand All @@ -94,11 +91,10 @@ exports[`looks correct when rendered 1`] = `
},
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
"end_at": null,
"href": "/auction/freemans-modern-and-contemporary-works-of-art",
"id": "freemans-modern-and-contemporary-works-of-art",
"is_live_open": false,
"is_open": true,
Expand Down Expand Up @@ -141,11 +137,10 @@ exports[`looks correct when rendered 1`] = `
"data": Array [
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg",
},
"end_at": null,
"href": "/auction/wright-noma",
"id": "wright-noma",
"is_live_open": true,
"is_open": true,
Expand All @@ -156,11 +151,10 @@ exports[`looks correct when rendered 1`] = `
},
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
"end_at": null,
"href": "/auction/freemans-modern-and-contemporary-works-of-art",
"id": "freemans-modern-and-contemporary-works-of-art",
"is_live_open": false,
"is_open": true,
Expand Down Expand Up @@ -201,11 +195,10 @@ exports[`looks correct when rendered 1`] = `
"sales": Array [
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg",
},
"end_at": null,
"href": "/auction/wright-noma",
"id": "wright-noma",
"is_live_open": true,
"is_open": true,
Expand All @@ -216,11 +209,10 @@ exports[`looks correct when rendered 1`] = `
},
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
"end_at": null,
"href": "/auction/freemans-modern-and-contemporary-works-of-art",
"id": "freemans-modern-and-contemporary-works-of-art",
"is_live_open": false,
"is_open": true,
Expand Down Expand Up @@ -298,11 +290,10 @@ exports[`looks correct when rendered 1`] = `
Array [
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg",
},
"end_at": null,
"href": "/auction/wright-noma",
"id": "wright-noma",
"is_live_open": true,
"is_open": true,
Expand All @@ -313,11 +304,10 @@ exports[`looks correct when rendered 1`] = `
},
Object {
"cover_image": Object {
"cropped": Object {
"url": "https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
"url": "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
"end_at": null,
"href": "/auction/freemans-modern-and-contemporary-works-of-art",
"id": "freemans-modern-and-contemporary-works-of-art",
"is_live_open": false,
"is_open": true,
Expand Down Expand Up @@ -394,8 +384,7 @@ exports[`looks correct when rendered 1`] = `
testID={undefined}
>
<AROpaqueImageView
imageURL="https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg"
skipGemini={true}
imageURL="https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg"
style={
Array [
Object {
Expand Down Expand Up @@ -580,8 +569,7 @@ exports[`looks correct when rendered 1`] = `
testID={undefined}
>
<AROpaqueImageView
imageURL="https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg"
skipGemini={true}
imageURL="https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg"
style={
Array [
Object {
Expand Down
14 changes: 5 additions & 9 deletions src/lib/Scenes/Home/Components/Sales/__tests__/index-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import * as renderer from "react-test-renderer"
import Sales from "../index"

it("looks correct when rendered", () => {
const auctions = renderer.create(<Sales {...props as any} />)
const auctions = renderer.create(<Sales {...props} />)
expect(auctions).toMatchSnapshot()
})

Expand All @@ -19,6 +19,7 @@ const props = {
sales: [
{
id: "wright-noma",
href: "/auction/wright-noma",
name: "Wright: noma",
is_open: true,
is_live_open: true,
Expand All @@ -27,14 +28,12 @@ const props = {
registration_ends_at: "2017-11-01T13:00:00+00:00",
live_start_at: "2017-11-02T13:00:00+00:00",
cover_image: {
cropped: {
url:
"https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FWV-7BYlETayN8MGkNjOGXw%2Fsource.jpg",
},
url: "https://d32dm0rphc51dk.cloudfront.net/WV-7BYlETayN8MGkNjOGXw/source.jpg",
},
},
{
id: "freemans-modern-and-contemporary-works-of-art",
href: "/auction/freemans-modern-and-contemporary-works-of-art",
name: "Freeman's: Modern & Contemporary Works of Art",
is_open: true,
is_live_open: false,
Expand All @@ -43,10 +42,7 @@ const props = {
registration_ends_at: "2017-11-01T17:00:00+00:00",
live_start_at: "2017-11-02T17:00:00+00:00",
cover_image: {
cropped: {
url:
"https://d7hftxdivxxvm.cloudfront.net/?resize_to=fill&width=158&height=196&q…A%2F%2Fd32dm0rphc51dk.cloudfront.net%2FeeqLfwMMAYA8XOmeYEb7Rg%2Fsource.jpg",
},
url: "https://d32dm0rphc51dk.cloudfront.net/eeqLfwMMAYA8XOmeYEb7Rg/source.jpg",
},
},
],
Expand Down

0 comments on commit 2ac6319

Please sign in to comment.