diff --git a/src/helpers/scrollIntoView.ts b/src/helpers/scrollIntoView.ts new file mode 100644 index 000000000..1ef6bcdc2 --- /dev/null +++ b/src/helpers/scrollIntoView.ts @@ -0,0 +1,19 @@ +export function scrollIntoView(el: HTMLElement | null | undefined) { + if (!el) { + return + } + + const boundingRect = el.getBoundingClientRect() + const scrollY = window.scrollY + + if ( + boundingRect.top > (scrollY + window.innerHeight) || + boundingRect.top < scrollY + ) { + el.scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'nearest', + }) + } +} \ No newline at end of file diff --git a/src/router/index.ts b/src/router/index.ts index 014c32c0d..395e305e3 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -22,7 +22,8 @@ import DataExportDownload from '../views/user/DataExportDownload.vue' import UpcomingTasksComponent from '../views/tasks/ShowTasks.vue' import LinkShareAuthComponent from '../views/sharing/LinkSharingAuth.vue' import ListNamespaces from '../views/namespaces/ListNamespaces.vue' -import TaskDetailView from '../views/tasks/TaskDetailView.vue' +const TaskDetailView = () => import('../views/tasks/TaskDetailView.vue') + // Team Handling import ListTeamsComponent from '../views/teams/ListTeams.vue' // Label Handling diff --git a/src/views/tasks/TaskDetailView.vue b/src/views/tasks/TaskDetailView.vue index 561b1a486..beb9f4546 100644 --- a/src/views/tasks/TaskDetailView.vue +++ b/src/views/tasks/TaskDetailView.vue @@ -1,7 +1,7 @@ -