mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Preact: Improve "New team" button label
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
Some checks are pending
Node.js CI / build (22.x) (push) Waiting to run
This commit is contained in:
parent
f191602d41
commit
a24ddeb4fa
|
|
@ -10,9 +10,10 @@ import { PSPanelWrapper, PSRoomPanel } from "./panels";
|
|||
import { PSTeambuilder, TeamBox } from "./panel-teamdropdown";
|
||||
import { Dex, PSUtils, toID, type ID } from "./battle-dex";
|
||||
import { Teams } from "./battle-teams";
|
||||
import { BattleLog } from "./battle-log";
|
||||
|
||||
class TeambuilderRoom extends PSRoom {
|
||||
readonly DEFAULT_FORMAT = `gen${Dex.gen}` as ID;
|
||||
readonly DEFAULT_FORMAT = Dex.modid;
|
||||
|
||||
/**
|
||||
* - `""` - all
|
||||
|
|
@ -453,13 +454,16 @@ class TeambuilderPanel extends PSRoomPanel<TeambuilderRoom> {
|
|||
|
||||
let filterFolder: string | null = null;
|
||||
let filterFormat: string | null = null;
|
||||
let teamTerm = 'team';
|
||||
if (room.curFolder) {
|
||||
if (room.curFolder.endsWith('/')) {
|
||||
filterFolder = room.curFolder.slice(0, -1);
|
||||
teams = teams.filter(team => !team || team.folder === filterFolder);
|
||||
teamTerm = 'team in folder';
|
||||
} else {
|
||||
filterFormat = room.curFolder;
|
||||
teams = teams.filter(team => !team || team.format === filterFormat);
|
||||
if (filterFormat !== Dex.modid) teamTerm = BattleLog.formatName(filterFormat) + ' team';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -488,8 +492,12 @@ class TeambuilderPanel extends PSRoomPanel<TeambuilderRoom> {
|
|||
<h2>All Teams <small>({teams.length})</small></h2>
|
||||
)}
|
||||
<p>
|
||||
<button data-cmd="/newteam" class="button big"><i class="fa fa-plus-circle" aria-hidden></i> New Team</button> {}
|
||||
<button data-cmd="/newteam box" class="button"><i class="fa fa-archive" aria-hidden></i> New Box</button>
|
||||
<button data-cmd="/newteam" class="button big">
|
||||
<i class="fa fa-plus-circle" aria-hidden></i> New {teamTerm}
|
||||
</button> {}
|
||||
<button data-cmd="/newteam box" class="button">
|
||||
<i class="fa fa-archive" aria-hidden></i> New box
|
||||
</button>
|
||||
<input
|
||||
type="search" class="textbox" placeholder="Search teams"
|
||||
style="margin-left:5px;" onKeyUp={this.updateSearch}
|
||||
|
|
@ -529,8 +537,12 @@ class TeambuilderPanel extends PSRoomPanel<TeambuilderRoom> {
|
|||
))}
|
||||
</ul>
|
||||
<p>
|
||||
<button data-cmd="/newteam bottom" class="button"><i class="fa fa-plus-circle" aria-hidden></i> New Team</button> {}
|
||||
<button data-cmd="/newteam box bottom" class="button"><i class="fa fa-archive" aria-hidden></i> New Box</button>
|
||||
<button data-cmd="/newteam bottom" class="button">
|
||||
<i class="fa fa-plus-circle" aria-hidden></i> New {teamTerm}
|
||||
</button> {}
|
||||
<button data-cmd="/newteam box bottom" class="button">
|
||||
<i class="fa fa-archive" aria-hidden></i> New box
|
||||
</button>
|
||||
</p>
|
||||
</div>
|
||||
</PSPanelWrapper>;
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ export function TeamBox(props: {
|
|||
<em>(empty {team.isBox ? 'box' : 'team'})</em>
|
||||
);
|
||||
let format = team.format as string;
|
||||
if (format.startsWith(`gen${Dex.gen}`)) format = format.slice(4);
|
||||
if (format.startsWith(Dex.modid)) format = format.slice(4);
|
||||
format = (format ? `[${format}] ` : ``) + (team.folder ? `${team.folder}/` : ``);
|
||||
contents = [
|
||||
<strong>{team.isBox && <i class="fa fa-archive"></i>} {format && <span>{format}</span>}{team.name}</strong>,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user