hiyaryan / 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 distorted thinking and finding alternative modes of thought (i.e. reframing) while cognitive distortions are occurring. The CDJ does that work for you. -- The CDJ is in beta testing!!
https://thecdj.app
2 stars 0 forks source link

Add collapse to chat messages. #107

Closed hiyaryan closed 5 months ago

hiyaryan commented 5 months ago

This PR does the same to Chat like it does to Recent Thoughts in #102. It adds the ability to collapse the chat messages making it easier to navigate on smaller views.

Not collapsed

Screenshot 2024-01-25 at 4 09 13 PM

Collapsed

Screenshot 2024-01-25 at 4 09 19 PM
hiyaryan commented 5 months ago

Additionally, this PR enhances ux by scrolling to the most recent chat message when the ChatEntry TextField isFocused. This only occurs when selected, if unfocused (blurred), the chat message stays anchored at the message the user is currently viewing. This is more familiar functionality (similar to iMessage) which gives the effect that the system is expecting a new message to be sent.

hiyaryan commented 5 months ago

Previous commit ensures that the alignment of the Chat Messages, where the most recent message is lined up in the Box completes before the TextField is aligned. If it doesn't have enough time the TextField will not align. Testing shows that waiting for 27 ms for the first alignment scroll to occur is how much time is needed before the TextField can align properly. This has been upped to 50 ms for extra assurance.