diff --git a/packages/hub-ui/src/client/components/dock/DockEntries.vue b/packages/hub-ui/src/client/components/dock/DockEntries.vue index d572c4c3..61f7fe46 100644 --- a/packages/hub-ui/src/client/components/dock/DockEntries.vue +++ b/packages/hub-ui/src/client/components/dock/DockEntries.vue @@ -3,7 +3,7 @@ import type { DevframeDockEntry } from '@devframes/hub' import type { DocksContext } from '@devframes/hub/client' import { evaluateWhen } from 'devframe/utils/when' import { computed, toRefs } from 'vue' -import { getGroupMembers, resolveGroupDefaultChild } from '../../state/dock-settings' +import { getEntryGroup, getGroupMembers, resolveGroupDefaultChild } from '../../state/dock-settings' import { getCurrentDockId } from '../../state/docks' import { useSettings } from '../../state/settings-defaults' import DockEntry from './DockEntry.vue' @@ -86,6 +86,7 @@ function toggleDockEntry(dock: DevframeDockEntry) { :is-vertical="isVertical" :badge="dock.badge" :badge-variant="dock.badgeVariant" + :group="getEntryGroup(context.docks.entries, dock)" @click="toggleDockEntry(dock)" /> diff --git a/packages/hub-ui/src/client/components/dock/DockEntry.vue b/packages/hub-ui/src/client/components/dock/DockEntry.vue index c70c59f2..abbf665d 100644 --- a/packages/hub-ui/src/client/components/dock/DockEntry.vue +++ b/packages/hub-ui/src/client/components/dock/DockEntry.vue @@ -24,6 +24,12 @@ const props = withDefaults( badge?: string badgeVariant?: DevframeDockBadgeVariant tooltip?: boolean + /** + * The group this dock belongs to, when it sits on the bar outside its + * group button (pinned or recent). Draws the group icon as a corner mark, + * so two tools with similar icons from different groups stay apart. + */ + group?: Pick }>(), { tooltip: true, @@ -57,7 +63,7 @@ function updateTooltip() { if (!button.value) return setFloatingTooltip({ - content: dockTooltipContent(props.dock), + content: dockTooltipContent(props.dock, props.group), el: button.value, }) } @@ -122,6 +128,13 @@ useEventListener('pointerdown', () => { > {{ badge }} + diff --git a/packages/hub-ui/src/client/state/floating-tooltip.ts b/packages/hub-ui/src/client/state/floating-tooltip.ts index 965e062e..d6756b31 100644 --- a/packages/hub-ui/src/client/state/floating-tooltip.ts +++ b/packages/hub-ui/src/client/state/floating-tooltip.ts @@ -13,12 +13,22 @@ const docksOverflowPanel = shallowRef(null) const docksSidebarOverflowPanel = shallowRef(null) const dockContextMenu = shallowRef(null) -/** A dock entry's tooltip: its title, with its `description` below when set. */ -export function dockTooltipContent(entry: { title: string, description?: string }): FloatingPopoverProps['content'] { +/** + * A dock entry's tooltip: its title, with its `description` below when set. + * When `group` is set, the title is prefixed with the group title, so a dock + * shown outside its group button still tells which group it comes from. + */ +export function dockTooltipContent( + entry: { title: string, description?: string }, + group?: { title: string }, +): FloatingPopoverProps['content'] { + const title = group + ? `${group.title} › ${entry.title}` + : entry.title if (!entry.description) - return entry.title + return title return () => h('div', { class: 'flex flex-col gap-0.5 max-w-64' }, [ - h('span', entry.title), + h('span', title), h('span', { class: 'text-xs color-muted' }, entry.description), ]) }