Commit d028c48c authored by timel's avatar timel Committed by Chunchi Che

feat: onFieldClick

parent 983baaf5
......@@ -101,6 +101,8 @@ export const Card: FC<{ idx: number }> = React.memo(({ idx }) => {
onClick={() => {
if ([MZONE, SZONE, HAND].includes(state.zone)) {
onCardClick(state);
} else if ([EXTRA, GRAVE, REMOVED].includes(state.zone)) {
onFieldClick(state);
}
}}
>
......@@ -154,3 +156,19 @@ const onCardClick = (card: CardType) => {
messageStore.cardListModal.isOpen = true;
}
};
const onFieldClick = (card: CardType) => () => {
const displayStates = cardStore.at(card.zone, card.controller);
messageStore.cardListModal.list = displayStates.map((item) => ({
meta: {
id: item.code,
text: item.text,
data: item.data,
},
interactivies: item.idleInteractivities.map((interactivy) => ({
desc: interactTypeToString(interactivy.interactType),
response: interactivy.response,
})),
}));
messageStore.cardListModal.isOpen = true;
};
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