@@ -67,9 +67,10 @@ type WidgetList = { [key: string]: Widget }
6767
6868const Widgets = ( ) => {
6969 const [ widgets , setWidgets ] = useState < WidgetList > ( { } ) ;
70+ const profile = 'default' ;
7071
7172 useEffect ( ( ) => {
72- const widgetsRef = ref ( db , '/ widgets' ) ;
73+ const widgetsRef = ref ( db , `/profiles/ ${ profile } / widgets` ) ;
7374 onValue ( widgetsRef , ( snap : DataSnapshot ) => {
7475 if ( snap ?. val ( ) ) {
7576 setWidgets ( snap . val ( ) ) ;
@@ -83,14 +84,15 @@ const Widgets = () => {
8384 Object . keys ( widgets ) . map ( ( id ) => {
8485 const widget : any = widgets [ id ] ;
8586 const Editor = Editors [ widget . name ] ;
86- return < Editor key = { id } id = { id } props = { widget . props } />
87+ return < Editor key = { id } id = { id } props = { widget . props } profile = { profile } />
8788 } )
8889 }
8990 </ div >
9091 ) ;
9192} ;
9293
9394const AddWidgetModel = ( { open, onClose } : { open : boolean , onClose : ( ) => void } ) => {
95+ const profile = 'default' ;
9496 const [ widgetId , setWidgetId ] = useState ( "" ) ;
9597 const [ widgetType , setWidgetType ] = useState ( "text" ) ;
9698
@@ -152,7 +154,7 @@ const AddWidgetModel = ({ open, onClose }: { open: boolean, onClose: () => void
152154 </ DialogContent >
153155 < DialogActions >
154156 < Button color = "primary" variant = "contained" onClick = { ( ) => {
155- set ( ref ( db , `/widgets/${ widgetId } ` ) , {
157+ set ( ref ( db , `/profiles/ ${ profile } / widgets/${ widgetId } ` ) , {
156158 name : widgetType ,
157159 props : Editors [ widgetType ] . defaultProps
158160 } ) ;
0 commit comments