Put reacting beside answering
The react button was down in the pill row, which put the two things you can do to a message in two different places. They are the same kind of thing — what you do to a message rather than what it says — so they now share the sender's line and the right edge, `↩` then `☺`. What is left under the message is what people actually put there: the pills, and the row of emoji to choose from while the button is open. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ef9aff9 parent: c2e02a9 modified
src/frq/app.jolt +25 -11 | @@ -254,13 +254,23 @@ | ||
| 254 | 254 | ;; The message it answers is older than this buffer goes. |
| 255 | 255 | [:dim-label {:label "↩ replying to an earlier message"}])]) |
| 256 | 256 | |
| 257 | +(defn- react-button | |
| 258 | + "The way to put an emoji on a message, beside the way to answer it. | |
| 259 | + | |
| 260 | + Both are things done *to* a message rather than parts of it, so they share | |
| 261 | + the sender's line and the right edge. It opens the quick row for this message | |
| 262 | + alone — the emoji are only worth their space while someone is choosing one." | |
| 263 | + [m] | |
| 264 | + (let [open? (= (:id m) @s/reacting)] | |
| 265 | + [:button {:label (if open? "×" "☺") | |
| 266 | + :on-click #(reset! s/reacting (when-not open? (:id m)))}])) | |
| 267 | + | |
| 257 | 268 | (defn- reaction-row |
| 258 | - "What people have put on a message, and the way to put something there too. | |
| 269 | + "What people have put on a message, under it, and the emoji to choose from | |
| 270 | + while the react button is open. | |
| 259 | 271 | |
| 260 | 272 | A pill carries its count and toggles: clicking one you are already on takes |
| 261 | - yours off, which is the same gesture that put it there. The `+` opens the | |
| 262 | - quick row for this message alone — the emoji are only worth their space while | |
| 263 | - someone is choosing one." | |
| 273 | + yours off, which is the same gesture that put it there." | |
| 264 | 274 | [channel m] |
| 265 | 275 | (let [reactions (:reactions m) |
| 266 | 276 | open? (= (:id m) @s/reacting)] |
| @@ -271,10 +281,7 @@ | ||
| 271 | 281 | [:button {:key emoji |
| 272 | 282 | :label (str emoji " " (count nicks)) |
| 273 | 283 | :kind (if (s/my-reaction? m emoji) :primary :normal) |
| 274 | - :on-click #(s/toggle-reaction! channel m emoji)}])) | |
| 275 | - [:button {:key :add | |
| 276 | - :label (if open? "×" "+") | |
| 277 | - :on-click #(reset! s/reacting (when-not open? (:id m)))}]] | |
| 284 | + :on-click #(s/toggle-reaction! channel m emoji)}]))] | |
| 278 | 285 | [:hbox {:key :picker :spacing 4} |
| 279 | 286 | (when open? |
| 280 | 287 | (for [emoji s/quick-reactions] |
| @@ -339,9 +346,16 @@ | ||
| 339 | 346 | ;; takes the width that is left. The text keeps a column of its own: |
| 340 | 347 | ;; a wrapping label directly in a row wraps against the row. |
| 341 | 348 | [:hbox {:key :line :align :end :spacing 6} |
| 342 | - ;; The button sits in the row itself rather than in a box of its own: | |
| 343 | - ;; a box with no width takes the rest of the row and puts the text on a | |
| 344 | - ;; line below it, and one with a width takes the column's whole height. | |
| 349 | + ;; Answering and reacting sit together because they are the same kind | |
| 350 | + ;; of thing: what you do to a message rather than what it says. Both | |
| 351 | + ;; are in the row itself rather than in a box of their own — a box with | |
| 352 | + ;; no width takes the rest of the row and puts the text on a line below | |
| 353 | + ;; it, and one with a width takes the column's whole height. Reacting | |
| 354 | + ;; comes first in the source because a row laid out from the right lays | |
| 355 | + ;; its first child furthest right: on screen this reads ↩ then ☺. | |
| 356 | + (if (:id m) | |
| 357 | + [react-button @s/current m] | |
| 358 | + [:spacer {:key :react :size 0}]) | |
| 345 | 359 | (if (:id m) |
| 346 | 360 | [:button {:key :reply :label "↩" :on-click #(s/reply-to! m)}] |
| 347 | 361 | [:spacer {:key :reply :size 0}]) |
| @@ -254,13 +254,23 @@ | |||
| 254 | ;; The message it answers is older than this buffer goes. | 254 | ;; The message it answers is older than this buffer goes. |
| 255 | [:dim-label {:label "↩ replying to an earlier message"}])]) | 255 | [:dim-label {:label "↩ replying to an earlier message"}])]) |
| 256 | 256 | ||
| 257 | +(defn- react-button | ||
| 258 | + "The way to put an emoji on a message, beside the way to answer it. | ||
| 259 | + | ||
| 260 | + Both are things done *to* a message rather than parts of it, so they share | ||
| 261 | + the sender's line and the right edge. It opens the quick row for this message | ||
| 262 | + alone — the emoji are only worth their space while someone is choosing one." | ||
| 263 | + [m] | ||
| 264 | + (let [open? (= (:id m) @s/reacting)] | ||
| 265 | + [:button {:label (if open? "×" "☺") | ||
| 266 | + :on-click #(reset! s/reacting (when-not open? (:id m)))}])) | ||
| 267 | + | ||
| 257 | (defn- reaction-row | 268 | (defn- reaction-row |
| 258 | - "What people have put on a message, and the way to put something there too. | 269 | + "What people have put on a message, under it, and the emoji to choose from |
| 270 | + while the react button is open. | ||
| 259 | 271 | ||
| 260 | A pill carries its count and toggles: clicking one you are already on takes | 272 | A pill carries its count and toggles: clicking one you are already on takes |
| 261 | - yours off, which is the same gesture that put it there. The `+` opens the | 273 | + yours off, which is the same gesture that put it there." |
| 262 | - quick row for this message alone — the emoji are only worth their space while | ||
| 263 | - someone is choosing one." | ||
| 264 | [channel m] | 274 | [channel m] |
| 265 | (let [reactions (:reactions m) | 275 | (let [reactions (:reactions m) |
| 266 | open? (= (:id m) @s/reacting)] | 276 | open? (= (:id m) @s/reacting)] |
| @@ -271,10 +281,7 @@ | |||
| 271 | [:button {:key emoji | 281 | [:button {:key emoji |
| 272 | :label (str emoji " " (count nicks)) | 282 | :label (str emoji " " (count nicks)) |
| 273 | :kind (if (s/my-reaction? m emoji) :primary :normal) | 283 | :kind (if (s/my-reaction? m emoji) :primary :normal) |
| 274 | - :on-click #(s/toggle-reaction! channel m emoji)}])) | 284 | + :on-click #(s/toggle-reaction! channel m emoji)}]))] |
| 275 | - [:button {:key :add | ||
| 276 | - :label (if open? "×" "+") | ||
| 277 | - :on-click #(reset! s/reacting (when-not open? (:id m)))}]] | ||
| 278 | [:hbox {:key :picker :spacing 4} | 285 | [:hbox {:key :picker :spacing 4} |
| 279 | (when open? | 286 | (when open? |
| 280 | (for [emoji s/quick-reactions] | 287 | (for [emoji s/quick-reactions] |
| @@ -339,9 +346,16 @@ | |||
| 339 | ;; takes the width that is left. The text keeps a column of its own: | 346 | ;; takes the width that is left. The text keeps a column of its own: |
| 340 | ;; a wrapping label directly in a row wraps against the row. | 347 | ;; a wrapping label directly in a row wraps against the row. |
| 341 | [:hbox {:key :line :align :end :spacing 6} | 348 | [:hbox {:key :line :align :end :spacing 6} |
| 342 | - ;; The button sits in the row itself rather than in a box of its own: | 349 | + ;; Answering and reacting sit together because they are the same kind |
| 343 | - ;; a box with no width takes the rest of the row and puts the text on a | 350 | + ;; of thing: what you do to a message rather than what it says. Both |
| 344 | - ;; line below it, and one with a width takes the column's whole height. | 351 | + ;; are in the row itself rather than in a box of their own — a box with |
| 352 | + ;; no width takes the rest of the row and puts the text on a line below | ||
| 353 | + ;; it, and one with a width takes the column's whole height. Reacting | ||
| 354 | + ;; comes first in the source because a row laid out from the right lays | ||
| 355 | + ;; its first child furthest right: on screen this reads ↩ then ☺. | ||
| 356 | + (if (:id m) | ||
| 357 | + [react-button @s/current m] | ||
| 358 | + [:spacer {:key :react :size 0}]) | ||
| 345 | (if (:id m) | 359 | (if (:id m) |
| 346 | [:button {:key :reply :label "↩" :on-click #(s/reply-to! m)}] | 360 | [:button {:key :reply :label "↩" :on-click #(s/reply-to! m)}] |
| 347 | [:spacer {:key :reply :size 0}]) | 361 | [:spacer {:key :reply :size 0}]) |