Commit d21e74cc authored by Chunchi Che's avatar Chunchi Che

fix

parent 364ae7c0
Pipeline #20600 passed with stages
in 6 minutes and 46 seconds
......@@ -13,9 +13,6 @@ export async function initStrings() {
}
}
export async function fetchStrings(
region: string,
id: number
): Promise<string> {
export function fetchStrings(region: string, id: number): string {
return localStorage.getItem(`${region}_${id}`) || "";
}
......@@ -16,7 +16,7 @@ export const fetchCommonHintMeta = createAsyncThunk(
const player = param[0];
const hintData = param[1];
const hintMeta = await fetchStrings("!system", hintData);
const hintMeta = fetchStrings("!system", hintData);
const response: [number, string] = [player, hintMeta];
return response;
......
......@@ -31,7 +31,7 @@ export const fetchYesNoMeta = createAsyncThunk(
cardLocation: ygopro.CardLocation
) => string;
}) => {
const desc = await fetchStrings("!system", param.descCode);
const desc = fetchStrings("!system", param.descCode);
const meta = await fetchCard(param.code, true);
// TODO: 国际化文案
......
......@@ -17,6 +17,7 @@ import NeosConfig from "../../../neos.config.json";
import { ReactComponent as BattleSvg } from "../../../neos-assets/battle-axe.svg";
import { ReactComponent as DefenceSvg } from "../../../neos-assets/checked-shield.svg";
import { Meta2StringCodeMap } from "../../common";
import { fetchStrings } from "../../api/strings";
const { Meta } = Card;
const CARD_WIDTH = 240;
......@@ -51,10 +52,10 @@ const CardModal = () => {
>
<Meta title={name} />
<p>
<AtkLine level={level} atk={atk} def={def} />
<AttLine types={types} race={race} attribute={attribute} />
</p>
<p>
<AttLine types={types} race={race} attribute={attribute} />
<AtkLine level={level} atk={atk} def={def} />
</p>
<p>{desc}</p>
</Card>
......@@ -113,18 +114,23 @@ const AttLine = (props: {
types?: string;
race?: number;
attribute?: number;
}) => (
<Row gutter={8}>
{props.types ? <Col>{`[${props.types}]`}</Col> : <></>}
{props.race ? <Col>{Meta2StringCodeMap.get(props.race)}</Col> : <></>}
<Col>
<div>/</div>
</Col>
{props.attribute ? (
<Col>{Meta2StringCodeMap.get(props.attribute)}</Col>
) : (
<></>
)}
</Row>
);
}) => {
const race = props.race
? fetchStrings("!system", Meta2StringCodeMap.get(props.race) || 0)
: undefined;
const attribute = props.attribute
? fetchStrings("!system", Meta2StringCodeMap.get(props.attribute) || 0)
: undefined;
return (
<Row gutter={8}>
{props.types ? <Col>{`[${props.types}]`}</Col> : <></>}
{race ? <Col>{race}</Col> : <></>}
<Col>
<div>/</div>
</Col>
{attribute ? <Col>{attribute}</Col> : <></>}
</Row>
);
};
export default CardModal;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment