feat: native components (#789)

* wip: component viewer

* feat: get component status from component viewer

* feat: native components

* fix: remove unused property

* fix: remove unused func

* chore(deps): snjs 2.29.0

* fix: import location

* feat: native components

* fix: remove unused func

* feat: component viewer (#781)

* wip: component viewer

* feat: get component status from component viewer

* fix: remove unused property

* chore(deps): snjs 2.29.0

* fix: import location

* chore: use cp instead of webpack copy

* fix: types

* chore: misc
This commit is contained in:
Mo
2021-12-30 14:25:40 -06:00
committed by GitHub
parent 460a6e7d17
commit 66d8efd090
483 changed files with 188886 additions and 110 deletions

View File

@@ -12,7 +12,6 @@ import { FunctionalComponent } from 'preact';
import { toDirective } from '@/components/utils';
import { useCallback, useEffect, useRef, useState } from 'preact/hooks';
import { observer } from 'mobx-react-lite';
import { isDesktopApplication } from '@/utils';
import { OfflineRestricted } from '@/components/ComponentView/OfflineRestricted';
import { UrlMissing } from '@/components/ComponentView/UrlMissing';
import { IsDeprecated } from '@/components/ComponentView/IsDeprecated';
@@ -139,19 +138,6 @@ export const ComponentView: FunctionalComponent<IProps> = observer(
const iframe = iframeRef.current as HTMLIFrameElement;
iframe.onload = () => {
const contentWindow = iframe.contentWindow as Window;
let hasDesktopError = false;
const canAccessWindowOrigin = isDesktopApplication();
if (canAccessWindowOrigin) {
try {
if (!contentWindow.origin || contentWindow.origin === 'null') {
hasDesktopError = true;
}
} catch (e) {
console.error(e);
}
}
excessiveLoadingTimeout.current &&
clearTimeout(excessiveLoadingTimeout.current);
@@ -159,7 +145,7 @@ export const ComponentView: FunctionalComponent<IProps> = observer(
setTimeout(() => {
setIsLoading(false);
setHasIssueLoading(hasDesktopError);
setHasIssueLoading(false);
onLoad?.(component);
}, MSToWaitAfterIframeLoadToAvoidFlicker);
};