pokemon-showdown-client/src/panel-example.tsx
Guangcong Luo 5d6304eeb6 Support PM windows
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.
2019-10-15 19:14:32 +10:30

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,
};