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

Commit

Permalink
[Cleanup] Address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
damassi committed Dec 8, 2017
1 parent 603c19f commit 4daaa56
Show file tree
Hide file tree
Showing 26 changed files with 214 additions and 241 deletions.
9 changes: 2 additions & 7 deletions src/lib/AppRegistry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ import HomeScene from "./Scenes/Home"
import renderWithLoadProgress from "./utils/renderWithLoadProgress"
import { Schema, screenTrack as track } from "./utils/track"

// FIXME: This isnt being used
// Analytics wrapper for all of our top level React components
// function AddTrack(_pageName: string) {
// return component => component
// }

interface ArtistProps {
artistID: string
isPad: boolean
}

const Artist: React.SFC<ArtistProps> = track<ArtistProps>(props => {
return {
context_screen: Schema.PageNames.ArtistPage,
Expand All @@ -35,7 +30,7 @@ const Artist: React.SFC<ArtistProps> = track<ArtistProps>(props => {
}
})(props => <ArtistRenderer {...props} render={renderWithLoadProgress(Containers.Artist, props)} />)

const Inbox: React.SFC<{}> = track<{}>(_props => {
const Inbox: React.SFC<{}> = track<{}>(() => {
return { context_screen: Schema.PageNames.InboxPage, context_screen_owner_type: null }
})(() => <InboxRenderer render={renderWithLoadProgress(Containers.Inbox)} />)

Expand Down
40 changes: 14 additions & 26 deletions src/lib/Components/Artist/Articles/Article.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,9 @@ import fonts from "lib/data/fonts"
import SwitchBoard from "lib/NativeModules/SwitchBoard"
import ImageView from "../../OpaqueImageView"

interface Props extends ViewProperties {
article: {
href: string
author: {
name
}
thumbnail_image: {
url
}
thumbnail_title: string
}
}
interface Props extends RelayProps, ViewProperties {}

class Article extends React.Component<Props, {}> {
class Article extends React.Component<Props> {
handleTap() {
SwitchBoard.presentNavigationViewController(this, this.props.article.href)
}
Expand Down Expand Up @@ -101,16 +90,15 @@ export default createFragmentContainer(
`
)

// FIXME: This is being unused in code
// interface RelayProps {
// article: {
// thumbnail_title: string | null
// href: string | null
// author: {
// name: string | null
// } | null
// thumbnail_image: {
// url: string | null
// } | null
// }
// }
interface RelayProps {
article: {
thumbnail_title: string | null
href: string | null
author: {
name: string | null
} | null
thumbnail_image: {
url: string | null
} | null
}
}
15 changes: 7 additions & 8 deletions src/lib/Components/Artist/Articles/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import { createFragmentContainer, graphql } from "react-relay"
import SerifText from "../../Text/Serif"
import Article from "./Article"

interface Props extends ViewProperties {
interface Props extends RelayProps, ViewProperties {
articles: any[]
}

class Articles extends React.Component<Props, {}> {
class Articles extends React.Component<Props> {
render() {
const articles = this.props.articles
return (
Expand Down Expand Up @@ -49,9 +49,8 @@ export default createFragmentContainer(
`
)

// FIXME: This is being unused in code
// interface RelayProps {
// articles: Array<{
// __id: string
// } | null> | null
// }
interface RelayProps {
articles: Array<{
__id: string
} | null> | null
}
31 changes: 11 additions & 20 deletions src/lib/Components/Artist/Artworks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,7 @@ interface RenderSectionParams {
mapPropsToArtworksConnection: (Props) => any
}

interface Props extends ViewProperties {
artist: {
counts: {
for_sale_artworks: number
artworks: number
}
not_for_sale_artworks: any[]
for_sale_artworks: any[]
}
interface Props extends RelayProps, ViewProperties {
relay: any
}

Expand Down Expand Up @@ -138,14 +130,13 @@ export default createFragmentContainer(
`
)

// FIXME: This is unused in code
// interface RelayProps {
// artist: {
// counts: {
// artworks: boolean | number | string | null
// for_sale_artworks: boolean | number | string | null
// } | null
// for_sale_artworks: Array<boolean | number | string | null> | null
// not_for_sale_artworks: Array<boolean | number | string | null> | null
// }
// }
interface RelayProps {
artist: {
counts: {
artworks: number | null
for_sale_artworks: number | null
} | null
for_sale_artworks: Array<number | null> | null
not_for_sale_artworks: Array<boolean | number | string | null> | null
}
}
17 changes: 7 additions & 10 deletions src/lib/Components/Artist/Biography.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import SerifText from "../Text/Serif"

const sideMargin = Dimensions.get("window").width > 700 ? 50 : 0

interface Props extends ViewProperties {
artist: any
}
interface Props extends RelayProps, ViewProperties {}

class Biography extends React.Component<Props, any> {
render() {
Expand Down Expand Up @@ -70,10 +68,9 @@ export default createFragmentContainer(
`
)

// FIXME: This isn't being used in code
// interface RelayProps {
// artist: {
// bio: string | null
// blurb: string | null
// }
// }
interface RelayProps {
artist: {
bio: string | null
blurb: string | null
}
}
47 changes: 16 additions & 31 deletions src/lib/Components/Artist/Shows/Metadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,7 @@ import SerifText from "lib/Components/Text/Serif"
import colors from "lib/data/colors"
import fonts from "lib/data/fonts"

interface Props extends ViewProperties {
show: {
name: string
kind: string
exhibition_period: string
location?: {
city: string
}
status_update?: string
status: string
partner?: {
name: string
}
}
}
interface Props extends RelayProps, ViewProperties {}

class Metadata extends React.Component<Props, any> {
render() {
Expand Down Expand Up @@ -120,19 +106,18 @@ export default createFragmentContainer(
`
)

// FIXME: This isn't being used in code
// interface RelayProps {
// show: {
// kind: string | null
// name: string | null
// exhibition_period: string | null
// status_update: string | null
// status: string | null
// partner: {
// name: string | null
// } | null
// location: {
// city: string | null
// } | null
// }
// }
interface RelayProps {
show: {
kind: string | null
name: string | null
exhibition_period: string | null
status_update: string | null
status: string | null
partner: {
name: string | null
} | null
location: {
city: string | null
} | null
}
}
25 changes: 9 additions & 16 deletions src/lib/Components/Artist/Shows/Show.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ import SwitchBoard from "../../../NativeModules/SwitchBoard"
import OpaqueImageView from "../../OpaqueImageView"
import Metadata from "./Metadata"

interface Props extends ViewProperties {
show: {
href: string
cover_image: {
url: string
}
}
interface Props extends RelayProps, ViewProperties {
styles?: {
container?: any
image?: any
Expand Down Expand Up @@ -56,12 +50,11 @@ export default createFragmentContainer(
`
)

// FIXME: This isn't being used in code
// interface RelayProps {
// show: {
// href: string | null
// cover_image: {
// url: string | null
// } | null
// }
// }
interface RelayProps {
show: {
href: string | null
cover_image: {
url: string | null
} | null
}
}
11 changes: 4 additions & 7 deletions src/lib/Components/Artist/Shows/SmallList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import Show from "./Show"

import colors from "lib/data/colors"

interface Props extends ViewProperties {
shows: any[]
}
interface Props extends RelayProps, ViewProperties {}

interface State {
dataSource: ListViewDataSource
Expand Down Expand Up @@ -72,7 +70,6 @@ export default createFragmentContainer(
`
)

// FIXME: This isn't being used in code
// interface RelayProps {
// shows: Array<{} | null> | null
// }
interface RelayProps {
shows: Array<{} | null> | null
}
13 changes: 6 additions & 7 deletions src/lib/Components/Artist/Shows/VariableSizeShowsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LayoutChangeEvent, StyleSheet, View, ViewProperties, ViewStyle } from "

import Show from "./Show"

interface Props extends ViewProperties {
interface Props extends RelayProps, ViewProperties {
showSize: "medium" | "large"
shows: any[]
}
Expand Down Expand Up @@ -102,9 +102,8 @@ export default createFragmentContainer(
`
)

// FIXME: This isn't being used in code
// interface RelayProps {
// shows: Array<{
// __id: string
// } | null> | null
// }
interface RelayProps {
shows: Array<{
__id: string
} | null> | null
}
3 changes: 0 additions & 3 deletions src/lib/Components/Consignments/Screens/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@ export default class Info extends React.Component<Props, State> {

const isPad = Dimensions.get("window").width > 700

// TODO: Reenable when used
// const isPadHorizontal = Dimensions.get("window").height > 700

return (
<ConsignmentBG showCloseButton>
<ScrollView style={{ flex: 1 }} alwaysBounceVertical={false} centerContent>
Expand Down
3 changes: 0 additions & 3 deletions src/lib/Components/Consignments/Screens/Welcome.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ export default class Welcome extends React.Component<Props, null> {
render() {
const isPad = Dimensions.get("window").width > 700

// TODO: Reenable when used
// const isPadHorizontal = Dimensions.get("window").height > 700

const TOS = () =>
<Text style={{ textDecorationStyle: "solid", textDecorationLine: "underline" }} onPress={this.TOSTapped}>
Terms of Sevice
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,9 @@ export const uploadFileToS3 = async (file: string, req: GeminiCredsInput, res: G
const bucket = asset.policy_document.conditions.bucket
const uploadURL = `https://${bucket}.s3.amazonaws.com`

// FIXME: This is being unused in 103; does this uploader work?
// const filename = file.split(/\//g).pop()

const data = {
"Content-Type": "image/jpg",
key: geminiKey + "/${filename}",
key: geminiKey + "/${filename}", // NOTE: This form (which _looks_ like ES6 interpolation) is required by AWS
AWSAccessKeyId: asset.credentials,
acl: req.acl,
success_action_status: asset.policy_document.conditions.success_action_status,
Expand Down
13 changes: 3 additions & 10 deletions src/lib/Components/Gene/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Biography from "./Biography"
import RelatedArtists from "../RelatedArtists"
import Separator from "../Separator"

class About extends React.Component<RelayPropsWorkaround, any> {
class About extends React.Component<RelayProps, any> {
render() {
return (
<View>
Expand Down Expand Up @@ -56,15 +56,8 @@ export default createFragmentContainer(
`
)

// FIXME: This isn't being used in code
// interface RelayProps {
// gene: {
// trending_artists: Array<boolean | number | string | null> | null
// }
// }

interface RelayPropsWorkaround {
interface RelayProps {
gene: {
trending_artists: any[]
trending_artists: Array<boolean | number | string | null> | null
}
}
2 changes: 1 addition & 1 deletion src/lib/Components/Gene/__tests__/About-tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ it("shows trending artists correctly", () => {
],
}

const about = renderer.create(<About gene={gene} />).toJSON()
const about = renderer.create(<About gene={gene as any} />).toJSON()
expect(about).toMatchSnapshot()
})
4 changes: 3 additions & 1 deletion src/lib/Components/Home/ArtworkRails/ArtworkRail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ export class ArtworkRail extends React.Component<Props & RelayPropsWorkaround, S
componentDidMount() {
if (this.props.relay) {
this.props.relay.refetch({ __id: this.props.rail.__id, fetchContent: true }, null, error => {
console.error("ArtworkRail.tsx |", error)
if (error) {
console.error("ArtworkRail.tsx |", error)
}

this.setState({
didPerformFetch: true,
Expand Down
Loading

0 comments on commit 4daaa56

Please sign in to comment.