-
Notifications
You must be signed in to change notification settings - Fork 347
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
Annotate Players
in ViewReport
#2800
Annotate Players
in ViewReport
#2800
Conversation
…notate according to role in a report.
Uffizzi Preview |
…_players_in_view_report
@@ -283,6 +292,14 @@ export function Player(props: PlayerProperties): JSX.Element { | |||
main_attrs.className += " " + combined.ui_class; | |||
} | |||
|
|||
if (viewReportContext && viewReportContext.reported.id === player_id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels wrong, we shouldn't be spreading the context logic over to a generic component like Player
I don't think. How about instead we put that context stuff up in the report code and then pass "reported"
in for the ui_class
for Player
?
Here's my case for doing it this way :) "Player" is a component that knows how to render Players in various contexts. One of those is "in a report context". It makes a context provider available to components that feel they are "in a report context", and lets those components describe which two players have the context-specific roles. Once that's done neither component has to worry anymore about remembering to (or even being able to) think about what is the current' player's role. Instead every instance of Note how the (Actually, you can't see it in that screenshot, but even |
Does it? I always viewed it as a generic component that didn't care where it was rendered, it just rendered the bits of a player name that you told it to. That changes fundamentally with this. Now part of the rendering code for a view is pushed down into a generic component, feels like that is a pattern that could get out of hand very quickly. However, I could see how getting the data to all the right places might get painful. Let me ponder, will probably merge as is but want to digest if there's a cleaner way. |
I guess that is true. I tried to design this extension in a "elegant" way, by having the "context provider" owned by Player - it comes from Player and works in the way So
I'm not seeing this. A The only change here is the way in which it gets the information on how to treat the specific |
ehh, the I guess though it probably wouldn't have felt so wrong if it was spun as a more generic thing, as opposed to something that only works when in |
Drat, I should have called the context something less similar to a page name :) I totally agree that the #ViewReport is Player.styl is regrettable. Let me think about that. |
I think that there should be a contract about the styling. The component that does instantiates the context
should also keep the contract by putting a className that I'll see about making it feel more like a generic pattern and then we'll see how it strikes you... ... and in the mean time if you can think of a different way of ensuring that "all |
I think I've come to terms with Context's being the best way to achieve that, everything else is pretty ugly. But let's at least pretend it's generic, and who knows it might be. At least we'll know where to add similar context stuff if we have need. For instance, one could imagine a tournament creator/director getting set in the context of a game or tournament page so all chats from them have a little TD next to them or something like. It think for the style thing we can probably just remove the |
…or itself to be rendered in" "pattern".
It felt safer to have a deal with the context consumer to specifically contain effects of the annotation styling. |
Fixes Moderators losing track of who is who
Proposed Changes
Player
provide a context that it can be rendered in to enable it to annotate participants in a report.ViewReport
use that context.