aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/SidebarAnnos.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2023-12-13 21:17:50 -0500
committerbobzel <zzzman@gmail.com>2023-12-13 21:17:50 -0500
commit1cf241544f8063e3d71406238a584299b6ced794 (patch)
treecb2bf6a71abbe76e8e3ab8d6283c0daab850e0a4 /src/client/views/SidebarAnnos.tsx
parent35f4d108643d310e4e9da107a5839bb74cc6706f (diff)
cleaned up props/_props handling by inherting from ObservableReactComponent
Diffstat (limited to 'src/client/views/SidebarAnnos.tsx')
-rw-r--r--src/client/views/SidebarAnnos.tsx25
1 files changed, 10 insertions, 15 deletions
diff --git a/src/client/views/SidebarAnnos.tsx b/src/client/views/SidebarAnnos.tsx
index 19473de2b..0f4a4260c 100644
--- a/src/client/views/SidebarAnnos.tsx
+++ b/src/client/views/SidebarAnnos.tsx
@@ -1,22 +1,23 @@
-import { computed, makeObservable, observable } from 'mobx';
+import { computed, makeObservable } from 'mobx';
import { observer } from 'mobx-react';
+import * as React from 'react';
+import { emptyFunction, returnAll, returnFalse, returnOne, returnZero } from '../../Utils';
import { Doc, DocListCast, Field, FieldResult, StrListCast } from '../../fields/Doc';
import { Id } from '../../fields/FieldSymbols';
import { List } from '../../fields/List';
import { RichTextField } from '../../fields/RichTextField';
import { DocCast, NumCast, StrCast } from '../../fields/Types';
-import { copyProps, emptyFunction, returnAll, returnFalse, returnOne, returnTrue, returnZero } from '../../Utils';
-import { Docs, DocUtils } from '../documents/Documents';
import { CollectionViewType, DocumentType } from '../documents/DocumentTypes';
+import { DocUtils, Docs } from '../documents/Documents';
import { LinkManager } from '../util/LinkManager';
import { SearchUtil } from '../util/SearchUtil';
import { Transform } from '../util/Transform';
+import { ObservableReactComponent } from './ObservableReactComponent';
+import './SidebarAnnos.scss';
+import { StyleProp } from './StyleProvider';
import { CollectionStackingView } from './collections/CollectionStackingView';
import { FieldViewProps } from './nodes/FieldView';
import { FormattedTextBox } from './nodes/formattedText/FormattedTextBox';
-import './SidebarAnnos.scss';
-import { StyleProp } from './StyleProvider';
-import * as React from 'react';
interface ExtraProps {
fieldKey: string;
@@ -34,18 +35,12 @@ interface ExtraProps {
moveDocument: (doc: Doc | Doc[], targetCollection: Doc | undefined, addDocument: (doc: Doc | Doc[]) => boolean, annotationKey?: string) => boolean;
}
@observer
-export class SidebarAnnos extends React.Component<FieldViewProps & ExtraProps> {
- _prevProps: FieldViewProps & ExtraProps;
- @observable _props: FieldViewProps & ExtraProps;
- constructor(props: FieldViewProps & ExtraProps) {
+export class SidebarAnnos extends ObservableReactComponent<FieldViewProps & ExtraProps> {
+ constructor(props: any) {
super(props);
- this._props = this._prevProps = props;
makeObservable(this);
- // this._props.dataDoc[this.sidebarKey] = new List<Doc>(); // bcz: can't do this here. it blows away existing things and isn't a robust solution for making sure the field exists -- instead this should happen when the document is created and/or shared
- }
- componentDidUpdate() {
- copyProps(this);
}
+
_stackRef = React.createRef<CollectionStackingView>();
@computed get allMetadata() {
const keys = new Map<string, FieldResult<Field>>();