From d6b6d6a1ebcfcd7c29e53fbed90cb544fdb3025b Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Sat, 5 Jun 2021 14:46:14 +1000 Subject: [PATCH] Hide token bar group if all items are hidden and only add visible tokens on drag --- src/components/token/TokenBar.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/token/TokenBar.js b/src/components/token/TokenBar.js index 4279c1b..e591b14 100644 --- a/src/components/token/TokenBar.js +++ b/src/components/token/TokenBar.js @@ -74,7 +74,7 @@ function TokenBar({ onMapTokensStateCreate }) { let offset = new Vector2(0, 0); for (let item of group.items) { const token = tokensById[item.id]; - if (token) { + if (token && !token.hideInSidebar) { tokenStates.push( createTokenState( token, @@ -115,14 +115,16 @@ function TokenBar({ onMapTokensStateCreate }) { groupTokens.push(token); } } - return ( - - ); + if (groupTokens.length > 0) { + return ( + + ); + } } }