Skip to content

Commit

Permalink
fix some flip rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
dsoskey committed May 30, 2024
1 parent 383668a commit 3977bdc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ui/card/cardCustomRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const FlipCardRender = ({ card }: CardCustomRenderProps) => {

const NormalCardRender = ({ card, flipped }: CardCustomRenderProps) => {
const flipDex = flipped ? 1 : 0;
const canFlip = DOUBLE_FACED_LAYOUTS.includes(card.layout)
const canFlip = card.card_faces?.length > 0
const activeFace = canFlip ? card.card_faces[flipDex] : card;
const { name, mana_cost,
type_line,
Expand Down
8 changes: 4 additions & 4 deletions src/ui/cardBrowser/cardViews/cardImage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React, { useContext, useState } from 'react'
import { DOUBLE_FACED_LAYOUTS, Card, ImageUris } from 'mtgql'
import "./cardImage.css"
import { Card, ImageUris } from 'mtgql'
import { FlagContext } from '../../flags'
import "./cardImage.css"

const getBackImageURI = (card: Card, version: keyof ImageUris) => {
return card.card_faces.length === 1
? ''
: card.card_faces[1]?.image_uris[version] ?? ''
: card.card_faces[1]?.image_uris?.[version] ?? ''
}

function getFrontImageURI(card: Card, version: keyof ImageUris): string | undefined {
Expand All @@ -23,7 +23,7 @@ export const CardImage = ({ card }: CardImageProps) => {
const { edhrecOverlay } = useContext(FlagContext).flags;
const [transformed, setTransformed] = useState(false);
const [flipped, setFlipped] = useState(false);
const canTransform = DOUBLE_FACED_LAYOUTS.includes(card.layout)
const canTransform = card.card_faces.length > 0
const onTransformCLick = e => {
e.stopPropagation()
setTransformed((prev) => !prev)
Expand Down

0 comments on commit 3977bdc

Please sign in to comment.