Skip to content

Commit

Permalink
Added depend func to datavals
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Jul 13, 2024
1 parent c1ee0f9 commit 9d95499
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 4 deletions.
4 changes: 4 additions & 0 deletions packages/api-connector/src/Schema/DataVal.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Func } from "./Func";

interface BaseDataVal {
Rate?: number;
Turn?: number;
Expand Down Expand Up @@ -44,6 +46,7 @@ interface BaseDataVal {
OnFieldCount?: number;
TargetRarityList?: number[];
DependFuncId?: number;
DependFunc?: Func;
InvalidHide?: number;
OutEnemyNpcId?: number;
InEnemyNpcId?: number;
Expand Down Expand Up @@ -227,6 +230,7 @@ export enum DataValField {
ON_FIELD_COUNT = "OnFieldCount",
TARGET_RARITY_LIST = "TargetRarityList",
DEPEND_FUNC_ID = "DependFuncId",
DEPEND_FUNC = "DependFunc",
INVALID_HIDE = "InvalidHide",
OUT_ENEMY_NPC_ID = "OutEnemyNpcId",
IN_ENEMY_NPC_ID = "InEnemyNpcId",
Expand Down
24 changes: 22 additions & 2 deletions packages/db/src/Page/Func/DataValMainData.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import React from "react";
import { Link } from "react-router-dom";

import { DataVal } from "@atlasacademy/api-connector";
import { DataVal, Region } from "@atlasacademy/api-connector";

import DataTable from "../../Component/DataTable";
import RawDataViewer from "../../Component/RawDataViewer";

interface IProps {
region: Region;
dataVal: DataVal.DataVal;
}

Expand All @@ -16,7 +18,25 @@ class DataValMainData extends React.Component<IProps> {
data={[
{ label: "Raw", value: <RawDataViewer data={this.props.dataVal} /> },
...Object.entries(this.props.dataVal).map(([label, value]) => {
return { label, value };
switch (label) {
case "DependFuncId":
return {
label,
value: <Link to={`/${this.props.region}/func/${value}`}>{value}</Link>,
};
case "DependFunc":
case "DependFuncVals":
return {
label,
value: (
<div className="text-prewrap text-left">
<code>{JSON.stringify(value, null, 2)}</code>
</div>
),
};
default:
return { label, value };
}
}),
]}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class NoblePhantasmVersion extends React.Component<IProps> {
</Col>
<Col xs={12} md={6}>
<h5>{t("Values")}</h5>
<DataValMainData dataVal={dataVal ?? {}} />
<DataValMainData region={this.props.region} dataVal={dataVal ?? {}} />
</Col>
</Row>

Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/Page/Skill/SkillVersion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class SkillVersion extends React.Component<IProps> {
</Col>
<Col xs={12} md={6}>
<h5>Values</h5>
<DataValMainData dataVal={dataVal ?? {}} />
<DataValMainData region={this.props.region} dataVal={dataVal ?? {}} />
</Col>
</Row>

Expand Down

0 comments on commit 9d95499

Please sign in to comment.