@@ -13,15 +13,16 @@ import { DataStore } from "../../../services/datastore";
1313import { Services } from "../../../services/services" ;
1414import { Panel , useSummaryStyles } from "./common" ;
1515import { LocationData , PanelsCoordinator } from "./coordinator" ;
16+ import { ReflexedPanelLocation } from "../types" ;
1617
1718export const SUMMARY_BAR_HEIGHT = 48 ; // Pixels
1819
1920/**
2021 * PanelSummaryBar is the summary bar displayed when a panel display is closed.
2122 */
22- export function PanelSummaryBar < L extends string > ( props : {
23- location : L ;
24- coordinator : PanelsCoordinator < L > ;
23+ export function PanelSummaryBar ( props : {
24+ location : ReflexedPanelLocation ;
25+ coordinator : PanelsCoordinator ;
2526 services : Services ;
2627 disabled ?: boolean | undefined ;
2728 overrideSummaryDisplay ?: ReactNode ;
@@ -45,10 +46,10 @@ export function PanelSummaryBar<L extends string>(props: {
4546 >
4647 { props . overrideSummaryDisplay !== undefined &&
4748 props . overrideSummaryDisplay }
48- { panels . map ( ( panel : Panel < L > ) => {
49+ { panels . map ( ( panel : Panel ) => {
4950 // NOTE: Using this as a tag here is important for React's state system. Otherwise,
5051 // it'll run hooks outside of the normal flow, which breaks things.
51- const Summary = panel . summary ;
52+ const Summary = panel . Summary ;
5253 return (
5354 < Button
5455 key = { panel . id }
@@ -114,10 +115,10 @@ const TOOLBAR_HEIGHT = 48; // Pixels
114115/**
115116 * PanelDisplay displays the panels in a specific location.
116117 */
117- export function PanelDisplay < L extends string > (
118+ export function PanelDisplay (
118119 props : {
119- location : L ;
120- coordinator : PanelsCoordinator < L > ;
120+ location : ReflexedPanelLocation ;
121+ coordinator : PanelsCoordinator ;
121122 datastore : DataStore ;
122123 services : Services ;
123124 } & {
@@ -159,14 +160,13 @@ export function PanelDisplay<L extends string>(
159160 aria-label = "Tabs"
160161 variant = "fullWidth"
161162 >
162- { panels . map ( ( panel : Panel < L > ) => {
163+ { panels . map ( ( { id , Summary } : Panel ) => {
163164 // NOTE: Using this as a tag here is important for React's state system. Otherwise,
164165 // it'll run hooks outside of the normal flow, which breaks things.
165- const Summary = panel . summary ;
166166 return (
167167 < Tab
168- key = { `tab- ${ panel . id } ` }
169- value = { panel . id }
168+ key = { id }
169+ value = { id }
170170 label = { < Summary { ...props } /> }
171171 />
172172 ) ;
@@ -175,7 +175,7 @@ export function PanelDisplay<L extends string>(
175175
176176 < span >
177177 { currentTabName &&
178- coordinator . listLocations ( ) . map ( ( locData : LocationData < L > ) => {
178+ coordinator . listLocations ( ) . map ( ( locData : LocationData ) => {
179179 if ( locData . location === props . location ) {
180180 return < div key = { locData . location } /> ;
181181 }
@@ -215,27 +215,26 @@ export function PanelDisplay<L extends string>(
215215 </ Toolbar >
216216 </ AppBar >
217217
218- { panels . map ( ( panel : Panel < L > ) => {
218+ { panels . map ( ( { id , Content } : Panel ) => {
219219 // NOTE: Using this as a tag here is important for React's state system. Otherwise,
220220 // it'll run hooks outside of the normal flow, which breaks things.
221- const Content = panel . content ;
222221 const height =
223222 ( props . dimensions ?. height ?? 0 >= 48 )
224223 ? ( props . dimensions ?. height ?? 0 ) - 48
225224 : "auto" ;
226225
227226 return (
228227 < TabPanel
229- key = { `panel- ${ panel . id } ` }
230- index = { panel . id }
228+ key = { id }
229+ index = { id }
231230 value = { currentTabName }
232231 style = { {
233232 overflow : "auto" ,
234233 height : height || "auto" ,
235234 position : "relative" ,
236235 } }
237236 >
238- { currentTabName === panel . id && < Content { ...contentProps } /> }
237+ { currentTabName === id && < Content { ...contentProps } /> }
239238 </ TabPanel >
240239 ) ;
241240 } ) }
0 commit comments