Innovative idea for a time management system based on timelines and scheduling

My latest project involves creating a scrollable scheduler, inspired by vis-timeline and built using Vue.js.
One of the main challenges I'm facing is achieving smooth infinite scrolling in all directions (past and future).

I must confess that I'm still relatively new to programming, so I would greatly appreciate any feedback or evaluation of my approach.

This is what my current solution looks like:

JS:

let datelist = [yesterday, today, tomorrow]

HTML:

<div v-for="date of datelist">
    <div width="100%" height="100%">{{date}}</div>
</div>

Since 3 divs occupy 300% of the screen space, it causes overflow (visible scrollbar). After rendering, I center the middle one (today).

When scrolling via drag-and-drop and 50% of the previous or next day is visible, an event is triggered to update the datelist:

Scrolling left:

*Generate yesterday's date and remove tomorrow *

datelist = [yesterday -1 day, yesterday, today]

Scrolling right:

*Generate tomorrow's date and remove yesterday *

datelist = [today, tomorrow, tomorrow + 1]

However, this approach has its drawbacks:

Every time the list changes, it needs to be fully re-rendered. If each day ends up having a lot of content later on (like appointments), it could impact performance.

You can only scroll linearly with this method, and if you want to jump to a specific date, say using a date picker, the entire list needs to be regenerated.

Perhaps more challenges ahead?

How would you tackle this problem? I am more interested in the process of finding a solution rather than just the solution itself.

Constraints:

  • No third-party libraries
  • Optimal performance
  • Simplicity

Answer №1

To achieve the desired functionality in your project, utilizing the IntersectionObserver API is highly recommended. This will allow you to customize behavior, fetch content dynamically, and enable interactive features for the "date cells" within your application.
For a convenient solution, consider integrating the useIntersectionObserver composable.


If you aim to optimize performance by displaying only visible content and minimizing DOM clutter, tools like virtual scrollers may be beneficial. Alternatively, custom implementations can also achieve similar results (refer to provided source code).


In cases where list re-rendering is necessary, it's advisable to apply specific modifications at targeted locations rather than resetting the entire list. Experiment with memoization techniques using resources like memoize hooks to streamline this process efficiently.
By strategically managing data visibility through CSS styling or off-screen positioning, you can retain historical date entries without removing them entirely from the list. Consider incorporating boundary logic into your approach for seamless transitions.


In summary, when facing constraints, prioritize optimizing two out of three aspects based on project requirements.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Display an icon before an active v-list-item in Vuetify 3's v-list

I need help figuring out how to add an icon to a v-list-item only if it is active. <v-list class="px-15 pt-5" border density="compact"> <v-list-item v-for="(item,i) in items"> <!-- Need assistance putting ...

Validation with Vuelidate of a Vue form field within a BootstrapVue component is triggered by a click event

I am in the process of developing a registration form that checks if a login ID entered by the user is available on the server. This particular form is built using bootstrapvue. <b-form @submit="onSubmit" v-if="show" @reset="onReset" > & ...

Can Angular JS apply the uppercase filter to a boolean value?

My Angular 1.4.12 binding looks like this: {{ mob.mobDataSettings[7].value | uppercase }} The first part is a boolean value from a JSON file, which can be either true or false. But when rendered in HTML, it is not showing up as uppercase (e.g. TRUE), in ...

What is the best way to specify option values for selection in AngularJS?

...while still maintaining the model bindings? I currently have a select menu set up like this: <select class="form-control" ng-model="activeTask" ng-options="task.title for task in tasks"> </select> When an option is selected, it displays s ...

Transferring information about service events to a controller in Angular

I am facing an issue with some audio elements in my service that listen for the "ended" event. I am looking for a way to pass this message to an angular controller. Currently, my service code looks like this: Audio.addEventListener "ended", (-> ...

Dynamic file name and title for jQuery Datatables Export Buttons

I am utilizing jQuery datatable along with Export buttons. When adjusting the filename and title, I encounter an issue. The problem lies in my desire for the title to be dynamic, depending on the applied filters and custom ones. Additionally, configurin ...

Angular2 - Utilizing Promises within a conditional block

I'm currently facing an issue where I need to await a response from my server in order to determine if an email is already taken or not. However, I am struggling to achieve this synchronously. TypeScript is indicating that the function isCorrectEmail( ...

Adjust an OnDemandGrid utilizing dstore/Rest output through a POST request instead of a PUT request

I am facing a perplexing issue. I have an OnDemandGrid that is editable, and below it, I have a dstore/Rest collection connected to my backend (using PHP). While I can edit the data in the OnDemandGrid, I am unable to save it properly. When it reaches the ...

I am hoping for the outcome to be directed to the homepage

I'm struggling to figure this out, as I am new to classic ASP and JavaScript. I hope someone can help me understand. I want to display the response.write on the main.asp (or the result) page, but each time I try, it redirects to pass.asp on a differen ...

Is there a way to dynamically modify a website's default viewport settings in a mobile browser?

When viewing a website in Landscape mode, everything looks good. However, switching to Portrait mode displays the message "Screen size not supported." I decided to test this on my desktop browser and discovered that adjusting the initial-scale:1 to initial ...

Having issues with the grid system in a Vuetify v-footer component

I am struggling to organize my links into three columns in the footer along with the copyright line below. However, I am facing an issue where the copyright text appears in a mysterious fourth column, overlapping the third if the screen width is too small. ...

Update: "Mui V5 - Eliminate collapse/expand icons in TreeView and reduce TreeItem indentation"

My current project involves Mui V5 and I am looking to customize the TreeView component. Specifically, I need to remove the collapse/expand icons as I want them to be integrated into the TreeItem label component on the left side instead of the right. Add ...

Using VueLoaderPlugin() results in an 'undefined error for 'findIndex' function

Currently, I am in the process of integrating a Vue CLI app into another web project that we are actively developing. The Vue app functions without any issues when utilizing the development server bundled with Vue CLI. Due to the presence of .vue files wi ...

Change the class of <body> when the button is clicked

One of my tasks involves adding a button that, when clicked, should give the body the class "open-menu". Implementing this using jQuery was quite straightforward - I just needed to add the following line of code: $('.burger').click(function() ...

Tips on successfully passing multiple keys and their associated HTML tag attributes in a React application

One of my links, specified with an a-tag, appears in this manner: <a href={ item.htmlReportUrl } target="_blank" rel="noopener noreferrer"> {item.htmlReportText}</a> The values for the href and the linktext are sourced from the following: ro ...

In Node.js, JavaScript, when using SQLite, the variables are inserted as Null

I have spent a lot of time searching and trying various methods, but I am still unable to solve this issue. My goal is to insert 8 variables received from an API call into an SQLite table. Although the execution seems correct, when I query the table, all v ...

How can a non-commonJS library be effectively integrated into the Webpack environment?

Looking to incorporate an external and non-commonJS library to define an AngularJS module. What is the best approach since directly importing it won't work, like this: import MyLibrary from 'MyLibraryPath' angular.module('MyApp' ...

What is the reason behind "Script" being considered the offspring of "Body"?

Unfortunately, I struggle with HTML/CSS/Javascript and am just trying to get through my exams. I have the code snippet below: <script> window.onload=function() { var c = document.body.childNodes; var txt = ""; var i; for ...

Where can content-tag and main-tag be found in vue-virtual-scroller?

I've been trying to wrap my head around the vue virtual scroller. I couldn't help but notice in the demo that it utilizes a few HTML attributes... <virtual-scroller v-if="scopedSlots" class="scroller" :item-height="itemHeight" :items="items" ...

Headers cannot be set again after they have been sent to the client in Express Node

I attempted to create a post request for login with the following code: router.post('/login', async(req, res) =>{ const user = await User.findOne({gmail: req.body.gmail}) !user && res.status(404).json("user not matched") c ...