Skip to content

Commit

Permalink
Merge branch 'prod' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
olegsvs committed Dec 15, 2024
2 parents a63651d + 12007df commit 124b91b
Show file tree
Hide file tree
Showing 6 changed files with 193 additions and 211 deletions.
1 change: 0 additions & 1 deletion src/pages/map/components/MapComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,6 @@ export default function MapComponent() {
top: '-130px',
width: '300px',
height: '500px',
zIndex: 20,
backgroundImage: `url(${TgaImage})`,
backgroundRepeat: 'no-repeat',
// backgroundPosition: 'center',
Expand Down
79 changes: 42 additions & 37 deletions src/pages/map/components/action/DiceModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function DiceModal({
const [diceColor, setDiceColor] = useState<string>(getRandomHexColor(player))

const [showGoogleIframe, setShowGoogleIframe] = useState(false)
const [showRandomOrgIframe, setShowRandomOrgIframe] = useState(false)
const [showRollIframe, setShowRollIframe] = useState(false)

const [customRoll, setCustomRoll] = useState<number | null>(null)

Expand Down Expand Up @@ -109,7 +109,7 @@ export default function DiceModal({
setDiceRoll(null)
setDiceStatus('idle')
setShowGoogleIframe(false)
setShowRandomOrgIframe(false)
setShowRollIframe(false)
setCustomRoll(null)
if (diceBox) {
diceBox.clear()
Expand Down Expand Up @@ -181,8 +181,8 @@ export default function DiceModal({
setDiceStatus('done')
}

const handleRandomOrgThrow = () => {
setShowRandomOrgIframe(true)
const handleRollADieThrow = () => {
setShowRollIframe(true)
setDiceStatus('done')
}

Expand Down Expand Up @@ -255,7 +255,7 @@ export default function DiceModal({
paddingBottom: '30px',
}}
>
{!showGoogleIframe && !showRandomOrgIframe && (
{!showGoogleIframe && !showRollIframe && (
<>
<Box
border={`2px solid ${Color.greyLight}`}
Expand Down Expand Up @@ -313,11 +313,11 @@ export default function DiceModal({
></iframe>
</Box>
)}
{showRandomOrgIframe && (
{showRollIframe && (
<Box>
<iframe
src={`https://www.random.org/dice/?num=${diceAmount}`}
style={{ width: '740px', height: '560px' }}
src={`https://rolladie.net/roll-${diceAmount}-dice`}
style={{ width: '640px', height: '480px' }}
></iframe>
</Box>
)}
Expand Down Expand Up @@ -345,34 +345,33 @@ export default function DiceModal({
</Box>
)}
<Box width="100%">
{diceStatus === 'done' &&
(showGoogleIframe || showRandomOrgIframe) && (
<TextField
fullWidth
placeholder="Суммарный результат броска"
sx={{ height: '44px', marginBottom: '20px' }}
value={customRoll ?? ''}
onChange={(e) => {
const value = parseInt(e.target.value)
if (value >= 1 && value <= 100) {
setCustomRoll(value)
} else {
setCustomRoll(null)
}
}}
InputProps={{
style: {
paddingTop: '10px',
paddingLeft: '15px',
paddingRight: '15px',
paddingBottom: '10px',
lineHeight: '1.2',
fontSize: '16px',
fontWeight: 500,
},
}}
/>
)}
{diceStatus === 'done' && (showGoogleIframe || showRollIframe) && (
<TextField
fullWidth
placeholder="Суммарный результат броска"
sx={{ height: '44px', marginBottom: '20px' }}
value={customRoll ?? ''}
onChange={(e) => {
const value = parseInt(e.target.value)
if (value >= 1 && value <= 100) {
setCustomRoll(value)
} else {
setCustomRoll(null)
}
}}
InputProps={{
style: {
paddingTop: '10px',
paddingLeft: '15px',
paddingRight: '15px',
paddingBottom: '10px',
lineHeight: '1.2',
fontSize: '16px',
fontWeight: 500,
},
}}
/>
)}
{diceStatus === 'done' && (
<Button
fullWidth
Expand All @@ -388,9 +387,15 @@ export default function DiceModal({

{diceStatus === 'idle' && (
<Box marginTop="20px" display="flex">
<Button style={{ width: '100%' }} onClick={handleGoogleThrow}>
<Button
style={{ marginRight: '20px', width: '100%' }}
onClick={handleGoogleThrow}
>
Бросить через google.com
</Button>
<Button style={{ width: '100%' }} onClick={handleRollADieThrow}>
Бросить через rolladie.net
</Button>
</Box>
)}
</Box>
Expand Down
48 changes: 48 additions & 0 deletions src/pages/map/components/player/JumpingIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { useEffect } from 'react'
import { animated, useSpring } from '@react-spring/web'

type Props = {
image: string
isJumping?: boolean
scale?: number
}

export default function JumpingIcon({ image, isJumping, scale }: Props) {
const [styles, api] = useSpring(() => ({
x: 0,
y: 0,
scale: 1.0,
config: { duration: 1000 },
}))

const scaleValue = scale || 1.0

useEffect(() => {
if (isJumping) {
api.start({
loop: true,
from: { x: 0, y: 0, scale: 1.0 },
to: [
{ x: 0, y: -10, scale: 0.8 },
{ x: 0, y: 0, scale: 1.0 },
],
config: { duration: 500 },
})
} else {
api.stop()
}
}, [isJumping])

return (
<animated.img
src={image}
style={{
...styles,
width: `${40 * scaleValue}px`,
verticalAlign: 'middle',
filter: 'drop-shadow(0px -1px 15px rgba(0,0,0,1.0))',
zIndex: 20,
}}
/>
)
}
Loading

0 comments on commit 124b91b

Please sign in to comment.