aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/LoadingBox.tsx
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-05 18:28:35 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-05-05 18:28:35 -0400
commit86f55d8aa12268fe847eaa344e8efbab5d293f34 (patch)
tree6bbc5c6fb6825ef969ed0342e4851667b81577cc /src/client/views/nodes/LoadingBox.tsx
parent2a9db784a6e3492a8f7d8ce9a745b4f1a0494241 (diff)
parent139600ab7e8a82a31744cd3798247236cd5616fc (diff)
Merge branch 'nathan-starter' of https://github.com/brown-dash/Dash-Web into nathan-starter
Diffstat (limited to 'src/client/views/nodes/LoadingBox.tsx')
-rw-r--r--src/client/views/nodes/LoadingBox.tsx27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/client/views/nodes/LoadingBox.tsx b/src/client/views/nodes/LoadingBox.tsx
index adccc9db6..5f343bdfe 100644
--- a/src/client/views/nodes/LoadingBox.tsx
+++ b/src/client/views/nodes/LoadingBox.tsx
@@ -6,7 +6,8 @@ import { Doc } from '../../../fields/Doc';
import { Id } from '../../../fields/FieldSymbols';
import { StrCast } from '../../../fields/Types';
import { Networking } from '../../Network';
-import { DocumentManager } from '../../util/DocumentManager';
+import { DocumentType } from '../../documents/DocumentTypes';
+import { Docs } from '../../documents/Documents';
import { ViewBoxAnnotatableComponent } from '../DocComponent';
import { FieldView, FieldViewProps } from './FieldView';
import './LoadingBox.scss';
@@ -37,30 +38,18 @@ export class LoadingBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
public static LayoutString(fieldKey: string) {
return FieldView.LayoutString(LoadingBox, fieldKey);
}
- // removes from currently loading display
- public static removeCurrentlyLoading(doc: Doc) {
- if (DocumentManager.Instance.CurrentlyLoading) {
- const index = DocumentManager.Instance.CurrentlyLoading.indexOf(doc);
- runInAction(() => index !== -1 && DocumentManager.Instance.CurrentlyLoading.splice(index, 1));
- }
- }
-
- // adds doc to currently loading display
- public static addCurrentlyLoading(doc: Doc) {
- if (DocumentManager.Instance.CurrentlyLoading.indexOf(doc) === -1) {
- runInAction(() => DocumentManager.Instance.CurrentlyLoading.push(doc));
- }
- }
_timer: any;
@observable progress = '';
componentDidMount() {
- if (!DocumentManager.Instance.CurrentlyLoading?.includes(this.Document)) {
+ if (!Doc.CurrentlyLoading?.includes(this.Document)) {
this.Document.loadingError = 'Upload interrupted, please try again';
} else {
const updateFunc = async () => {
const result = await Networking.QueryYoutubeProgress(StrCast(this.Document[Id])); // We use the guid of the overwriteDoc to track file uploads.
- runInAction(() => (this.progress = result.progress));
+ runInAction(() => {
+ this.progress = result.progress;
+ });
!this.Document.loadingError && this._timer && (this._timer = setTimeout(updateFunc, 1000));
};
this._timer = setTimeout(updateFunc, 1000);
@@ -87,3 +76,7 @@ export class LoadingBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
);
}
}
+Docs.Prototypes.TemplateMap.set(DocumentType.LOADING, {
+ layout: { view: LoadingBox, dataField: '' },
+ options: { acl: '', _layout_fitWidth: true, _layout_nativeDimEditable: true },
+});