Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/hub-ui/src/client/components/dock/DockEntries.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)"
/>
</template>
Expand Down
15 changes: 14 additions & 1 deletion packages/hub-ui/src/client/components/dock/DockEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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<DevframeDockEntryBase, 'title' | 'icon'>
}>(),
{
tooltip: true,
Expand Down Expand Up @@ -57,7 +63,7 @@ function updateTooltip() {
if (!button.value)
return
setFloatingTooltip({
content: dockTooltipContent(props.dock),
content: dockTooltipContent(props.dock, props.group),
el: button.value,
})
}
Expand Down Expand Up @@ -122,6 +128,13 @@ useEventListener('pointerdown', () => {
>
{{ badge }}
</div>
<div
v-if="group"
class="absolute bottom-0 right-0 w-3 h-3 p-0.25 rounded-full bg-base border border-base shadow-sm pointer-events-none"
aria-hidden="true"
>
<DockIcon :icon="group.icon" class="w-full h-full select-none" />
</div>
</button>
</div>
</template>
18 changes: 14 additions & 4 deletions packages/hub-ui/src/client/state/floating-tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,22 @@ const docksOverflowPanel = shallowRef<FloatingPopoverProps | null>(null)
const docksSidebarOverflowPanel = shallowRef<FloatingPopoverProps | null>(null)
const dockContextMenu = shallowRef<FloatingPopoverProps | null>(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),
])
}
Expand Down
Loading