Browse Source

Merge pull request #5323 from nocodb/feat/title-tag

feat: title tag
pull/5327/head
Raju Udava 2 years ago committed by GitHub
parent
commit
ce7141bb6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      packages/nc-gui/components/dashboard/TreeView.vue
  2. 7
      packages/nc-gui/layouts/shared-view.vue
  3. 1
      packages/nc-gui/nuxt.config.ts

23
packages/nc-gui/components/dashboard/TreeView.vue

@ -42,7 +42,7 @@ const { $api, $e } = useNuxtApp()
const projectStore = useProject() const projectStore = useProject()
const { loadTables } = projectStore const { loadTables } = projectStore
const { bases, tables, isSharedBase } = storeToRefs(projectStore) const { bases, tables, isSharedBase, project } = storeToRefs(projectStore)
const { activeTab } = storeToRefs(useTabs()) const { activeTab } = storeToRefs(useTabs())
@ -297,16 +297,28 @@ useEventListener(document, 'keydown', async (e: KeyboardEvent) => {
watch( watch(
activeTable, activeTable,
(value, oldValue) => { (value, oldValue) => {
let tableTitle
if (value) { if (value) {
if (value !== oldValue) { if (value !== oldValue) {
const fndTable = tables.value.find((el) => el.id === value) const fndTable = tables.value.find((el) => el.id === value)
if (fndTable) { if (fndTable) {
activeKey.value = [`collapse-${fndTable.base_id}`] activeKey.value = [`collapse-${fndTable.base_id}`]
tableTitle = fndTable.title
} }
} }
} else { } else {
if (bases.value.filter((el) => el.enabled)[0]?.id) const table = bases.value.filter((el) => el.enabled)[0]
activeKey.value = [`collapse-${bases.value.filter((el) => el.enabled)[0].id}`] if (table?.id) {
activeKey.value = [`collapse-${table.id}`]
}
if (table?.title) {
tableTitle = table.title
}
}
if (project.value.title && tableTitle) {
document.title = `${project.value.title}: ${tableTitle} | NocoDB`
} else {
document.title = 'NocoDB'
} }
}, },
{ immediate: true }, { immediate: true },
@ -1021,7 +1033,10 @@ const setIcon = async (icon: string, table: TableType) => {
<LazyGeneralHelpAndSupport class="color-transition px-2 text-gray-500 cursor-pointer select-none hover:text-accent" /> <LazyGeneralHelpAndSupport class="color-transition px-2 text-gray-500 cursor-pointer select-none hover:text-accent" />
<GeneralJoinCloud v-if="!isMobileMode" class="color-transition px-2 text-gray-500 cursor-pointer select-none hover:text-accent" /> <GeneralJoinCloud
v-if="!isMobileMode"
class="color-transition px-2 text-gray-500 cursor-pointer select-none hover:text-accent"
/>
<GithubButton <GithubButton
v-if="!isMobileMode" v-if="!isMobileMode"

7
packages/nc-gui/layouts/shared-view.vue

@ -30,6 +30,13 @@ onMounted(() => {
if (href) notifyLocationChange(href) if (href) notifyLocationChange(href)
}) })
} }
// handle meta title
if (sharedView.value?.title) {
document.title = `${sharedView.value.title} | NocoDB`
} else {
document.title = 'NocoDB'
}
}) })
</script> </script>

1
packages/nc-gui/nuxt.config.ts

@ -49,7 +49,6 @@ export default defineNuxtConfig({
}, },
meta: { meta: {
title: 'NocoDB',
link: [ link: [
{ {
rel: 'icon', rel: 'icon',

Loading…
Cancel
Save