Browse Source

fix: Added link for table section in bread crumb

pull/6827/head
Muhammed Mustafa 1 year ago
parent
commit
3893305821
  1. 14
      packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue
  2. 21
      packages/nc-gui/store/tables.ts

14
packages/nc-gui/components/smartsheet/toolbar/ViewInfo.vue

@ -6,6 +6,7 @@ const { openedViewsTab, activeView } = storeToRefs(useViewsStore())
const { base, isSharedBase } = storeToRefs(useBase())
const { activeTable } = storeToRefs(useTablesStore())
const { tableUrl } = useTablesStore()
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
</script>
@ -33,7 +34,7 @@ const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
<div class="flex flex-row items-center gap-x-1.5">
<GeneralProjectIcon
:meta="{ type: base?.type }"
class="!grayscale"
class="!grayscale min-w-4"
:style="{
filter: 'grayscale(100%) brightness(115%)',
}"
@ -64,14 +65,15 @@ const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
/>
</template>
</LazyGeneralEmojiPicker>
<NcTooltip
class="truncate nc-active-table-title"
<div
v-if="activeTable"
:class="{
'max-w-1/2': isMobileMode || activeView?.is_default,
'max-w-20/100': !isSharedBase && !isMobileMode && !activeView?.is_default,
'max-w-none': isSharedBase && !isMobileMode,
}"
>
<NcTooltip class="truncate nc-active-table-title max-w-full">
<template #title>
{{ activeTable?.title }}
</template>
@ -86,10 +88,16 @@ const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
whiteSpace: 'nowrap',
display: 'inline',
}"
>
<NuxtLink
class="!hover:(text-black underline-gray-600) !text-inherit !underline-transparent"
:to="tableUrl({ table: activeTable, completeUrl: true })"
>
{{ activeTable?.title }}
</NuxtLink>
</span>
</NcTooltip>
</div>
</template>
<div v-if="!isMobileMode" class="px-1 text-gray-500">/</div>

21
packages/nc-gui/store/tables.ts

@ -213,6 +213,26 @@ export const useTablesStore = defineStore('tablesStore', () => {
}
}
const tableUrl = ({ table, completeUrl }: { table: TableType; completeUrl: boolean }) => {
const base = basesStore.bases.get(table.base_id!)
if (!base) return
const nuxtPageName = 'index-typeOrId-baseId-index-index-viewId-viewTitle'
const url = router.resolve({
name: nuxtPageName,
params: {
typeOrId: workspaceStore.activeWorkspaceId,
baseId: base.id,
viewId: table.id,
},
})
if (completeUrl) return `${window.location.origin}${url.href}`
return url.href
}
return {
baseTables,
loadProjectTables,
@ -223,6 +243,7 @@ export const useTablesStore = defineStore('tablesStore', () => {
updateTable,
activeTableId,
navigateToTable,
tableUrl,
}
})

Loading…
Cancel
Save