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

Add in a link to the group page from a group ladder #1746

Merged
merged 3 commits into from Mar 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/views/Ladder/Ladder.tsx
Expand Up @@ -23,6 +23,7 @@ import * as data from "data";
import { List, AutoSizer } from "react-virtualized";
import { Player } from "Player";
import { UIPush } from "UIPush";
import { shouldOpenNewTab } from "misc";
import { PlayerAutocomplete } from "PlayerAutocomplete";
import { close_all_popovers, popover } from "popover";
import { browserHistory } from "ogsHistory";
Expand Down Expand Up @@ -132,8 +133,20 @@ export class Ladder extends React.PureComponent<LadderProperties, LadderState> {
}
};

goToGroup = (ev) => {
close_all_popovers();

const url: string = "/group/" + this.state.ladder?.group.id;
if (shouldOpenNewTab(ev)) {
window.open(url, "_blank");
} else {
browserHistory.push(url);
}
};

render() {
const user = data.get("user");
const group_text = pgettext("Go to the main page for this group.", "Group Page");

return (
<div className="Ladder-container">
Expand All @@ -145,6 +158,15 @@ export class Ladder extends React.PureComponent<LadderProperties, LadderState> {
/>

<div className="Ladder-header">
{this.state.ladder && this.state.ladder?.group !== null && (
<button
className="xs noshadow"
onAuxClick={this.goToGroup}
onClick={this.goToGroup}
>
<i className="fa fa-users" /> {group_text}
</button>
)}
<h2>{this.state.ladder && this.state.ladder.name}</h2>

<PlayerAutocomplete
Expand Down