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() { ...@@ -13,9 +13,6 @@ export async function initStrings() {
} }
} }
export async function fetchStrings( export function fetchStrings(region: string, id: number): string {
region: string,
id: number
): Promise<string> {
return localStorage.getItem(`${region}_${id}`) || ""; return localStorage.getItem(`${region}_${id}`) || "";
} }
...@@ -16,7 +16,7 @@ export const fetchCommonHintMeta = createAsyncThunk( ...@@ -16,7 +16,7 @@ export const fetchCommonHintMeta = createAsyncThunk(
const player = param[0]; const player = param[0];
const hintData = param[1]; const hintData = param[1];
const hintMeta = await fetchStrings("!system", hintData); const hintMeta = fetchStrings("!system", hintData);
const response: [number, string] = [player, hintMeta]; const response: [number, string] = [player, hintMeta];
return response; return response;
......
...@@ -31,7 +31,7 @@ export const fetchYesNoMeta = createAsyncThunk( ...@@ -31,7 +31,7 @@ export const fetchYesNoMeta = createAsyncThunk(
cardLocation: ygopro.CardLocation cardLocation: ygopro.CardLocation
) => string; ) => string;
}) => { }) => {
const desc = await fetchStrings("!system", param.descCode); const desc = fetchStrings("!system", param.descCode);
const meta = await fetchCard(param.code, true); const meta = await fetchCard(param.code, true);
// TODO: 国际化文案 // TODO: 国际化文案
......
...@@ -17,6 +17,7 @@ import NeosConfig from "../../../neos.config.json"; ...@@ -17,6 +17,7 @@ import NeosConfig from "../../../neos.config.json";
import { ReactComponent as BattleSvg } from "../../../neos-assets/battle-axe.svg"; import { ReactComponent as BattleSvg } from "../../../neos-assets/battle-axe.svg";
import { ReactComponent as DefenceSvg } from "../../../neos-assets/checked-shield.svg"; import { ReactComponent as DefenceSvg } from "../../../neos-assets/checked-shield.svg";
import { Meta2StringCodeMap } from "../../common"; import { Meta2StringCodeMap } from "../../common";
import { fetchStrings } from "../../api/strings";
const { Meta } = Card; const { Meta } = Card;
const CARD_WIDTH = 240; const CARD_WIDTH = 240;
...@@ -51,10 +52,10 @@ const CardModal = () => { ...@@ -51,10 +52,10 @@ const CardModal = () => {
> >
<Meta title={name} /> <Meta title={name} />
<p> <p>
<AtkLine level={level} atk={atk} def={def} /> <AttLine types={types} race={race} attribute={attribute} />
</p> </p>
<p> <p>
<AttLine types={types} race={race} attribute={attribute} /> <AtkLine level={level} atk={atk} def={def} />
</p> </p>
<p>{desc}</p> <p>{desc}</p>
</Card> </Card>
...@@ -113,18 +114,23 @@ const AttLine = (props: { ...@@ -113,18 +114,23 @@ const AttLine = (props: {
types?: string; types?: string;
race?: number; race?: number;
attribute?: number; attribute?: number;
}) => ( }) => {
<Row gutter={8}> const race = props.race
{props.types ? <Col>{`[${props.types}]`}</Col> : <></>} ? fetchStrings("!system", Meta2StringCodeMap.get(props.race) || 0)
{props.race ? <Col>{Meta2StringCodeMap.get(props.race)}</Col> : <></>} : undefined;
<Col> const attribute = props.attribute
<div>/</div> ? fetchStrings("!system", Meta2StringCodeMap.get(props.attribute) || 0)
</Col> : undefined;
{props.attribute ? ( return (
<Col>{Meta2StringCodeMap.get(props.attribute)}</Col> <Row gutter={8}>
) : ( {props.types ? <Col>{`[${props.types}]`}</Col> : <></>}
<></> {race ? <Col>{race}</Col> : <></>}
)} <Col>
</Row> <div>/</div>
); </Col>
{attribute ? <Col>{attribute}</Col> : <></>}
</Row>
);
};
export default CardModal; 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