@@ -102,11 +102,7 @@ import {
102102 useDeleteDashboard ,
103103} from '@/dashboard' ;
104104import useDashboardContainers from '@/hooks/useDashboardContainers' ;
105- import {
106- calculateNextTilePosition ,
107- getDefaultTileSize ,
108- makeId ,
109- } from '@/utils/tilePositioning' ;
105+ import { calculateNextTilePosition , makeId } from '@/utils/tilePositioning' ;
110106
111107import ChartContainer from './components/charts/ChartContainer' ;
112108import { DBPieChart } from './components/DBPieChart' ;
@@ -148,8 +144,8 @@ type MoveTarget = {
148144 containerId : string ;
149145 tabId ?: string ;
150146 label : string ;
151- // For tabs: the group name shown as a section header in the menu
152- groupLabel ?: string ;
147+ // For tabs: all tabs in order with the target tab ID
148+ allTabs ?: { id : string ; title : string } [ ] ;
153149} ;
154150
155151const tileToLayoutItem = ( chart : Tile ) : RGL . Layout => ( {
@@ -444,40 +440,51 @@ const Tile = forwardRef(
444440 (Ungrouped)
445441 </ Menu . Item >
446442 ) }
447- { ( ( ) => {
448- const filtered = moveTargets . filter (
443+ { moveTargets
444+ . filter (
449445 t =>
450446 ! (
451447 t . containerId === chart . containerId &&
452448 t . tabId === chart . tabId
453449 ) ,
454- ) ;
455- let lastGroup : string | undefined ;
456- return filtered . map ( t => {
457- const items : React . ReactNode [ ] = [ ] ;
458- // Add group header when entering a new tab group
459- if ( t . groupLabel && t . groupLabel !== lastGroup ) {
460- items . push (
461- < Menu . Label key = { `group-${ t . containerId } ` } >
462- { t . groupLabel }
463- </ Menu . Label > ,
464- ) ;
465- lastGroup = t . groupLabel ;
466- } else if ( ! t . groupLabel ) {
467- lastGroup = undefined ;
468- }
469- items . push (
470- < Menu . Item
471- key = { `${ t . containerId } -${ t . tabId ?? '' } ` }
472- onClick = { ( ) => onMoveToSection ( t . containerId , t . tabId ) }
473- style = { t . groupLabel ? { paddingLeft : 24 } : undefined }
474- >
475- { t . label }
476- </ Menu . Item > ,
477- ) ;
478- return items ;
479- } ) ;
480- } ) ( ) }
450+ )
451+ . map ( t => (
452+ < Menu . Item
453+ key = { `${ t . containerId } -${ t . tabId ?? '' } ` }
454+ onClick = { ( ) => onMoveToSection ( t . containerId , t . tabId ) }
455+ >
456+ { t . allTabs ? (
457+ < span >
458+ { t . allTabs . map ( ( tab , i ) => (
459+ < span key = { tab . id } >
460+ { i > 0 && (
461+ < span
462+ style = { {
463+ color : 'var(--mantine-color-dimmed)' ,
464+ } }
465+ >
466+ { ' | ' }
467+ </ span >
468+ ) }
469+ < span
470+ style = {
471+ tab . id !== t . tabId
472+ ? {
473+ color : 'var(--mantine-color-dimmed)' ,
474+ }
475+ : undefined
476+ }
477+ >
478+ { tab . title }
479+ </ span >
480+ </ span >
481+ ) ) }
482+ </ span >
483+ ) : (
484+ t . label
485+ ) }
486+ </ Menu . Item >
487+ ) ) }
481488 </ Menu . Dropdown >
482489 </ Menu >
483490 ) }
@@ -1191,26 +1198,24 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
11911198 ) ;
11921199 }
11931200 }
1201+ // Default new tile size: w=8 (1/3 width), h=10 — matches original behavior
1202+ const newW = 8 ;
1203+ const newH = 10 ;
11941204 // Place tile in next available slot (fill right, then wrap)
1195- const defaultSize = getDefaultTileSize ( ) ;
11961205 const targetTiles = ( dashboard ?. tiles ?? [ ] ) . filter ( t => {
11971206 if ( containerId ) {
11981207 if ( t . containerId !== containerId ) return false ;
11991208 return tabId ? t . tabId === tabId : true ;
12001209 }
12011210 return ! t . containerId ;
12021211 } ) ;
1203- const pos = calculateNextTilePosition (
1204- targetTiles ,
1205- defaultSize . w ,
1206- defaultSize . h ,
1207- ) ;
1212+ const pos = calculateNextTilePosition ( targetTiles , newW , newH ) ;
12081213 setEditedTile ( {
12091214 id : makeId ( ) ,
12101215 x : pos . x ,
12111216 y : pos . y ,
1212- w : defaultSize . w ,
1213- h : defaultSize . h ,
1217+ w : newW ,
1218+ h : newH ,
12141219 config : {
12151220 ...DEFAULT_CHART_CONFIG ,
12161221 source : sources ?. [ 0 ] ?. id ?? '' ,
@@ -1231,13 +1236,12 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
12311236 for ( const c of sections ) {
12321237 const cTabs = c . tabs ?? [ ] ;
12331238 if ( c . type === 'group' && cTabs . length >= 2 ) {
1234- const groupLabel = cTabs [ 0 ] ?. title ?? c . title ;
12351239 for ( const tab of cTabs ) {
12361240 targets . push ( {
12371241 containerId : c . id ,
12381242 tabId : tab . id ,
12391243 label : tab . title ,
1240- groupLabel ,
1244+ allTabs : cTabs . map ( t => ( { id : t . id , title : t . title } ) ) ,
12411245 } ) ;
12421246 }
12431247 } else if ( c . type === 'group' && cTabs . length === 1 ) {
0 commit comments