Merge remote-tracking branch 'origin/unstable' into unstable

# Conflicts:
#	src/handbook/src/backend/types.ts
#	src/handbook/src/ui/pages/ItemsPage.tsx
#	src/handbook/src/ui/widgets/MiniCard.tsx
This commit is contained in:
KingRainbow44 2023-04-10 01:06:06 -04:00
commit 65532ffd90
No known key found for this signature in database
GPG Key ID: FC2CB64B00D257BE
4 changed files with 77 additions and 62 deletions

View File

@ -14,14 +14,22 @@ import "@css/pages/ScenesPage.scss";
*/
function sceneTypeToString(type: SceneType): string {
switch (type) {
default: return "Unknown";
case SceneType.None: return "None";
case SceneType.World: return "World";
case SceneType.Activity: return "Activity";
case SceneType.Dungeon: return "Dungeon";
case SceneType.Room: return "Room";
case SceneType.HomeRoom: return "Home Room";
case SceneType.HomeWorld: return "Home World";
default:
return "Unknown";
case SceneType.None:
return "None";
case SceneType.World:
return "World";
case SceneType.Activity:
return "Activity";
case SceneType.Dungeon:
return "Dungeon";
case SceneType.Room:
return "Room";
case SceneType.HomeRoom:
return "Home Room";
case SceneType.HomeWorld:
return "Home World";
}
}
@ -45,11 +53,12 @@ class ScenesPage extends React.PureComponent {
key={command.identifier}
title={command.identifier}
alternate={`ID: ${command.id} | ${sceneTypeToString(command.type)}`}
button={(
<button className={"ScenesPage_Button"}
onClick={this.teleport.bind(this)}
>Teleport</button>
)} rightOffset={13}
button={
<button className={"ScenesPage_Button"} onClick={this.teleport.bind(this)}>
Teleport
</button>
}
rightOffset={13}
height={75}
/>
))}

View File

@ -40,12 +40,14 @@ class SideBar extends React.Component<{}, IState> {
The Ultimate Anime Game Handbook
</h1>
<div style={{
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
height: "100%"
}}>
<div
style={{
display: "flex",
flexDirection: "column",
justifyContent: "space-between",
height: "100%"
}}
>
<div className={"SideBar_Buttons"}>
<SideBarButton name={"Commands"} anchor={"Commands"} />
<SideBarButton name={"Characters"} anchor={"Avatars"} />

View File

@ -52,9 +52,7 @@ class Card extends React.PureComponent<IProps> {
</div>
{this.props.button ? (
<div className={"Card_Button"}
style={{ marginRight: this.props.rightOffset ?? 0 }}
>
<div className={"Card_Button"} style={{ marginRight: this.props.rightOffset ?? 0 }}>
{this.props.button}
</div>
) : undefined}

View File

@ -14,10 +14,9 @@ import "@css/widgets/ItemCard.scss";
function toDescription(description: string | undefined): JSX.Element[] {
if (!description) return [];
return description.split("\\n")
.map((line, index) => {
return <p key={index}>{line}</p>;
});
return description.split("\\n").map((line, index) => {
return <p key={index}>{line}</p>;
});
}
interface IProps {
@ -65,8 +64,7 @@ class ItemCard extends React.Component<IProps, IState> {
private addCount(positive: boolean, multiple: boolean) {
let { count } = this.state;
if (count === "") count = 1;
if (typeof count == "string")
count = parseInt(count);
if (typeof count == "string") count = parseInt(count);
if (count < 1) count = 1;
let increment = 1;
@ -105,49 +103,57 @@ class ItemCard extends React.Component<IProps, IState> {
<p>{data?.type ?? itemTypeToString(item.type)}</p>
</div>
{ this.state.icon && <img
className={"ItemCard_Icon"}
alt={item.name}
src={itemIcon(item)}
onError={() => this.setState({ icon: false })}
/> }
{this.state.icon && (
<img
className={"ItemCard_Icon"}
alt={item.name}
src={itemIcon(item)}
onError={() => this.setState({ icon: false })}
/>
)}
</div>
<div className={"ItemCard_Description"}>
{toDescription(data?.description)}
</div>
<div className={"ItemCard_Description"}>{toDescription(data?.description)}</div>
</div>
<div className={"ItemCard_Actions"}>
<div className={"ItemCard_Counter"}>
<div onClick={() => this.addCount(false, false)}
onContextMenu={(e) => {
e.preventDefault();
this.addCount(false, true);
}}
className={"ItemCard_Operation"}>-</div>
<input type={"text"}
value={this.state.count}
className={"ItemCard_Count"}
onChange={this.updateCount.bind(this)}
onBlur={() => {
if (this.state.count == "") {
this.setState({ count: 1 });
}
}}
<div
onClick={() => this.addCount(false, false)}
onContextMenu={(e) => {
e.preventDefault();
this.addCount(false, true);
}}
className={"ItemCard_Operation"}
>
-
</div>
<input
type={"text"}
value={this.state.count}
className={"ItemCard_Count"}
onChange={this.updateCount.bind(this)}
onBlur={() => {
if (this.state.count == "") {
this.setState({ count: 1 });
}
}}
/>
<div onClick={() => this.addCount(true, false)}
onContextMenu={(e) => {
e.preventDefault();
this.addCount(true, true);
}}
className={"ItemCard_Operation"}>+</div>
<div
onClick={() => this.addCount(true, false)}
onContextMenu={(e) => {
e.preventDefault();
this.addCount(true, true);
}}
className={"ItemCard_Operation"}
>
+
</div>
</div>
<button
className={"ItemCard_Submit"}
onClick={this.addToInventory.bind(this)}
>Add to Inventory</button>
<button className={"ItemCard_Submit"} onClick={this.addToInventory.bind(this)}>
Add to Inventory
</button>
</div>
</div>
) : undefined;