Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advent: display leaderboards as a colour image #212

Merged
merged 12 commits into from
Dec 2, 2024
Merged

Conversation

katrinafyi
Copy link
Member

uses pillow to render leaderboards into an image with a style very close to the website. inline display in the discord app is a bit smaller than i would've liked but alas. it should be much better on mobile at least.

text format is kept alongside the image since it's probably nice to have. maybe this should be behind an argument, but there are already so many.

also added url to website into the reply message

implementation has some weaknesses:

  • unicode multi-character sequences and emoji aren't rendered
  • relies very much on a monospace font for alignment
  • it is also a touch slow, maybe
  • the resolution on mobile is sometimes bad, depending on how discord scales the thumbnail

let me know if this is something you want.

OR, just inline the leaderboard into the message. it's only done as an attachment because slack let you preview text files on desktop and mobile.

image

image

uses pillow to render leaderboards into an image with a style
very close to the website. inline display in the discord app
is a bit smaller than i would've liked but alas.

text format is kept alongside the image since it's probably nice
to have. maybe this should be behind an argument, but there are
already so many.

implementation has some weaknesses:
- unicode multi-character sequences and emoji aren't rendered
- relies very much on a monospace font for alignment

let me know if this is something you want.
@andrewj-brown
Copy link
Member

I hate to well-actually, because this is uber cool, but it would probably be a better UX experience to have the boards be an embed with fancy discord interactions (e.g. buttons to scroll down or scroll up)?

I'll let others chime in on what they want AoC to "be" into the future though, because I don't see anyone jumping to write alternatives either - it would be silly to veto a good change just to make way for a "better" version that might not ever get written.

@katrinafyi
Copy link
Member Author

A Discord embed is probably a good way to modernise it. I don't think full pagination is good (way too many clicks), but maybe something like showing the first 20 rows in an image, then a button to expand to the full image. From testing, this is comfortable to read on Discord and mobile.

I do like the images (I just think they're neat) so I'd like to make them work, but also open to feedback

@katrinafyi
Copy link
Member Author

yippee

image

@katrinafyi katrinafyi closed this Nov 30, 2024
@katrinafyi katrinafyi reopened this Nov 30, 2024
TheOnlyMrCat
TheOnlyMrCat previously approved these changes Nov 30, 2024
Copy link
Member

@TheOnlyMrCat TheOnlyMrCat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it! It looks and feels a lot better than the old text format, especially on mobile.

My comments here are not blocking; just minor interaction points.

uqcsbot/advent.py Outdated Show resolved Hide resolved
uqcsbot/utils/advent_utils.py Show resolved Hide resolved
- support show all <-> show less
- add comment about font choice

other things:
- remove all buttons on timeout
- send text file as a separate message, keeping image in original
  reponse
- tweak some comments and rename print_leaderboard
@katrinafyi
Copy link
Member Author

changes in 344c0f6. re fonts, i wanted to have the most supported glyphs. i think this is import important than matching the website exactly. some comparisons: noto ibm sourcecodepro.

noto mono is the most extensive, but it does break the consistent monospace width sometimes. luckliy for us, this is not a problem since the only non-ascii characters are at the far right of each line (discord display names, example), so everything stays aligned.

still not ephemeral, because it's probably useful to see if people
are having problems with the command.
previously, total star2 time was actually the total time,
and total time was double counting.
@katrinafyi
Copy link
Member Author

after 1fd826d:

                                  Total Star Total Star            Local 
      Star 1   Star 2  Both Stars   1 Time     2 Time   Total Time Order 
  1)  0:01:10  0:01:00    0:02:10    0:01:10    0:01:00    0:02:10   316 katrinafyi
  2)  0:01:25  0:01:52    0:03:17    0:01:25    0:01:52    0:03:17   314 Cameron Aavik
  3)  0:02:19  0:00:58    0:03:17    0:02:19    0:00:58    0:03:17   312 bradleysigma
  4)  0:03:05  0:01:33    0:04:38    0:03:05    0:01:33    0:04:38   310 b-paul

this can be separated from the bigger pr if you want

@TheOnlyMrCat
Copy link
Member

re fonts, i wanted to have the most supported glyphs. i think this is import important than matching the website exactly.

Ah, yeah. I agree, that is more important. Shame pillow doesn't support fallback fonts

TheOnlyMrCat
TheOnlyMrCat previously approved these changes Dec 1, 2024
Copy link
Member

@TheOnlyMrCat TheOnlyMrCat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The time changes probably should be in a separate PR, but they do work so it's all good. I'll merge sometime tomorrow if nobody has further comments.

pytz stays around because of dependencies.
tzdata was also already transitively-required.
Copy link
Member

@TheOnlyMrCat TheOnlyMrCat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@TheOnlyMrCat TheOnlyMrCat merged commit da303f8 into main Dec 2, 2024
3 checks passed
@TheOnlyMrCat TheOnlyMrCat deleted the aoc-image branch December 2, 2024 18:11
@TheOnlyMrCat TheOnlyMrCat restored the aoc-image branch December 2, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants