cognovi-ai / the-cdj

The Cognitive Distortion Journal (CDJ) is a smart journaling tool that helps remedy distorted thinking. It can feel impossible to follow the CBT technique of labeling and reframing distorted thinking when you've been thinking this way your whole life. The CDJ can help with that 🧠✨ -- v2 is in development!
https://thecdj.app
3 stars 0 forks source link

Fix TypeError and scroll behavior. #112

Closed hiyaryan closed 9 months ago

hiyaryan commented 9 months ago

This PR closes #111. It does this by scrolling to the last message in the chat box only if there is a message to reference and only if the existing last message is not in view.

hiyaryan commented 9 months ago

Adds a new isElementInView function to the Chat component to check if the last message is in view. If not, and only if there is a reference to a last message (messages exist for the entry) does the alignment scrolling occur for the messages. Previously, it always occurred and the alignment appeared to bounce before the Chat component aligned itself.