Teams: Add link to teams upload page

This commit is contained in:
Mia 2025-04-16 13:14:47 -05:00
parent e032688406
commit d8371e5eb0
3 changed files with 8 additions and 2 deletions

View File

@ -1,2 +1,3 @@
play.pokemonshowdown.com/src/battle-animations-moves.ts @KrisXV
play.pokemonshowdown.com/src/battle-animations.ts @KrisXV
play.pokemonshowdown.com/src/battle-animations.ts @KrisXV
teams.pokemonshowdown.com/**/* @mia-pi-git

View File

@ -48,17 +48,21 @@ export class TeamIndex extends preact.Component<PageProps> {
return <div class="section" style={{ wordWrap: 'break-word' }}>Loading...</div>;
}
const teamsByFormat: Record<string, ServerTeam[]> = {};
let i = 0;
for (const team of this.state.teams) {
// this way if a category is empty it doesn't just fill space, since it doesn't
// get added unless it exists
if (!this.searchMatch(team)) continue;
if (!teamsByFormat[team.format]) teamsByFormat[team.format] = [];
teamsByFormat[team.format].push(team);
i++;
}
return <div class="section" style={{ wordWrap: 'break-word' }}>
<h2>Hi, {this.state.loggedIn || "guest"}!</h2>
<label>Upload a new team: </label>
<a class="button" href={`//${Config.routes.client}/view-teams-upload`}>Go</a><br /><br />
<label>Search all teams:</label> <a class="button" href="/search/">Go</a><br /><br />
<label>Search your teams: </label>
<label>Search your teams ({i}): </label>
<input value={this.state.search || ""} onInput={e => this.onInput(e)} label="Search teams/formats"></input>
<hr />
{!this.state.teams.length ?

View File

@ -69,5 +69,6 @@ PSRouter.setRoutes({
'/': TeamIndex,
'/search/?:type/?:val': TeamSearcher,
'/search': TeamSearcher,
'/browse': TeamSearcher,
});
PSRouter.go();