Skip to content

Commit

Permalink
feat(search): add in_search button
Browse files Browse the repository at this point in the history
  • Loading branch information
gary02 committed Jun 6, 2024
1 parent f31b824 commit 5f5e021
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 500 deletions.
14 changes: 10 additions & 4 deletions src/components/Article/ToggleRecommend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ class ToggleRecommend extends React.Component<
},
},
})
const inRecommendType = _get(
result,
`data.toggleArticleRecommend.oss.inRecommend${_capitalize(type)}`
)
const inRecommendType =
type === 'search'
? _get(
result,
`data.toggleArticleRecommend.oss.in${_capitalize(type)}`
)
: _get(
result,
`data.toggleArticleRecommend.oss.inRecommend${_capitalize(type)}`
)
this.setState({
checked: inRecommendType,
loading: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const TOGGLE_RECOMMEND = gql`
inRecommendIcymi
inRecommendHottest
inRecommendNewest
inSearch
}
}
}
Expand All @@ -20,11 +21,12 @@ type Response = {
inRecommendIcymi: boolean
inRecommendHottest: boolean
inRecommendNewest: boolean
inSearch: boolean
}
}
}

export type RecommendTypes = 'icymi' | 'hottest' | 'newest'
export type RecommendTypes = 'icymi' | 'hottest' | 'newest' | 'search'

type InputProps = {
checked: boolean
Expand Down
5 changes: 3 additions & 2 deletions src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ export const __STAGE__ = process.env.REACT_APP_ENV === 'stage'
export const __PROD__ = process.env.REACT_APP_ENV === 'production'

export const API_ENDPOINT = __LOCAL__
? 'https://server-develop.matters.town/graphql'
: __STAGE__
? 'http://127.0.0.1:4000/graphql'
: // ? 'https://server-develop.matters.town/graphql'
__STAGE__
? 'https://server-stage.matters.town/graphql'
: __DEVELOP__
? 'https://server-develop.matters.town/graphql'
Expand Down
1 change: 1 addition & 0 deletions src/definitions/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ export type ArticleDigest = {
inRecommendIcymi: boolean
inRecommendHottest: boolean
inRecommendNewest: boolean
inSearch: boolean
}
}

Expand Down
Loading

0 comments on commit 5f5e021

Please sign in to comment.