Commit Graph

8 Commits

Author SHA1 Message Date
Kartik K. Agaram 8cfc7e3e10 more conflict-resistant comment storage
Until now, comments were stored in filenames with an incrementing
counter. As a result, conflicts are easy; two people commenting on a
post around the same time would create the same filename. Then they'd
run into conflicts when merging.

Now comment filenames include a random slug.

A secondary consideration is filtering out comments from the file-picker
screen. It's only intended for top-level posts. I had a hacky way to do
this. My ideal approach would be a directory per post, but Lua+LÖVE
doesn't have a portable way to create directories.

Now you now have to manually create a single directory called
`comments/` in the directory of articles before using pothi.love.
2023-07-16 13:45:30 -07:00
Kartik K. Agaram 2697d5eb7f reply starting to work
I can't seem to break it, though I'm sleepy and don't have a good grasp
of the big picture.
2023-06-22 23:43:03 -07:00
Kartik K. Agaram b0ca118a7a mock-up of reply buttons
Doesn't do anything yet, just changes color.
2023-06-22 18:17:01 -07:00
Kartik K. Agaram 3a2b77b6c7 . 2023-06-20 23:18:25 -07:00
Kartik K. Agaram e7063abc7c add border to each item in a thread 2023-06-20 22:38:49 -07:00
Kartik K. Agaram 37d5358290 start rendering the initialized thread
This required a little more restructuring of Global_state. It's not flat
now, it's hierarchical again, but in a different way.

after commit 3d89b8eb9d:
  post
    \- reply A
        \- reply B
    \- reply C

after commit f9f7dab9b7:
  post
  reply A
  reply B
  reply C

after this commit:
  row
    \- col
        \- indent 0
        \- post
    \- col
        \- indent 1
        \- reply A
    \- col
        \- indent 2
        \- reply B
    \- col
        \- indent 1
        \- reply C

The indents are just invisible rectangles of different widths with 0
height.

One change I had to make was to initialize_editor. Neither luaML and
driver load lines from disk, but that's arguably the common scenario to
support.
2023-06-20 20:10:10 -07:00
Kartik K. Agaram f9f7dab9b7 restructure Global_state
Instead of a tree of items, we now have a flat list. Each item knows its
depth. This structure is closer to what luaML's compute_layout needs.

For any future hierarchical functionality, each item still knows its
parent and replies as ids inside the metadata field.

Next step: redo A for this app. compute_layout should stay fairly
timeless across forks of luaML.

Pace layers for apps built on the box model:
  A
  B
  ...
  F (I think of on.draw as F)

A runs least frequently, F runs on every frame.

In this app, the plan is:
  * initialize_thread will load items inside Global_state
  * A will convert items into a relatively stable box model of rows,
    columns and text editors in Surface, using compute_layout as a
    helper.
  * B will recompute some aspects of Surface as the viewport moves.

Anything that changes the height of any box needs to rerun A. Anything
that moves the viewport reruns B.
2023-06-20 17:13:01 -07:00
Kartik K. Agaram fd5ca6f3f8 load in-memory data for a thread
Nothing displayed yet. I need to convert threads to Surface nodes.
2023-06-18 20:10:20 -07:00