Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3524817
D6786.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D6786.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D6786: [web] factor out app container position info logic out of tooltip utils
Attached
Detach File
Event Timeline
Log In to Comment