1- import { IAnnotationModel } from '@jupytergis/schema' ;
2- import { PanelWithToolbar , ReactWidget } from '@jupyterlab/ui-components' ;
1+ import { IAnnotationModel , IJupyterGISModel } from '@jupytergis/schema' ;
32import React , { Component } from 'react' ;
43
54import Annotation from '@/src/annotations/components/Annotation' ;
6- import { IControlPanelModel } from '@/src/types' ;
75
86interface IAnnotationPanelProps {
97 annotationModel : IAnnotationModel ;
10- rightPanelModel : IControlPanelModel ;
8+ jgisModel : IJupyterGISModel ;
119}
1210
1311export class AnnotationsPanel extends Component < IAnnotationPanelProps > {
@@ -19,20 +17,10 @@ export class AnnotationsPanel extends Component<IAnnotationPanelProps> {
1917 } ;
2018
2119 this . _annotationModel = props . annotationModel ;
22- this . _rightPanelModel = props . rightPanelModel ;
20+ this . _jgisModel = props . jgisModel ;
2321
24- this . _annotationModel . modelChanged . connect ( async ( ) => {
25- // await this._annotationModel?.context?.ready;
26-
27- this . _annotationModel ?. model ?. sharedMetadataChanged . disconnect (
28- updateCallback ,
29- ) ;
30- this . _annotationModel = props . annotationModel ;
31- this . _annotationModel ?. model ?. sharedMetadataChanged . connect (
32- updateCallback ,
33- ) ;
34- this . forceUpdate ( ) ;
35- } ) ;
22+ this . _annotationModel ?. model ?. sharedMetadataChanged . connect ( updateCallback ) ;
23+ this . forceUpdate ( ) ;
3624 }
3725
3826 render ( ) : JSX . Element {
@@ -46,7 +34,7 @@ export class AnnotationsPanel extends Component<IAnnotationPanelProps> {
4634 return (
4735 < div >
4836 < Annotation
49- rightPanelModel = { this . _rightPanelModel }
37+ jgisModel = { this . _jgisModel }
5038 annotationModel = { this . _annotationModel }
5139 itemId = { id }
5240 />
@@ -59,37 +47,5 @@ export class AnnotationsPanel extends Component<IAnnotationPanelProps> {
5947 }
6048
6149 private _annotationModel : IAnnotationModel ;
62- private _rightPanelModel : IControlPanelModel ;
63- }
64-
65- export class Annotations extends PanelWithToolbar {
66- constructor ( options : Annotations . IOptions ) {
67- super ( { } ) ;
68-
69- this . title . label = 'Annotations' ;
70- this . addClass ( 'jgis-scrollable' ) ;
71-
72- this . _annotationModel = options . annotationModel ;
73- this . _rightPanelModel = options . rightPanelModel ;
74-
75- this . _widget = ReactWidget . create (
76- < AnnotationsPanel
77- rightPanelModel = { this . _rightPanelModel }
78- annotationModel = { this . _annotationModel }
79- /> ,
80- ) ;
81-
82- this . addWidget ( this . _widget ) ;
83- }
84-
85- private _widget : ReactWidget ;
86- private _annotationModel : IAnnotationModel ;
87- private _rightPanelModel : IControlPanelModel ;
88- }
89-
90- export namespace Annotations {
91- export interface IOptions {
92- annotationModel : IAnnotationModel ;
93- rightPanelModel : IControlPanelModel ;
94- }
50+ private _jgisModel : IJupyterGISModel ;
9551}
0 commit comments