Commit b3ac1939 authored by chechunchi's avatar chechunchi

render selectes in SelectCardsModal

parent f26da02e
Pipeline #22462 passed with stages
in 13 minutes and 27 seconds
...@@ -2,7 +2,7 @@ import "./index.scss"; ...@@ -2,7 +2,7 @@ import "./index.scss";
import { CheckCard } from "@ant-design/pro-components"; import { CheckCard } from "@ant-design/pro-components";
import { Button, Segmented, Space, Tooltip } from "antd"; import { Button, Segmented, Space, Tooltip } from "antd";
import { useEffect, useState } from "react"; import { CSSProperties, useEffect, useState } from "react";
import { INTERNAL_Snapshot as Snapshot, useSnapshot } from "valtio"; import { INTERNAL_Snapshot as Snapshot, useSnapshot } from "valtio";
import type { CardMeta, ygopro } from "@/api"; import type { CardMeta, ygopro } from "@/api";
...@@ -14,6 +14,21 @@ import { groupBy } from "../../utils"; ...@@ -14,6 +14,21 @@ import { groupBy } from "../../utils";
import { showCardModal } from "../CardModal"; import { showCardModal } from "../CardModal";
import { NeosModal } from "../NeosModal"; import { NeosModal } from "../NeosModal";
const YgoCardStyle = {
width: "100%",
height: "100%",
position: "absolute",
left: 0,
top: 0,
};
const CheckCardStyle = {
width: 100,
aspectRatio: 5.9 / 8.6,
marginInlineEnd: 0,
marginBlockEnd: 0,
flexShrink: 0,
};
export interface SelectCardsModalProps { export interface SelectCardsModalProps {
isOpen: boolean; isOpen: boolean;
min: number; min: number;
...@@ -36,7 +51,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({ ...@@ -36,7 +51,7 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
min, min,
max, max,
single, single,
selecteds: _selecteds, selecteds,
selectables, selectables,
mustSelects, mustSelects,
cancelable, cancelable,
...@@ -164,22 +179,10 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({ ...@@ -164,22 +179,10 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
cover={ cover={
<YgoCard <YgoCard
code={card.meta.id} code={card.meta.id}
style={{ style={YgoCardStyle as CSSProperties}
width: "100%",
height: "100%",
position: "absolute",
left: 0,
top: 0,
}}
/> />
} }
style={{ style={CheckCardStyle}
width: 100,
aspectRatio: 5.9 / 8.6,
marginInlineEnd: 0,
marginBlockEnd: 0,
flexShrink: 0,
}}
value={card} value={card}
onClick={() => { onClick={() => {
showCardModal(card); showCardModal(card);
...@@ -192,6 +195,25 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({ ...@@ -192,6 +195,25 @@ export const SelectCardsModal: React.FC<SelectCardsModalProps> = ({
</div> </div>
) )
)} )}
<p>{selecteds.length > 0 ? fetchStrings("!system", 212) : ""}</p>
{selecteds.map((card, i) => (
<Tooltip title={card.effectDesc} placement="bottom" key={i}>
<div>
<CheckCard
cover={
<YgoCard
code={card.meta.id}
style={YgoCardStyle as CSSProperties}
/>
}
style={CheckCardStyle}
onClick={() => {
showCardModal(card);
}}
/>
</div>
</Tooltip>
))}
</Space> </Space>
</div> </div>
</NeosModal> </NeosModal>
......
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