Clickable move numbers in chat

Hi,
could you guys look into these move numbers, that are marked down in chat:

The variations (green arrow) can be clicked on and it will instantly take you to the position in the game tree.
But with the normal game moves (red arrow), that doesn’t seem to work. It would be very handy if that would work the same way.

Thanks.

Example: FMfirst vs. Holon

SnapDonnerstag, 18. April 2024_17h16m6s_002_Game Finished - Vivaldi

3 Likes

Weird. Works in a game (try the same kind of link in the original game!), but not in a review.

4 Likes

In the meantime, it seems like explicitly creating a link to a move via the “share” button DOES work, even in reviews. (I tried it out on your example review; hope you don’t mind.)

2 Likes

FYI, I put up a fix for review.

5 Likes

Somewhat related, appending the move number to the url of a review doesn’t work to navigate there like it does in a game. Having to type that isn’t as convenient, but being a real url the plus is it is shareable externally. That might not be too hard to add, IIRC I just never thought to when I added that feature. A larger undertaking that has also been requested elsewhere would be allowing the sharing of variations via a real url.

1 Like

@Holon, the fix should be live now.

Yeah, this has bothered me a few times as well. Thanks for the nudge. Up for review.

A larger undertaking that has also been requested elsewhere would be allowing the sharing of variations via a real url.

Would be great, but I’m not getting nerd-sniped into that today :slight_smile:

8 Likes

Thanks for the fix. It may sound like a minor issue, but I really like this click on move feature in reviews. So I appreciate it!

3 Likes

Should be live now.

I have an idea for “how” that seems not too hard.

  • The move variation links in the chat effectively store a base move (from) and a diff to apply (moves).
  • For links to a move, we use the URL .../<game-id>/<move-number>.
  • For a variation link, idea is the URL .../<game-id>/<move-number>/<diff>, where the <move-number> is the base move like in chat, and <diff> is some URL-friendly encoding of the diff stored in the chat (such as base64url, but maybe there’s some smarter thing).

However, unlike a move number, this isn’t friendly to type. We’d need some UI affordance so that users could copy a link to the current variation. Not sure where it should go.

Thoughts?

2 Likes

This made me smile

Four days later…

4 Likes

I had this idea before.

Maybe could go even simpler, and somewhat like how variations are sometimes referenced in books, and just use the indexes of the choices in the tree without the move numbers. So you have /<game-id>/<move-number>/3.1.1.2.3.1 which means at the first split in the tree take then 3rd branch, at next split (don’t need to say which move number that is, if there is no split in tree keep going) take 1st branch (ie keep on mainline), at next split take 1st, at next split take 2nd. That’s a pretty minimal encoding, and somewhat human-readable. BUT if someone later adds more variations, the meaning of that url can change! How important is that not happening?

Whatever way, you definitely want some UI-clicky not url-typey way to generate. How about on the “Link to Game” dialog from the sidebar if you are currently on a variation it gets a new entry “Current Variation” with the fancy url.

2 Likes

Could update the URL bar whenever the variation is clicked. Or take inspiration from GitHub and meatball menu → “Copy Link”

1 Like

BUT if someone later adds more variations, the meaning of that url can change! How important is that not happening?

Or if variations are deleted.

Also, even without timing problems, the sharing user might have a different set of variations than the receiving user for some other reason:

  • in a game, players may have saved some variations in their personal/private chat along the way
  • the sharing user may not have clicked “share” in the chat (and if it’s a review, may not be the review controller), which means it’s not something the receiving user can look up in the game record
  • the receiving user may have some variations in their current tree which they haven’t clicked “share” on

EDIT: A benefit I want to point out about using base+diff, (rather than variation numbers / tree navigation) is precisely that it’s already used in game chat. There’s a goban API for generating and applying the diff, because chat pseudo-links use/need it, so we can just reuse all that. It seems simplest/safest to expose a URL interface for the existing (working) system rather than inventing a new one.

Could update the URL bar whenever the variation is clicked.

A few possible concerns:

  • Would this add browser history items? I don’t think we’d want clicking the browser “Back” button to navigate through these. But maybe that’s avoidable.
  • Would that make it harder to share a normal link to a game? Would users accidentally be sharing variation URLs when they just want to share the game link?
  • Requires encoding the URL on every game tree action. I’m sure all our devices can keep up (I don’t think we’d get lag), but seems like unnecessary bloat, when it’s relatively rare that users will actually share the link.

Or take inspiration from GitHub and meatball menu → “Copy Link”

Do you mean the same thing as @Uberdude, or something else?

Yeah, that’s easy and doesn’t require new buttons or anything.

We can also make the game chat links have this URL if you copy-link/open-in-tab/etc. (without changing the current onClick behaviour).

With both:

  • existing “share” button is a way to share the variation in chat (as now), but as a new feature, you can copy-link to get the permalink;
  • existing “link” menu item gives you the list-of-permalinks modal without needing to share anything in chat, and as a new feature it would include the “current variation” permalink

Sounds good to me!

So…what happens currently if you share a variation then undo the move it was based on?

Do you mean the same thing as @Uberdude, or something else?

Ah I missed @Uberdude’s suggestion on where to put it. No, I meant in the chat directly, but now that I’m looking at it I think meatball menu would make chat too cluttered. Long-press/right click would be preferable IMO.

I like @Uberdude’s suggestion too. Reminds me of YouTube’s Share > “Start at ”


To add one more URL idea to the mix… If you end up going with a chat-based solution, one could use chat ID. While it has obvious downsides, it has benefits too:

Pros

  • Unique URL per shared variation
    • This means that “scroll to/highlight chat variation line” would be possible
  • Syncing issues somewhat resolved (chat variations are available to all players)
    • Malkovich and Private chats pose an issue
  • Upper bound on URL length
  • Variations can include wacky s**t like drawings
  • Don’t have to come up with a clever variation encoding (as fun as that sounds :grinning:)
  • Opens the door for link-to-chat feature

Cons

  • Not human readable/writable
  • Cannot be generated from the position - need to have access to the chat log
  • Malkovich and Private chat issues? And, rarely, deleted chats
  • Chat ID is relatively long - 36 characters

IIRC, this is buggy, and will try to build the variation from the new move. But haven’t tested this recently.

1 Like

Yeah I think it’s avoidable: javascript - how to change url without changing browser history - Stack Overflow

Maybe. I mean it would only happen if the user just clicked on a variation. And I don’t think it’s the worse thing in the world to accidentally share a variation in a game, when you only meant to share the game.

Depends how expensive the URL encoding is. Copying chat_id would be very inexpensive, and users aren’t clicking the variations that often.

Edit: also, to address “every game tree action”, it doesn’t have to be. My suggestion was to trigger off some interaction with the game chat variation.

Agree with not updating url on every change for the other reasons you give, but FYI History.replaceState() method - Web APIs | MDN

I didn’t know that, so sounds good, I’m all for not reinventing wheels. Human readability of the url would be nice, but I don’t think it’s a big deal to lose for reuse/reliable links.