Skip to content

Commit

Permalink
Merge pull request #1746 from shinuito/misc_updates
Browse files Browse the repository at this point in the history
Add in a link to the group page from a group ladder
  • Loading branch information
anoek committed Mar 18, 2022
2 parents 4220671 + 9da3a69 commit af28386
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/views/Ladder/Ladder.tsx
Original file line number Diff line number Diff line change
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

0 comments on commit af28386

Please sign in to comment.