From 449b34df50082e466fd49de9894e5a04d8c0e31d Mon Sep 17 00:00:00 2001 From: Michael Bauer <michael-bauer@posteo.de> Date: Fri, 12 Apr 2024 21:29:05 +0200 Subject: [PATCH] Transition from intial query to infinite scroll --- .../frontend/components/coursebook/Coursebook.vue | 9 ++++++--- .../frontend/components/coursebook/CoursebookDay.vue | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue index 26a76b71c..02723cfef 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue @@ -28,7 +28,8 @@ :date="date" :docs="docs" :lastQuery="lastQuery" - :focus-on-mount="gotoDate.toMillis() === date.toMillis()" + :focus-on-mount="gotoDate && (gotoDate.toMillis() === date.toMillis())" + @init="transition" /> <date-select-footer :value="$route.hash.substring(1)" /> @@ -99,10 +100,8 @@ export default { groups: [], courses: [], incomplete: false, - // TODO: Start with false until main query finished ready: false, gotoDate: false, - // TODO: Who sets ready true & gotoDate false? }; }, computed: { @@ -171,6 +170,10 @@ export default { this.dateStart = date.minus({ days: 3 }).toISODate(); this.dateEnd = date.plus({ days: 4 }).toISODate(); }, + transition() { + this.gotoDate = false + this.ready = true + }, groupDocsByDay(docs) { // => {dt: {date: dt, docs: doc ...} ...} const docsByDay = docs.reduce((byDay, doc) => { diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue index 4c6171c81..96f3d2dd3 100644 --- a/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue +++ b/aleksis/apps/alsijil/frontend/components/coursebook/CoursebookDay.vue @@ -49,6 +49,7 @@ export default { default: false, }, }, + emits: ['init'], methods: { focus(how) { this.$el.scrollIntoView({ @@ -63,6 +64,7 @@ export default { if (this.focusOnMount) { this.$nextTick(this.focus("instant")); console.log('focused @', this.date.toISODate()); + this.$emit('init'); } }, }; -- GitLab