Skip to content

Commit

Permalink
Update wheels modal
Browse files Browse the repository at this point in the history
  • Loading branch information
maximvl committed Dec 15, 2024
1 parent 0ef3315 commit d1f24f4
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/MainMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import useScreenSize from 'src/context/useScreenSize'
import MainMenuMobile from './MainMenuMobile'
import Clock from './Clock'
import MultistreamButton from 'src/pages/players/components/MultistreamButton'
import DifficultyButton from 'src/pages/rules/components/DifficultyButton'
import WheelButton from 'src/pages/rules/components/WheelButton'
import { useTime } from 'src/context/TimeProvider'
import { playerDisplayName } from 'src/pages/player/components/utils'
import useLocalStorage from 'src/context/useLocalStorage'
Expand Down Expand Up @@ -76,7 +76,7 @@ export default function MainMenu({
}

if (!leftSlot && currentUser) {
leftSlot = <DifficultyButton />
leftSlot = <WheelButton />
}

if (!rightSlot) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/map/MapPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MapComponent from './components/MapComponent'
import TimelapseProvider from './hooks/useTimelapse'
import useScreenSize from 'src/context/useScreenSize'
import MapComponentMobile from './components/MapComponentMobile'
import DifficultyButton from '../rules/components/DifficultyButton'
import WheelButton from '../rules/components/DifficultyButton'

Check failure on line 8 in src/pages/map/MapPage.tsx

View workflow job for this annotation

GitHub Actions / build_and_deploy (22.x)

Cannot find module '../rules/components/DifficultyButton' or its corresponding type declarations.
import { useUser } from 'src/context/UserProvider'

export default function MapPage() {
Expand Down
32 changes: 32 additions & 0 deletions src/pages/rules/components/SheikhWheel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Box } from '@mui/material'
import { Color } from 'src/utils/types'

export default function SheikhWheel() {
return (
<Box display={'flex'} justifyContent={'center'}>
<Box
style={{
position: 'absolute',
width: '700px',
backgroundColor: Color.greyDark,
height: '10px',
// display: 'none',
}}
/>
<Box>
<iframe
src="https://wheelofnames.com/ru/th2-utw"
title="Колесо шейх-момента"
width={'700px'}
height={'700px'}
style={{
border: 'none',
padding: 0,
margin: 0,
overflow: 'hidden',
}}
/>
</Box>
</Box>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@ import { useState } from 'react'
import DifficultyWheel from './DifficultyWheel'
import WheelIcon from 'assets/icons/wheel.svg?react'
import { Close } from '@mui/icons-material'
import SheikhWheel from './SheikhWheel'
import { Link } from 'react-router-dom'
import LinkSpan from 'src/components/LinkSpan'
import { Color } from 'src/utils/types'

export default function DifficultyButton() {
export default function WheelButton() {
const [modalOpen, setModalOpen] = useState(false)
const [wheelType, setWheelType] = useState<'difficulty' | 'sheikh'>(
'difficulty'
)

const resetScroll = (e: React.UIEvent<HTMLDivElement>) => {
const target = e.target as HTMLDivElement
Expand All @@ -29,7 +36,7 @@ export default function DifficultyButton() {
<WheelIcon
style={{ marginRight: '8px', width: '19px', height: '19px' }}
/>
Колесо сложности
Колеса
</Button>
<Dialog
open={modalOpen}
Expand All @@ -39,13 +46,30 @@ export default function DifficultyButton() {
<DialogTitle style={{ padding: 0, margin: 0 }}>
<Box
width={'100%'}
fontSize={'32px'}
// fontSize={'32px'}
marginBottom={'0px'}
display={'flex'}
position={'relative'}
marginTop={'20px'}
justifyContent={'center'}
>
<Box margin={'0 auto'}>Ролл сложности игры</Box>
<Box marginRight="50px">
<Link to="#" onClick={() => setWheelType('difficulty')}>
<LinkSpan
color={Color.blue}
active={wheelType === 'difficulty'}
>
Ролл сложности
</LinkSpan>
</Link>
</Box>
<Box>
<Link to="#" onClick={() => setWheelType('sheikh')}>
<LinkSpan color={Color.orange} active={wheelType === 'sheikh'}>
Ролл шейх-момента
</LinkSpan>
</Link>
</Box>
<Box position={'absolute'} right={'40px'}>
<IconButton
aria-label="close"
Expand All @@ -61,7 +85,8 @@ export default function DifficultyButton() {
</Box>
</DialogTitle>
<DialogContent style={{ overflow: 'hidden' }} onScroll={resetScroll}>
<DifficultyWheel />
{wheelType === 'difficulty' && <DifficultyWheel />}
{wheelType === 'sheikh' && <SheikhWheel />}
</DialogContent>
</Dialog>
</>
Expand Down

0 comments on commit d1f24f4

Please sign in to comment.