Feat: Add copy model link to models card (#5591)
This commit is contained in:
@@ -118,6 +118,7 @@ import { getTargetObjectIds } from '~~/lib/object-sidebar/helpers'
|
||||
import { useLoadLatestVersion } from '~~/lib/viewer/composables/resources'
|
||||
import { SpeckleViewer } from '@speckle/shared'
|
||||
import { useMixpanel } from '~~/lib/core/composables/mp'
|
||||
import { useCopyModelLink } from '~~/lib/projects/composables/modelManagement'
|
||||
import { Ellipsis } from 'lucide-vue-next'
|
||||
|
||||
type ModelItem = NonNullable<Get<ViewerLoadedResourcesQuery, 'project.models.items[0]'>>
|
||||
@@ -149,6 +150,7 @@ const {
|
||||
ui: { filters }
|
||||
} = useInjectedViewerState()
|
||||
const mp = useMixpanel()
|
||||
const copyModelLink = useCopyModelLink()
|
||||
const { formattedRelativeDate, formattedFullDate } = useDateFormatters()
|
||||
|
||||
const route = useRoute()
|
||||
@@ -174,15 +176,19 @@ const removeEnabled = computed(() => items.value.length > 1)
|
||||
const actionsItems = computed<LayoutMenuItem[][]>(() => [
|
||||
[
|
||||
{
|
||||
title: 'Load latest version',
|
||||
id: 'load-latest-version',
|
||||
disabled: isLatest.value,
|
||||
disabledTooltip: 'Already on the latest version'
|
||||
title: 'Copy link to model',
|
||||
id: 'copy-link-to-model'
|
||||
},
|
||||
{
|
||||
title: 'Show version history',
|
||||
id: 'show-version-history'
|
||||
},
|
||||
{
|
||||
title: 'Load latest version',
|
||||
id: 'load-latest-version',
|
||||
disabled: isLatest.value,
|
||||
disabledTooltip: 'Already on the latest version'
|
||||
},
|
||||
{
|
||||
title: 'Show version changes',
|
||||
id: 'show-version-changes',
|
||||
@@ -343,6 +349,11 @@ const onActionChosen = async (params: { item: LayoutMenuItem }) => {
|
||||
const { item } = params
|
||||
|
||||
switch (item.id) {
|
||||
case 'copy-link-to-model':
|
||||
if (project.value) {
|
||||
copyModelLink({ model: { projectId: project.value.id, id: props.model.id } })
|
||||
}
|
||||
break
|
||||
case 'load-latest-version':
|
||||
if (!isLatest.value) {
|
||||
loadLatestVersion()
|
||||
|
||||
Reference in New Issue
Block a user