summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOskar Nyberg <oskar@mullvad.net>2023-12-28 10:46:56 +0100
committerOskar Nyberg <oskar@mullvad.net>2024-01-05 16:51:02 +0100
commit2accfd90d5a98f9b7a02a3c60fd4164e58bf5824 (patch)
tree35cb1c3475d2cb4cbbf6d245ed0e63d97c9cac58
parent2601bf96f2b6524d5dc5c86c4bddd3e19b4b1988 (diff)
downloadmullvadvpn-2accfd90d5a98f9b7a02a3c60fd4164e58bf5824.tar.xz
mullvadvpn-2accfd90d5a98f9b7a02a3c60fd4164e58bf5824.zip
Show disabled chevron for custom lists without items
-rw-r--r--gui/src/renderer/components/select-location/LocationRow.tsx8
1 files changed, 5 insertions, 3 deletions
diff --git a/gui/src/renderer/components/select-location/LocationRow.tsx b/gui/src/renderer/components/select-location/LocationRow.tsx
index 97c8528fa9..431df24331 100644
--- a/gui/src/renderer/components/select-location/LocationRow.tsx
+++ b/gui/src/renderer/components/select-location/LocationRow.tsx
@@ -165,12 +165,12 @@ function LocationRow<C extends LocationSpecification>(props: IProps<C>) {
// Expand/collapse should only be available if the expanded property is provided in the source
const expanded = 'expanded' in props.source ? props.source.expanded : undefined;
const toggleCollapse = useCallback(() => {
- if (expanded !== undefined) {
+ if (expanded !== undefined && hasChildren) {
userInvokedExpand.current = true;
const callback = expanded ? props.onCollapse : props.onExpand;
callback(props.source.location);
}
- }, [props.onExpand, props.onCollapse, props.source.location, expanded]);
+ }, [props.onExpand, props.onCollapse, props.source.location, expanded, hasChildren]);
const handleClick = useCallback(() => {
if (!props.source.selected) {
@@ -275,10 +275,12 @@ function LocationRow<C extends LocationSpecification>(props: IProps<C>) {
</>
) : null}
- {hasChildren ? (
+ {hasChildren ||
+ ('customList' in props.source.location && !('country' in props.source.location)) ? (
<StyledLocationRowIcon
as={ChevronButton}
onClick={toggleCollapse}
+ disabled={!hasChildren}
up={expanded ?? false}
aria-label={sprintf(
expanded === true