From 759966e069394678a0032b0ce2b86db45c8c0b6f Mon Sep 17 00:00:00 2001 From: Lucki2g Date: Mon, 28 Jul 2025 10:36:17 +0200 Subject: [PATCH 1/2] chore: ui adjustments to section and group selection --- Website/components/datamodelview/List.tsx | 1 - .../datamodelview/SidebarDatamodelView.tsx | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Website/components/datamodelview/List.tsx b/Website/components/datamodelview/List.tsx index f301d07..b400d25 100644 --- a/Website/components/datamodelview/List.tsx +++ b/Website/components/datamodelview/List.tsx @@ -202,7 +202,6 @@ export const List = ({ }: IListProps) => { return item.type === 'entity' && item.entity.SchemaName === datamodelView.currentSection; }); if (isInView) { - console.log("List: setting loading false"); dispatch({ type: 'SET_LOADING', payload: false }); } } diff --git a/Website/components/datamodelview/SidebarDatamodelView.tsx b/Website/components/datamodelview/SidebarDatamodelView.tsx index b55545b..9f21655 100644 --- a/Website/components/datamodelview/SidebarDatamodelView.tsx +++ b/Website/components/datamodelview/SidebarDatamodelView.tsx @@ -23,6 +23,9 @@ export const SidebarDatamodelView = ({ }: ISidebarDatamodelViewProps) => { const isTouch = useTouch(); const dispatch = useSidebarDispatch(); const { currentSection, currentGroup, scrollToSection } = useDatamodelView(); + + console.log(currentSection, currentGroup); + const dataModelDispatch = useDatamodelViewDispatch(); const { groups } = useDatamodelData(); @@ -81,8 +84,8 @@ export const SidebarDatamodelView = ({ }: ISidebarDatamodelViewProps) => { }; const handleSectionClick = (sectionId: string) => { - console.log("Loading true for section click"); dataModelDispatch({ type: 'SET_LOADING', payload: true }); + dataModelDispatch({ type: 'SET_CURRENT_SECTION', payload: sectionId }); if (scrollToSection) { scrollToSection(sectionId); } @@ -136,14 +139,16 @@ export const SidebarDatamodelView = ({ }: ISidebarDatamodelViewProps) => { )} onClick={e => { e.stopPropagation(); + handleGroupClick(group.Name); if (group.Entities.length > 0) handleSectionClick(group.Entities[0].SchemaName); }} aria-label={`Link to first entity in ${group.Name}`} tabIndex={0} > { - e.stopPropagation(); - if (group.Entities.length > 0) handleGroupClick(group.Name); + e.preventDefault(); + handleGroupClick(group.Name); + if (group.Entities.length > 0) handleSectionClick(group.Entities[0].SchemaName); }} /> @@ -168,7 +173,10 @@ export const SidebarDatamodelView = ({ }: ISidebarDatamodelViewProps) => { isMatch ? "ring-1 ring-yellow-300" : "" )} key={entity.SchemaName} - onClick={() => handleSectionClick(entity.SchemaName)} + onClick={() => { + handleGroupClick(group.Name) + handleSectionClick(entity.SchemaName) + }} > {entity.IconBase64 ? icon : } From 9fd4e94041df713ec64ff9e307075b08e8a4c682 Mon Sep 17 00:00:00 2001 From: Lucki2g Date: Mon, 28 Jul 2025 10:42:57 +0200 Subject: [PATCH 2/2] chore: tiny padding added to scroll, to ensure correct section is found in the list --- Website/components/datamodelview/List.tsx | 3 ++- Website/components/datamodelview/SidebarDatamodelView.tsx | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Website/components/datamodelview/List.tsx b/Website/components/datamodelview/List.tsx index b400d25..cf1ce9d 100644 --- a/Website/components/datamodelview/List.tsx +++ b/Website/components/datamodelview/List.tsx @@ -147,8 +147,9 @@ export const List = ({ }: IListProps) => { const virtualItems = rowVirtualizer.getVirtualItems(); // Find the first visible item + const padding = 16; const firstVisibleItem = virtualItems.find(v => { - return v.start <= scrollOffset && v.end >= scrollOffset; + return v.start <= scrollOffset && (v.end - padding) >= scrollOffset; }); if (firstVisibleItem) { diff --git a/Website/components/datamodelview/SidebarDatamodelView.tsx b/Website/components/datamodelview/SidebarDatamodelView.tsx index 9f21655..d8d98c1 100644 --- a/Website/components/datamodelview/SidebarDatamodelView.tsx +++ b/Website/components/datamodelview/SidebarDatamodelView.tsx @@ -24,8 +24,6 @@ export const SidebarDatamodelView = ({ }: ISidebarDatamodelViewProps) => { const dispatch = useSidebarDispatch(); const { currentSection, currentGroup, scrollToSection } = useDatamodelView(); - console.log(currentSection, currentGroup); - const dataModelDispatch = useDatamodelViewDispatch(); const { groups } = useDatamodelData();