Skip to content

Commit

Permalink
feat: Send projectId to the inspector
Browse files Browse the repository at this point in the history
  • Loading branch information
cyaiox committed Nov 14, 2023
1 parent 74de0c7 commit d3c1972
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/components/InspectorPage/InspectorPage.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getAddress } from 'decentraland-dapps/dist/modules/wallet/selectors'
import { RootState } from 'modules/common/types'
import { isLoggedIn } from 'modules/identity/selectors'
import { getCurrentScene } from 'modules/scene/selectors'
import { getCurrentProject } from 'modules/project/selectors'
import { connectInspector, openInspector } from 'modules/inspector/actions'
import { isReloading } from 'modules/inspector/selectors'
import { getIsSmartItemsEnabled } from 'modules/features/selectors'
Expand All @@ -14,6 +15,7 @@ const mapState = (state: RootState): MapStateProps => {
address: getAddress(state),
isLoggedIn: isLoggedIn(state),
scene: getCurrentScene(state),
project: getCurrentProject(state),
isReloading: isReloading(state),
isSmartItemsEnabled: getIsSmartItemsEnabled(state)
}
Expand Down
6 changes: 5 additions & 1 deletion src/components/InspectorPage/InspectorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default class InspectorPage extends React.PureComponent<Props, State> {
}

render() {
const { scene, isLoggedIn, isReloading, isSmartItemsEnabled, address = '' } = this.props
const { scene, project, isLoggedIn, isReloading, isSmartItemsEnabled, address = '' } = this.props

if (!isLoggedIn) {
return <SignInRequired />
Expand Down Expand Up @@ -63,6 +63,10 @@ export default class InspectorPage extends React.PureComponent<Props, State> {

queryParams = queryParams.concat(`&segmentUserId=${address}`)

if (project?.id) {
queryParams = queryParams.concat(`&projectId=${project.id}`)
}

if (!isSmartItemsEnabled) {
queryParams = queryParams.concat('&disableSmartItems')
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/InspectorPage/InspectorPage.types.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Dispatch } from 'redux'
import { Scene } from 'modules/scene/types'
import { Project } from 'modules/project/types'
import { connectInspector, ConnectInspectorAction, openInspector, OpenInspectorAction } from 'modules/inspector/actions'

export type Props = {
scene: Scene | null
address?: string
project?: Project | null
isLoggedIn: boolean
isReloading: boolean
isSmartItemsEnabled: boolean
Expand All @@ -16,6 +18,6 @@ export type State = {
isLoaded: boolean
}

export type MapStateProps = Pick<Props, 'isLoggedIn' | 'scene' | 'isReloading' | 'isSmartItemsEnabled' | 'address'>
export type MapStateProps = Pick<Props, 'isLoggedIn' | 'scene' | 'project' | 'isReloading' | 'isSmartItemsEnabled' | 'address'>
export type MapDispatchProps = Pick<Props, 'onOpen' | 'onConnect'>
export type MapDispatch = Dispatch<OpenInspectorAction | ConnectInspectorAction>

0 comments on commit d3c1972

Please sign in to comment.