diff --git a/src/handbook/src/backend/data.ts b/src/handbook/src/backend/data.ts index bf7c85227..678646440 100644 --- a/src/handbook/src/backend/data.ts +++ b/src/handbook/src/backend/data.ts @@ -87,8 +87,7 @@ export function getEntities(): Entity[] { internal: values[2] }; }) - .filter((entity) => - !entity.name.includes("Mechanicus")); + .filter((entity) => !entity.name.includes("Mechanicus")); } /** diff --git a/src/handbook/src/backend/events.ts b/src/handbook/src/backend/events.ts index 43135fd31..7c38f7eac 100644 --- a/src/handbook/src/backend/events.ts +++ b/src/handbook/src/backend/events.ts @@ -58,8 +58,7 @@ export function removeNavListener(listener: (page: Page) => void) { */ export function navigate(page: Page, update: boolean = true): Page | null { // Check the page. - if (page == undefined) - page = "Home"; + if (page == undefined) page = "Home"; // Navigate to the new page. const lastPage = currentPage; diff --git a/src/handbook/src/backend/server.ts b/src/handbook/src/backend/server.ts index 208525d86..6adecf87c 100644 --- a/src/handbook/src/backend/server.ts +++ b/src/handbook/src/backend/server.ts @@ -103,11 +103,7 @@ export async function teleportTo(scene: number): Promise { * @param amount The amount of the entity to spawn. * @param level The level of the entity to spawn. */ -export async function spawnEntity( - entity: number, - amount = 1, - level = 1 -): Promise { +export async function spawnEntity(entity: number, amount = 1, level = 1): Promise { // Validate the numbers. if (isNaN(entity) || isNaN(amount) || isNaN(level) || amount < 1 || level < 1 || level > 200) return { status: -1, message: "Invalid arguments." }; diff --git a/src/handbook/src/ui/App.tsx b/src/handbook/src/ui/App.tsx index e6e04d4df..eae4e7194 100644 --- a/src/handbook/src/ui/App.tsx +++ b/src/handbook/src/ui/App.tsx @@ -44,11 +44,7 @@ class App extends React.Component<{}, IState> { return (
- { - this.state.plain ? - : - <Content initial={this.state.initial} /> - } + {this.state.plain ? <PlainText /> : <Content initial={this.state.initial} />} </div> ); } diff --git a/src/handbook/src/ui/views/PlainText.tsx b/src/handbook/src/ui/views/PlainText.tsx index 21da22e8b..b5a1d3a9e 100644 --- a/src/handbook/src/ui/views/PlainText.tsx +++ b/src/handbook/src/ui/views/PlainText.tsx @@ -12,11 +12,9 @@ class PlainText extends React.PureComponent { private getCommands(): React.ReactNode { return ( <> - { - listCommands() - .map((command) => - <p>{`${command.name[0]} : ${command.description}`}</p>) - } + {listCommands().map((command) => ( + <p>{`${command.name[0]} : ${command.description}`}</p> + ))} </> ); } @@ -28,12 +26,11 @@ class PlainText extends React.PureComponent { private getAvatars(): React.ReactNode { return ( <> - { - listAvatars() - .sort((a, b) => a.id - b.id) - .map((avatar) => - <p>{`${avatar.id} : ${avatar.name}`}</p>) - } + {listAvatars() + .sort((a, b) => a.id - b.id) + .map((avatar) => ( + <p>{`${avatar.id} : ${avatar.name}`}</p> + ))} </> ); } @@ -45,12 +42,11 @@ class PlainText extends React.PureComponent { private getItems(): React.ReactNode { return ( <> - { - getItems() - .sort((a, b) => a.id - b.id) - .map((item) => - <p>{`${item.id} : ${item.name}`}</p>) - } + {getItems() + .sort((a, b) => a.id - b.id) + .map((item) => ( + <p>{`${item.id} : ${item.name}`}</p> + ))} </> ); } @@ -62,12 +58,11 @@ class PlainText extends React.PureComponent { private getMonsters(): React.ReactNode { return ( <> - { - getEntities() - .sort((a, b) => a.id - b.id) - .map((entity) => - <p>{`${entity.id} : ${entity.name}`}</p>) - } + {getEntities() + .sort((a, b) => a.id - b.id) + .map((entity) => ( + <p>{`${entity.id} : ${entity.name}`}</p> + ))} </> ); } @@ -79,12 +74,11 @@ class PlainText extends React.PureComponent { private getScenes(): React.ReactNode { return ( <> - { - getScenes() - .sort((a, b) => a.id - b.id) - .map((scene) => - <p>{`${scene.id} : ${scene.identifier} [${scene.type}]`}</p>) - } + {getScenes() + .sort((a, b) => a.id - b.id) + .map((scene) => ( + <p>{`${scene.id} : ${scene.identifier} [${scene.type}]`}</p> + ))} </> ); } @@ -93,8 +87,10 @@ class PlainText extends React.PureComponent { return ( <div className={"PlainText"}> <p> - // Grasscutter 3.6.0 GM Handbook<br /> - // Generated by the HTML GM Handbook.<br /> + // Grasscutter 3.6.0 GM Handbook + <br /> + // Generated by the HTML GM Handbook. + <br /> <br /> <br /> // Commands diff --git a/src/handbook/src/ui/widgets/EntityCard.tsx b/src/handbook/src/ui/widgets/EntityCard.tsx index eedf7320d..820e7cdfc 100644 --- a/src/handbook/src/ui/widgets/EntityCard.tsx +++ b/src/handbook/src/ui/widgets/EntityCard.tsx @@ -62,11 +62,9 @@ class EntityCard extends React.Component<IProps, IState> { if (isNaN(numeric) && value.length > 1) return; // Check if the value should be a level. - if (!this.state.showingCount && numeric > 200) - numeric = 200; + if (!this.state.showingCount && numeric > 200) numeric = 200; - const updated: any = this.state.showingCount ? - { count: numeric } : { level: numeric }; + const updated: any = this.state.showingCount ? { count: numeric } : { level: numeric }; this.setState(updated); } @@ -78,8 +76,7 @@ class EntityCard extends React.Component<IProps, IState> { * @private */ private addCount(positive: boolean, multiple: boolean) { - let value = this.state.showingCount ? - this.state.count : this.state.level; + let value = this.state.showingCount ? this.state.count : this.state.level; if (value === "") value = 1; if (typeof value == "string") value = parseInt(value); if (value < 1) value = 1; @@ -90,11 +87,9 @@ class EntityCard extends React.Component<IProps, IState> { value = Math.max(1, value + increment); // Check if the value should be a level. - if (!this.state.showingCount && value > 200) - value = 200; + if (!this.state.showingCount && value > 200) value = 200; - const updated: any = this.state.showingCount ? - { count: value } : { level: value }; + const updated: any = this.state.showingCount ? { count: value } : { level: value }; this.setState(updated); } @@ -160,8 +155,11 @@ class EntityCard extends React.Component<IProps, IState> { </div> <input type={"text"} - value={this.state.showingCount ? - `x${notNaN(this.state.count)}` : `Lv${notNaN(this.state.level)}`} + value={ + this.state.showingCount + ? `x${notNaN(this.state.count)}` + : `Lv${notNaN(this.state.level)}` + } className={"ObjectCard_Count"} onChange={this.updateCount.bind(this)} onBlur={() => {