Browse Source

fix: Added link for table section in bread crumb

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

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

@ -6,6 +6,7 @@ const { openedViewsTab, activeView } = storeToRefs(useViewsStore())
const { base, isSharedBase } = storeToRefs(useBase()) const { base, isSharedBase } = storeToRefs(useBase())
const { activeTable } = storeToRefs(useTablesStore()) const { activeTable } = storeToRefs(useTablesStore())
const { tableUrl } = useTablesStore()
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore()) const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
</script> </script>
@ -33,7 +34,7 @@ const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
<div class="flex flex-row items-center gap-x-1.5"> <div class="flex flex-row items-center gap-x-1.5">
<GeneralProjectIcon <GeneralProjectIcon
:meta="{ type: base?.type }" :meta="{ type: base?.type }"
class="!grayscale" class="!grayscale min-w-4"
:style="{ :style="{
filter: 'grayscale(100%) brightness(115%)', filter: 'grayscale(100%) brightness(115%)',
}" }"
@ -64,32 +65,39 @@ const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
/> />
</template> </template>
</LazyGeneralEmojiPicker> </LazyGeneralEmojiPicker>
<NcTooltip <div
class="truncate nc-active-table-title" v-if="activeTable"
:class="{ :class="{
'max-w-1/2': isMobileMode || activeView?.is_default, 'max-w-1/2': isMobileMode || activeView?.is_default,
'max-w-20/100': !isSharedBase && !isMobileMode && !activeView?.is_default, 'max-w-20/100': !isSharedBase && !isMobileMode && !activeView?.is_default,
'max-w-none': isSharedBase && !isMobileMode, 'max-w-none': isSharedBase && !isMobileMode,
}" }"
> >
<template #title> <NcTooltip class="truncate nc-active-table-title max-w-full">
{{ activeTable?.title }} <template #title>
</template> {{ activeTable?.title }}
<span </template>
class="text-ellipsis overflow-hidden text-gray-500 xs:ml-2" <span
:class="{ class="text-ellipsis overflow-hidden text-gray-500 xs:ml-2"
'text-gray-500': !isMobileMode, :class="{
'text-gray-700 font-medium': isMobileMode || activeView?.is_default, 'text-gray-500': !isMobileMode,
}" 'text-gray-700 font-medium': isMobileMode || activeView?.is_default,
:style="{ }"
wordBreak: 'keep-all', :style="{
whiteSpace: 'nowrap', wordBreak: 'keep-all',
display: 'inline', whiteSpace: 'nowrap',
}" display: 'inline',
> }"
{{ activeTable?.title }} >
</span> <NuxtLink
</NcTooltip> class="!hover:(text-black underline-gray-600) !text-inherit !underline-transparent"
:to="tableUrl({ table: activeTable, completeUrl: true })"
>
{{ activeTable?.title }}
</NuxtLink>
</span>
</NcTooltip>
</div>
</template> </template>
<div v-if="!isMobileMode" class="px-1 text-gray-500">/</div> <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 { return {
baseTables, baseTables,
loadProjectTables, loadProjectTables,
@ -223,6 +243,7 @@ export const useTablesStore = defineStore('tablesStore', () => {
updateTable, updateTable,
activeTableId, activeTableId,
navigateToTable, navigateToTable,
tableUrl,
} }
}) })

Loading…
Cancel
Save