diff --git a/client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contribution/ContributionOverviewContent.kt b/client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contribution/ContributionOverviewContent.kt index c445e5180..d94adebf9 100644 --- a/client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contribution/ContributionOverviewContent.kt +++ b/client/components/src/jsMain/kotlin/com/zegreatrob/coupling/client/components/contribution/ContributionOverviewContent.kt @@ -48,16 +48,16 @@ val ContributionOverviewContent by nfc { (part } val popperRef = useRef() val arrowRef = useRef() - val (referenceElement, setReferenceElement) = useState?>(null) - val popperInstance = usePopper(referenceElement?.first, popperRef.current, popperOptions(arrowRef)) - if (referenceElement != null) { - CouplingPopUp( - hide = false, - popperRef = popperRef, - arrowRef = arrowRef, - popperInstance = popperInstance, - ) { - ContributorMenu(referenceElement.second, players, party.id) + val (menuTarget, setMenuTarget) = useState?>(null) + val popperInstance = usePopper(menuTarget?.first, popperRef.current, popperOptions(arrowRef)) + CouplingPopUp( + hide = menuTarget != null, + popperRef = popperRef, + arrowRef = arrowRef, + popperInstance = popperInstance, + ) { + if (menuTarget != null) { + ContributorMenu(menuTarget.second, players, party.id) } } contributions.forEach { contribution -> @@ -66,7 +66,7 @@ val ContributionOverviewContent by nfc { (part contributors = contributors, key = contribution.id, onPlayerClick = { player, element -> - setReferenceElement(ReferenceElement(element)!! to player) + setMenuTarget(ReferenceElement(element)!! to player) popperInstance.forceUpdate?.invoke() }, )