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

Shorten names for tournament/ladder games in game lists #2425

Merged
merged 4 commits into from
Nov 27, 2023

Conversation

dexonsmith
Copy link
Contributor

Show more of the relevant part of the game name in game lists before the text overflows, by replacing:

  • the "Tournament Game:" prefix with the trophy icon and
  • the "Ladder Challenge:" prefix with the ladder icon.

Without this change, the now-shortened prefix was the only visible text in such games.

This fixes both GobanLineSummary and GameHistoryTable.

Fixes #2424

Show more of the relevant part of the game name in game lists before the text
overflows, by replacing:

- the "Tournament Game:" prefix with the trophy icon and
- the "Ladder Challenge:" prefix with the ladder icon.

Without this change, the now-shortened prefix was the only visible text in such
games.
Copy link

github-actions bot commented Nov 17, 2023

Uffizzi Preview deployment-41012 was deleted.

@dexonsmith
Copy link
Contributor Author

BTW, I'm new to React and TypeScript... the initial patch shares the core logic for this change between the two places, but duplicates the rendering code. Not sure if this is okay, or too spaghetti-like.

I had a look at sharing the rendering code but what I came up with (changing the new GameNameForList type to a class and adding a render() function) seemed too heavyweight for such a small use case. Let me know if you want me to look more in that direction.

CI linting rejected the delayed initialization of `GameNameForList`'s
non-optional `text` field in 3dfe0b5.
Refactor to avoid that, and also be more clear about the `null` case.
@dexonsmith
Copy link
Contributor Author

Just pushed d4f047b to respond to CI failure (I hadn't seen failures locally when testing with beta.online-go.com... looks like the CI checks more thoroughly!).

@benjaminpjones
Copy link
Contributor

benjaminpjones commented Nov 18, 2023

I had a look at sharing the rendering code but what I came up with (changing the new GameNameForList type to a class and adding a render() function) seemed too heavyweight for such a small use case.

React has Functional Components that are a lot lighter weight than class components. In modern React these are preferred anyway (the React docs only cover class components as a "Legacy API").

This PR looks good to me as-is, but I've opened PR dexonsmith#1 as an example of how you can dedupe the render code too.

@dexonsmith
Copy link
Contributor Author

This PR looks good to me as-is, but I've opened PR dexonsmith#1 as an example of how you can dedupe the render code too.

Awesome; your version is what I might have hoped for, so I merged it in.

@dexonsmith
Copy link
Contributor Author

Some screenshots.

Ladders before / after / after with title:
LadderBefore
LadderAfter
LadderTitle

Tournaments before / after / after with title:
TournamentBefore
TournamentAfter
TournamentTitle

@dexonsmith
Copy link
Contributor Author

This PR looks good to me as-is, but I've opened PR dexonsmith#1 as an example of how you can dedupe the render code too.

(BTW, if you preferred my patch before your change, I can force push back to that version. But it seems useful to me for the archived games and current games to share the rendering code, in case there are other tweaks to make, and this seems pretty clean.)

@BHydden
Copy link
Collaborator

BHydden commented Nov 19, 2023

Long overdue. Thank you ❤️

@BHydden
Copy link
Collaborator

BHydden commented Nov 19, 2023

I don't know if it's in scope, but could the ladder games say which ladder they belong to? Many ladder players are in multiple ladders and it's hard to tell them apart.

@dexonsmith
Copy link
Contributor Author

I don't know if it's in scope, but could the ladder games say which ladder they belong to? Many ladder players are in multiple ladders and it's hard to tell them apart.

I think better to do separately (IMO, out of scope). It might also be better server-side... depending on where the logic for creating/naming ladder games (I haven't looked yet).

IMO, it'd be better to actually change the names of the games to include the ladder name, rather than just prettifying it in game lists (which is what this patch does). I.e., the game-creation logic could be changed such that the name is something like:

Ladder Challenge: Name of Ladder: challenger(#3) vs challenged(#2)

And then this patch would (continue to) prettify the display of the name in game lists to use the ladder symbol instead of the words "Ladder Challenge:".

Unlike this patch, it wouldn't retroactively change names of old ladder games, but new ones would include the ladder name.

@dexonsmith
Copy link
Contributor Author

I think better to do separately (IMO, out of scope). It might also be better server-side... depending on where the logic for creating/naming ladder games (I haven't looked yet).

Yeah, confirmed the names are generated server-side. This is what online-go.com sends to the server:

post(
    `ladders/${this.props.ladder.props.match.params.ladder_id}/players/challenge`,
    {
        player_id: ladder_player.player.id,
    },
)

I'd be happy to write a patch for that, but I don't think I have access to the server code right now.

@anoek
Copy link
Member

anoek commented Nov 27, 2023

Good improvement, thanks!

@anoek anoek merged commit 242a71e into online-go:devel Nov 27, 2023
4 checks passed
@dexonsmith dexonsmith deleted the shorten-game-name-with-icons branch November 28, 2023 04:02
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.

Relevant parts of game names not visible for tournaments and ladders in game lists
4 participants