Skip to content

Commit

Permalink
chore: rename to count
Browse files Browse the repository at this point in the history
  • Loading branch information
jenniferarnesen committed Sep 11, 2023
1 parent 8b2a0bc commit 6f92a4b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
7 changes: 4 additions & 3 deletions src/components/app/AppLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import DetailsPanel from './DetailsPanel.js'
import styles from './styles/AppLayout.module.css'

const AppLayout = () => {
const [interpretationsRenderId, setInterpretationsRenderId] = useState(1)
const [interpretationsRenderCount, setInterpretationsRenderCount] =
useState(1)

const dataTableOpen = useSelector((state) => !!state.dataTable)
const downloadModeOpen = useSelector(
Expand All @@ -28,7 +29,7 @@ const AppLayout = () => {

const onFileMenuAction = () =>
detailsPanelOpen &&
setInterpretationsRenderId(interpretationsRenderId + 1)
setInterpretationsRenderCount(interpretationsRenderCount + 1)

return (
<>
Expand All @@ -49,7 +50,7 @@ const AppLayout = () => {
</div>
{!downloadModeOpen && (
<DetailsPanel
interpretationsRenderId={interpretationsRenderId}
interpretationsRenderCount={interpretationsRenderCount}
/>
)}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/app/DetailsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Interpretations from '../interpretations/Interpretations.js'
import OrgUnitProfile from '../orgunits/OrgUnitProfile.js'
import styles from './styles/DetailsPanel.module.css'

const DetailsPanel = ({ interpretationsRenderId }) => {
const DetailsPanel = ({ interpretationsRenderCount }) => {
const detailsPanelOpen = useSelector((state) => state.ui.rightPanelOpen)
const viewOrgUnitProfile = useSelector((state) => state.orgUnitProfile)

Expand All @@ -18,7 +18,7 @@ const DetailsPanel = ({ interpretationsRenderId }) => {
return viewOrgUnitProfile ? (
<OrgUnitProfile />
) : (
<Interpretations renderId={interpretationsRenderId} />
<Interpretations renderCount={interpretationsRenderCount} />
)
}

Expand All @@ -34,7 +34,7 @@ const DetailsPanel = ({ interpretationsRenderId }) => {
}

DetailsPanel.propTypes = {
interpretationsRenderId: PropTypes.number.isRequired,
interpretationsRenderCount: PropTypes.number.isRequired,
}

export default DetailsPanel
8 changes: 5 additions & 3 deletions src/components/interpretations/Interpretations.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { openInterpretationsPanel } from '../../actions/ui.js'
import { getUrlParameter } from '../../util/requests.js'
import InterpretationsPanel from './InterpretationsPanel.js'

const Interpretations = ({ renderId }) => {
const Interpretations = ({ renderCount }) => {
const isMapLoaded = useSelector(
(state) =>
state.map.id && !state.map.mapViews.find((layer) => !layer.isLoaded)
Expand All @@ -24,11 +24,13 @@ const Interpretations = ({ renderId }) => {
}
}, [isMapLoaded, dispatch])

return isMapLoaded ? <InterpretationsPanel renderId={renderId} /> : null
return isMapLoaded ? (
<InterpretationsPanel renderCount={renderCount} />
) : null
}

Interpretations.propTypes = {
renderId: PropTypes.number.isRequired,
renderCount: PropTypes.number.isRequired,
}

export default Interpretations
7 changes: 4 additions & 3 deletions src/components/interpretations/InterpretationsPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const InterpretationsPanel = ({
interpretationId,
map,
setInterpretation,
renderId,
renderCount,
}) => {
const [initialFocus, setInitialFocus] = useState(false)
const interpretationsUnitRef = useRef()
Expand All @@ -41,10 +41,11 @@ const InterpretationsPanel = ({
setInterpretation()
}, [setInterpretation])

console.log('renderCount', renderCount)
return (
<>
<Drawer>
<AboutAOUnit type="map" id={map.id} renderId={renderId} />
<AboutAOUnit type="map" id={map.id} renderId={renderCount} />
<InterpretationsUnit
ref={interpretationsUnitRef}
type="map"
Expand Down Expand Up @@ -75,7 +76,7 @@ const InterpretationsPanel = ({

InterpretationsPanel.propTypes = {
map: PropTypes.object.isRequired,
renderId: PropTypes.number.isRequired,
renderCount: PropTypes.number.isRequired,
setInterpretation: PropTypes.func.isRequired,
interpretationId: PropTypes.string,
}
Expand Down

0 comments on commit 6f92a4b

Please sign in to comment.