@@ -3,53 +3,53 @@ import React, { useMemo, useState } from "react";
33import { useGameData } from "../providers/GameDataProvider" ;
44import { useDraggable , useDroppable } from "@dnd-kit/core" ;
55
6- const Joker = ( { sx, joker , id } ) => {
7- const { scoringTiles, shopOpen, activeJoker } = useGameData ( ) ;
6+ const Glyph = ( { sx, glyph , id } ) => {
7+ const { scoringTiles, shopOpen, activeGlyph } = useGameData ( ) ;
88 const scoringTile = useMemo ( ( ) => scoringTiles ?. find ( ( t ) => t . id === id ) ?? { } , [ id , scoringTiles ] ) ;
99 const { setNodeRef, attributes, listeners } = useDraggable ( {
1010 id,
1111 disabled : ! shopOpen ,
12- data : { type : 'joker ' }
12+ data : { type : 'glyph ' }
1313 } ) ;
14- const { attributes : dropLeftAttr , listeners : dropLeftList , setNodeRef : setNodeRefDropLeft } = useDroppable ( { id : `${ id } -left` , data : { accepts : 'joker ' } } ) ;
15- const { attributes : dropRightAttr , listeners : dropRightList , setNodeRef : setNodeRefDropRight } = useDroppable ( { id : `${ id } -right` , data : { accepts : 'joker ' } } ) ;
14+ const { attributes : dropLeftAttr , listeners : dropLeftList , setNodeRef : setNodeRefDropLeft } = useDroppable ( { id : `${ id } -left` , data : { accepts : 'glyph ' } } ) ;
15+ const { attributes : dropRightAttr , listeners : dropRightList , setNodeRef : setNodeRefDropRight } = useDroppable ( { id : `${ id } -right` , data : { accepts : 'glyph ' } } ) ;
1616 const [ ttipOpen , setTtipOpen ] = useState ( false ) ;
1717
1818 return (
1919 < Box
20- className = { [ shopOpen ? 'joker -hover' : '' , 'draggable' ] . join ( ' ' ) }
20+ className = { [ shopOpen ? 'glyph -hover' : '' , 'draggable' ] . join ( ' ' ) }
2121 id = { id }
2222 ref = { setNodeRef }
2323 { ...attributes }
2424 { ...listeners }
2525 key = { id }
26- sx = { { boxSizing : 'border-box' , m : '3px' , width : '44px' , height : '44px' , borderRadius : '4px' , fontSize : '24px' , display : 'flex' , justifyContent : 'center' , alignItems : 'center' , position : 'relative' , zIndex : 3 , ...joker . style } }
26+ sx = { { boxSizing : 'border-box' , m : '3px' , width : '44px' , height : '44px' , borderRadius : '4px' , fontSize : '24px' , display : 'flex' , justifyContent : 'center' , alignItems : 'center' , position : 'relative' , zIndex : 3 , ...glyph . style } }
2727 >
2828 < ClickAwayListener onClickAway = { ( ) => setTtipOpen ( false ) } >
2929 < Box sx = { { height : '100%' , width : '100%' , display : 'flex' , justifyContent : 'center' , alignItems : 'center' } } onClick = { ( ) => setTtipOpen ( ! ttipOpen ) } >
30- < Box sx = { { position : 'absolute' , top : 0 , right : 0 , fontSize : '10px' , color : 'white' , backgroundColor : [ '' , '#7abf1f' , '#34249c' , '#b0102b' ] [ joker . rarity ] , px : '3px' , borderRadius : '2px 4px 2px 2px' } } >
31- { [ 'C' , 'U' , 'R' , 'S' ] [ joker . rarity ] }
30+ < Box sx = { { position : 'absolute' , top : 0 , right : 0 , fontSize : '10px' , color : 'white' , backgroundColor : [ '' , '#7abf1f' , '#34249c' , '#b0102b' ] [ glyph . rarity ] , px : '3px' , borderRadius : '2px 4px 2px 2px' } } >
31+ { [ 'C' , 'U' , 'R' , 'S' ] [ glyph . rarity ] }
3232 </ Box >
33- < Tooltip open = { ttipOpen } onClose = { ( ) => setTtipOpen ( false ) } disableFocusListener disableHoverListener disableTouchListener arrow placement = "bottom" title = { activeJoker ?. props ?. id !== id ? (
33+ < Tooltip open = { ttipOpen } onClose = { ( ) => setTtipOpen ( false ) } disableFocusListener disableHoverListener disableTouchListener arrow placement = "bottom" title = { activeGlyph ?. props ?. id !== id ? (
3434 < Box sx = { { fontSize : 12 , color : 'white' , borderRadius : '4px' , display : 'flex' , flexDirection : 'column' , alignItems : 'center' , zIndex : 2 } } >
35- < Typography variant = 'overline' sx = { { fontFamily : 'Orbitron' } } > { joker . name } </ Typography >
36- < Typography variant = 'body2' sx = { { textAlign : 'center' } } > { joker . description } </ Typography >
37- < Typography variant = 'overline' sx = { { fontFamily : 'Orbitron' , fontSize : 8 } } > { [ 'Common' , 'Uncommon' , 'Rare' , 'Shiny' ] [ joker . rarity ] } </ Typography >
35+ < Typography variant = 'overline' > { glyph . name } </ Typography >
36+ < Typography variant = 'body2' sx = { { textAlign : 'center' } } > { glyph . description } </ Typography >
37+ < Typography variant = 'overline' sx = { { fontSize : 8 } } > { [ 'Common' , 'Uncommon' , 'Rare' , 'Shiny' ] [ glyph . rarity ] } </ Typography >
3838 </ Box >
3939 ) : null } >
40- { joker . text }
40+ { glyph . text }
4141 < Box ref = { setNodeRefDropLeft } { ...dropLeftList } { ...dropRightAttr } sx = { { height : '100%' , width : '45%' , position : 'absolute' , left : 0 } } />
4242 < Box sx = { { height :'100%' , width : '45%' , position : 'absolute' , right : 0 } } ref = { setNodeRefDropRight } { ...dropRightList } { ...dropLeftAttr } />
4343 </ Tooltip >
4444 < Tooltip arrow open = { ! ! ( scoringTile . score || scoringTile . newMoney || scoringTile . text || scoringTile . newMoney === 0 ) } title = { (
4545 < Box sx = { { display : 'flex' , flexDirection : 'column' , alignItems : 'center' } } >
46- { ( scoringTile . score !== 0 || scoringTile . newMoney === 0 ) && ( < span style = { { fontFamily : 'Orbitron' , fontSize : 16 , color : scoringTile . score < 0 ? '#ff9ca7' : '#b3faaa' } } >
46+ { ( scoringTile . score !== 0 || scoringTile . newMoney === 0 ) && ( < span style = { { fontSize : 16 , color : scoringTile . score < 0 ? '#ff9ca7' : '#b3faaa' } } >
4747 { scoringTile . score >= 0 ? '+' : '' } { scoringTile . score ?? '' }
4848 </ span > ) }
49- { scoringTile . newMoney !== 0 && ( < span style = { { fontFamily : 'Orbitron' , fontSize : 16 , color : '#fffb80' } } >
49+ { scoringTile . newMoney !== 0 && ( < span style = { { ffontSize : 16 , color : '#fffb80' } } >
5050 { scoringTile . newMoney >= 0 ? '+' : '' } { scoringTile . newMoney ?? '' }
5151 </ span > ) }
52- { scoringTile . text && ( < span style = { { fontFamily : 'Orbitron' , fontSize : 16 , color : '#b3faaa' } } >
52+ { scoringTile . text && ( < span style = { { fontSize : 16 , color : '#b3faaa' } } >
5353 { scoringTile . text }
5454 </ span > ) }
5555 </ Box >
@@ -62,4 +62,4 @@ const Joker = ({ sx, joker, id }) => {
6262 ) ;
6363} ;
6464
65- export default Joker ;
65+ export default Glyph ;
0 commit comments