mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-04-22 07:17:38 -05:00
These are now called `mini-window`s by the client code, and they're now generic in the sense that any PS room can be a mini-window, not just PMs and News. This also adds BattleTextParser as a dependency of client-main, removing some duplicate code in exchange for a hopefully-negligible difference in load time.
47 lines
918 B
TypeScript
47 lines
918 B
TypeScript
/**
|
|
* Example Panel
|
|
*
|
|
* Just an example panel for creating new panels/popups
|
|
*
|
|
* @author Guangcong Luo <guangcongluo@gmail.com>
|
|
* @license AGPLv3
|
|
*/
|
|
|
|
// Example room with panel
|
|
|
|
class ExampleRoom extends PSRoom {
|
|
readonly classType: string = 'example';
|
|
constructor(options: RoomOptions) {
|
|
super(options);
|
|
}
|
|
}
|
|
|
|
class ExamplePanel extends PSRoomPanel<ExampleRoom> {
|
|
render() {
|
|
const room = this.props.room;
|
|
return <PSPanelWrapper room={room}>
|
|
<div class="mainmessage"><p>Loading...</p></div>
|
|
</PSPanelWrapper>;
|
|
}
|
|
}
|
|
|
|
PS.roomTypes['example'] = {
|
|
Model: ExampleRoom,
|
|
Component: ExamplePanel,
|
|
};
|
|
|
|
// Example panel with no room
|
|
|
|
class ExampleViewPanel extends PSRoomPanel {
|
|
render() {
|
|
const room = this.props.room;
|
|
return <PSPanelWrapper room={room}>
|
|
<div class="mainmessage"><p>Loading...</p></div>
|
|
</PSPanelWrapper>;
|
|
}
|
|
}
|
|
|
|
PS.roomTypes['exampleview'] = {
|
|
Component: ExampleViewPanel,
|
|
};
|