New day, new thread. On todays todo-list: - get fragment links to work - truncate post and thread ids - clear post text area on submit - create a seed.sql to improve local dev
Thread/post IDs are now truncated, and the post elements have gotten id attributes that make scrolling kind of work. The issue is that the div with the fragment id is not present on page load, but is loaded in afterwards. Will have to think a bit more on how to solve it, leaving it for now.
Text area should now be cleared on submit. I've also added a check to the database disallowing empty posts, as well as aborting post submission in the frontend if textarea is empty. Only thing remaining is to create a little seed data (hello chatGPT)
After a chat with GPT-4 I now have a bunch of data available for seeding my local database. Doing so also revealed an issue with my RLS, where a user can add posts to a thread started by a different author. I also had an incorrect check in the frontend, where the textarea input was shown as long as you had a session. It's now only displayed if the logged in user is the same as the author of the thread.
RLS issue should be resolved now
made a couple more improvements: - return a helpful message instead of exploding if you look up a thread that doesn't exist - improve username constraints + set reasonable, semi-random username on creation - user deletion qol improvements
I believe the solution to the scrolling-to-fragment issue is to ssr the single-thread pages. Will try it out when I get the time.
Also on the todo-list: decrease horizontal padding on small screens in order to avoid 'zooming in' when text area is selected
First post, this is actually live and working
After a bit of fiddling with supabase complaining that a foreign key relation didn't exist, it's now _actually_ working. I was able to fix the issue by running NOTIFY pgrst, 'reload schema';
Having some issues with timestamps overflowing and covering author and thread ID on small screens, will fix tomorrow. Possible fix: only display timestamps on posts, not threads
Posts now display timestamps + id, and the post id is also a fragment link. Need to set the post id to truncate. Maybe just display the first section of the uuid? For the fragments to work I need to figure out how to do names anchors in react
One more thing I just noticed: need to clear the text area on submit