Page MenuHomePhabricator

D6786.diff
No OneTemporary

D6786.diff

diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js
--- a/web/utils/tooltip-utils.js
+++ b/web/utils/tooltip-utils.js
@@ -19,6 +19,7 @@
import { threadPermissions } from 'lib/types/thread-types.js';
import { longAbsoluteDate } from 'lib/utils/date-utils.js';
+import { getAppContainerPositionInfo } from './window-utils.js';
import {
tooltipButtonStyle,
tooltipLabelStyle,
@@ -69,8 +70,6 @@
+actionButtonContent: React.Node,
};
-const appTopBarHeight = 65;
-
const font =
'14px "Inter", -apple-system, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", ' +
'"Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", ui-sans-serif';
@@ -90,17 +89,11 @@
defaultPosition,
preventDisplayingBelowSource,
}: FindTooltipPositionArgs): TooltipPosition {
- if (!window) {
+ const appContainerPositionInfo = getAppContainerPositionInfo();
+
+ if (!appContainerPositionInfo) {
return defaultPosition;
}
- const appContainerPositionInfo: PositionInfo = {
- height: window.innerHeight - appTopBarHeight,
- width: window.innerWidth,
- top: appTopBarHeight,
- bottom: window.innerHeight,
- left: 0,
- right: window.innerWidth,
- };
const pointingTo = sourcePositionInfo;
const {
diff --git a/web/utils/window-utils.js b/web/utils/window-utils.js
new file mode 100644
--- /dev/null
+++ b/web/utils/window-utils.js
@@ -0,0 +1,22 @@
+// @flow
+
+import type { PositionInfo } from '../chat/position-types.js';
+
+function getAppContainerPositionInfo(): ?PositionInfo {
+ if (!window) {
+ return null;
+ }
+
+ const appTopBarHeight = 65;
+
+ return {
+ height: window.innerHeight - appTopBarHeight,
+ width: window.innerWidth,
+ top: appTopBarHeight,
+ bottom: window.innerHeight,
+ left: 0,
+ right: window.innerWidth,
+ };
+}
+
+export { getAppContainerPositionInfo };

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 2:45 PM (17 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700222
Default Alt Text
D6786.diff (1 KB)

Event Timeline