diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-01-18 20:45:49 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2026-01-18 20:45:49 +0000 |
| commit | 223876d8ff4c0bf5273e0b6d2225305b47e661c0 (patch) | |
| tree | 89037410fbc2c822c107cce01adad34a3e670f19 /apps/mobile/app/dashboard/(tabs) | |
| parent | 6535a5a2931c0597f510dc985ecd84679df697d0 (diff) | |
| download | karakeep-223876d8ff4c0bf5273e0b6d2225305b47e661c0.tar.zst | |
ux(mobile): align all lists in the all lists tab
Diffstat (limited to 'apps/mobile/app/dashboard/(tabs)')
| -rw-r--r-- | apps/mobile/app/dashboard/(tabs)/lists.tsx | 53 |
1 files changed, 34 insertions, 19 deletions
diff --git a/apps/mobile/app/dashboard/(tabs)/lists.tsx b/apps/mobile/app/dashboard/(tabs)/lists.tsx index bfdacd28..6b18e2c7 100644 --- a/apps/mobile/app/dashboard/(tabs)/lists.tsx +++ b/apps/mobile/app/dashboard/(tabs)/lists.tsx @@ -81,6 +81,17 @@ export default function Lists() { return lists?.data.some((list) => list.userRole !== "owner") ?? false; }, [lists?.data]); + // Check if any list has children to determine if we need chevron spacing + const hasAnyListsWithChildren = useMemo(() => { + const checkForChildren = (node: ZBookmarkListTreeNode): boolean => { + if (node.children && node.children.length > 0) return true; + return false; + }; + return ( + Object.values(lists?.root ?? {}).some(checkForChildren) || hasSharedLists + ); + }, [lists?.root, hasSharedLists]); + useEffect(() => { setRefreshing(isPending); }, [isPending]); @@ -176,25 +187,29 @@ export default function Lists() { props: { marginLeft: l.item.level * 20 }, })} > - {l.item.numChildren > 0 && ( - <Pressable - className="pr-2" - onPress={() => { - setShowChildrenOf((prev) => ({ - ...prev, - [l.item.id]: !prev[l.item.id], - })); - }} - > - <ChevronRight - color={colors.foreground} - style={{ - transform: [ - { rotate: l.item.collapsed ? "0deg" : "90deg" }, - ], - }} - /> - </Pressable> + {hasAnyListsWithChildren && ( + <View style={{ width: 32 }}> + {l.item.numChildren > 0 && ( + <Pressable + className="pr-2" + onPress={() => { + setShowChildrenOf((prev) => ({ + ...prev, + [l.item.id]: !prev[l.item.id], + })); + }} + > + <ChevronRight + color={colors.foreground} + style={{ + transform: [ + { rotate: l.item.collapsed ? "0deg" : "90deg" }, + ], + }} + /> + </Pressable> + )} + </View> )} {l.item.isSharedSection ? ( |
