Skip to content

Commit

Permalink
tweaking pop up menu triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
robertfmurdock committed Oct 15, 2024
1 parent ac0eac2 commit c0c0892
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ val ContributionOverviewContent by nfc<ContributionOverviewContentProps> { (part
}
val popperRef = useRef<HTMLElement>()
val arrowRef = useRef<HTMLElement>()
val (referenceElement, setReferenceElement) = useState<Pair<ReferenceElement, Player>?>(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<Pair<ReferenceElement, Player>?>(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 ->
Expand All @@ -66,7 +66,7 @@ val ContributionOverviewContent by nfc<ContributionOverviewContentProps> { (part
contributors = contributors,
key = contribution.id,
onPlayerClick = { player, element ->
setReferenceElement(ReferenceElement(element)!! to player)
setMenuTarget(ReferenceElement(element)!! to player)
popperInstance.forceUpdate?.invoke()
},
)
Expand Down

0 comments on commit c0c0892

Please sign in to comment.