From 6d640ffe4d1470d332714ee718ee176b4e1c5fab Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Wed, 27 Mar 2024 17:27:57 +0100
Subject: [PATCH] Show top visible as fragment in url

---
 .../frontend/components/coursebook/Coursebook.vue     | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
index 2f15b8ae5..42bf9ed63 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
@@ -356,13 +356,8 @@ export default {
         // integrate into docsByDay
       }
     },
-    gotoDate(date, scroll) {
-      // show
+    setDate(date) {
       this.$router.replace({ hash: date })
-      console.log('hash', this.$route.hash);
-      // assure
-      this.assureDate(DateTime.fromISO(date));
-      // scroll
     },
     onIntersect(entries, observer) {
       const entry = entries[0];
@@ -374,7 +369,7 @@ export default {
         if (this.visible[0] > entry.target.dataset.date || this.visible.length === 0) {
           // coming is new first (top) date
           this.visible.unshift(entry.target.dataset.date);
-          console.log('current', this.visible[0]);
+          this.setDate(this.visible[0]);
         } else if (this.visible[this.visible.length -1] < entry.target.dataset.date) {
           // coming is new last (bottom) date
           this.visible.push(entry.target.dataset.date);
@@ -389,7 +384,7 @@ export default {
       } else if (this.visible[0] === entry.target.dataset.date) {
         // first (top) visible date is going
         this.visible.shift()
-        console.log('current', this.visible[0]);
+        this.setDate(this.visible[0]);
       } else if (this.visible[this.visible.length - 1] === entry.target.dataset.date) {
         // last (bottom) visible date is going
         this.visible.pop()
-- 
GitLab