From e38b53fe89962412828655b2045d9bb8ff994c13 Mon Sep 17 00:00:00 2001
From: Michael Bauer <michael-bauer@posteo.de>
Date: Wed, 27 Mar 2024 17:05:58 +0100
Subject: [PATCH] Delete first date nav logic

Leukeju's initial nav bar sketch is superseded.
---
 .../components/coursebook/Coursebook.vue      | 61 -------------------
 1 file changed, 61 deletions(-)

diff --git a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
index c17d9772f..d5cde20bd 100644
--- a/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
+++ b/aleksis/apps/alsijil/frontend/components/coursebook/Coursebook.vue
@@ -209,67 +209,6 @@ export default {
         });
       // sorting is necessary since backend can send docs unordered
     },
-    /**
-     * @param {"prev"|"next"} direction
-     */
-    handleDateMove(direction) {
-      const dateStartParsed = DateTime.fromISO(this.dateStart);
-      const dateEndParsed = DateTime.fromISO(this.dateEnd);
-      const dateParsed = DateTime.fromISO(this.date);
-
-      const newDate =
-        direction === "prev"
-          ? dateParsed.minus({ days: 1 })
-          : dateParsed.plus({ days: 1 });
-
-      /*
-       TODO:
-         Everything below this line is also needed for when a date is selected via the calendar.
-         → probably move this into a different function and create a second event listener for the input event.
-       */
-
-      // Load 3 days into the future/past
-      if (dateStartParsed >= newDate) {
-        this.dateStart = newDate.minus({ days: 3 }).toISODate();
-      }
-      if (dateEndParsed <= newDate) {
-        this.dateEnd = newDate.plus({ days: 3 }).toISODate();
-      }
-
-      this.$router.push({
-        name: "alsijil.coursebook",
-        params: {
-          filterType: this.filterType,
-          objType: this.objType,
-          objId: this.objId,
-        },
-      });
-
-      // Define the function to find the nearest ID
-      const ids = Array.from(
-        document.querySelectorAll("[id^='documentation_']"),
-      ).map((el) => el.id);
-
-      // TODO: This should only be done after loading the new data
-      const nearestId = this.findNearestId(newDate, direction, ids);
-      this.$vuetify.goTo("#" + nearestId);
-    },
-    findNearestId(targetDate, direction, ids) {
-      const sortedIds = ids
-        .map((id) => DateTime.fromISO(id.split("_")[1]))
-        .sort((a, b) => a - b);
-
-      if (direction === "prev") {
-        sortedIds.reverse();
-      }
-
-      const nearestId =
-        sortedIds.find((id) =>
-          direction === "next" ? id >= targetDate : id <= targetDate,
-        ) || sortedIds[sortedIds.length - 1];
-
-      return "documentation_" + nearestId.toISODate();
-    },
     dateRange(date) {
       return Interval
         .fromDateTimes(date.minus({ days: 3 }), date.plus({ days: 4 }))
-- 
GitLab