Replace static application window with ability to create many (#5979)

* Replace static application window with ability to create as many as you wish

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Adapt tests for replacing static application window with ability to create as many as you wish and separate starting of main and window in behaviours

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Make first render of application smaller in test that proves to be hard for CI

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Remove redundant code

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

* Simplify code

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>

Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
Janne Savolainen authored and GitHub committed 2022-08-16 15:55:42 +03:00
1 parent 299922c8a7
commit 63d5a34379
98 files changed
+3283 -2743

No files matched your search

+4 -1
View File
@@ -14,6 +14,7 @@ import { cssNames, noop, stopPropagation } from "../../utils";
import type { ObservableHistory } from "mobx-observable-history";
import { withInjectables } from "@ogre-tools/injectable-react";
import observableHistoryInjectable from "../../navigation/observable-history.injectable";
import requestAnimationFrameInjectable from "../animate/request-animation-frame.injectable";
// todo: refactor + handle animation-end in props.onClose()?
@@ -37,6 +38,7 @@ interface DialogState {
interface Dependencies {
navigation: ObservableHistory<unknown>;
requestAnimationFrame: (callback: () => void) => void;
}
@observer
@@ -95,7 +97,7 @@ class NonInjectedDialog extends React.PureComponent<DialogProps & Dependencies &
}
open() {
requestAnimationFrame(this.onOpen); // wait for render(), bind close-event to this.elem
this.props.requestAnimationFrame(this.onOpen); // wait for render(), bind close-event to this.elem
this.setState({ isOpen: true });
this.props.open?.();
}
@@ -182,5 +184,6 @@ export const Dialog = withInjectables<Dependencies, DialogProps>((props) => <Non
getProps: (di, props) => ({
...props,
navigation: di.inject(observableHistoryInjectable),
requestAnimationFrame: di.inject(requestAnimationFrameInjectable),
}),
});