-
Notifications
You must be signed in to change notification settings - Fork 504
[CB] Remove tooltips from context menu #4033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
93a598b
dbeaver/pro#7772 adds truncated tooltips for context menus
sergeyteleshev 285b6b7
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
sergeyteleshev e64ad4f
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
sergeyteleshev a7365de
dbeaver/pro#7772 adds " ... " for long labels
sergeyteleshev 178dfe8
adds unit tests
sergeyteleshev 8fa917c
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
sergeyteleshev e0e4162
Update webapp/packages/core-blocks/src/Menu/MenuItemElement.tsx
sergeyteleshev 6f02892
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
sergeyteleshev 9732955
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
dariamarutkina 67ad19b
adds binding for delete row
sergeyteleshev c8455bd
removes tooltips
sergeyteleshev f423efe
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
sergeyteleshev b2eb320
fixes tree filters clipping
sergeyteleshev 459dfab
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
sergeyteleshev cd3ee3d
clips only names, not whole labels
sergeyteleshev 1e01d04
clips only names, not whole labels [2]
sergeyteleshev f3c996d
reverts getBindingLabels + fixes the os specific keys to show it first
sergeyteleshev 34d1696
clips only names, not whole labels [3]
sergeyteleshev 8743624
dbeaver/pro#7772 simplifies keys helpers logic
sergeyteleshev 637f675
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
dariamarutkina a3c72c3
Merge branch 'devel' into 7772-cb-remove-tooltips-from-context-menu
dariamarutkina File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * CloudBeaver - Cloud Database Manager | ||
| * Copyright (C) 2020-2026 DBeaver Corp and others | ||
| * | ||
| * Licensed under the Apache License, Version 2.0. | ||
| * you may not use this file except in compliance with the License. | ||
| */ | ||
| import { useEffect, useRef, useState } from 'react'; | ||
|
|
||
| import { useTranslate } from './localization/useTranslate.js'; | ||
|
|
||
| export function useTruncatedTooltip(ref: React.RefObject<HTMLDivElement | null>, tooltip: string | undefined): string | undefined { | ||
| const [isTextTruncated, setIsTextTruncated] = useState(false); | ||
| const translate = useTranslate(); | ||
| const observerRef = useRef<ResizeObserver | null>(null); | ||
| const elementRef = useRef<HTMLDivElement | null>(null); | ||
|
|
||
| function checkTruncation() { | ||
| if (elementRef.current) { | ||
| setIsTextTruncated(elementRef.current.scrollWidth > elementRef.current.clientWidth); | ||
| } | ||
| } | ||
|
|
||
| useEffect(() => { | ||
| const element = ref.current; | ||
|
|
||
| if (elementRef.current === element) { | ||
| return; | ||
| } | ||
|
|
||
| if (observerRef.current) { | ||
| observerRef.current.disconnect(); | ||
| observerRef.current = null; | ||
| } | ||
|
|
||
| elementRef.current = element; | ||
|
|
||
| if (!element) { | ||
| return; | ||
| } | ||
|
|
||
| checkTruncation(); | ||
|
|
||
| const resizeObserver = new ResizeObserver(checkTruncation); | ||
| resizeObserver.observe(element); | ||
| observerRef.current = resizeObserver; | ||
|
|
||
| return () => { | ||
| resizeObserver.disconnect(); | ||
| }; | ||
| }); | ||
|
|
||
| const translatedTooltip = tooltip ? translate(tooltip) : undefined; | ||
|
|
||
| if (isTextTruncated && translatedTooltip) { | ||
| return translatedTooltip; | ||
| } | ||
|
|
||
| return; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we dont need this, tooltips are just fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think so, we don't expect to have long tooltips or labels in the menu items, where we expect them, we should truncate them at the declaration point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for example like here:
cloudbeaver/webapp/packages/plugin-data-spreadsheet-new/src/DataGrid/DataGridContextMenu/DataGridContextMenuFilter/DataGridContextMenuFilterService.ts
Lines 405 to 434 in a836412