{setPopupContent("rules")}}
inverted={true} />
{t(gameInfo.data?.title, {ns: gameId})}
}
/** Content of the navigation on Mobile during world selection. */
function MobileNavigationOverview () {
const { t } = useTranslation()
const {page, setPage} = useContext(PageContext)
const { setPopupContent } = useContext(PopupContext)
return
{setPopupContent("rules")}}
inverted={true} />
{page > 0 &&
setPage(page - 1)}
inverted={true} />
}
{ page < 2 &&
setPage(page+1)}
inverted={true} />
}
}
/** Content of the navigation on Desktop in a level. */
function DesktopNavigationLevel () {
const { t } = useTranslation()
const { gameId, worldId, levelId } = useContext(GameIdContext)
const { typewriterMode, setTypewriterMode, lockEditorMode } = useContext(PageContext)
const gameInfo = useGetGameInfoQuery({game: gameId})
const levelInfo = useLoadLevelQuery({game: gameId, world: worldId, level: levelId})
const difficulty = useSelector(selectDifficulty(gameId))
const completed = useAppSelector(selectCompleted(gameId, worldId, levelId))
/** toggle input mode if allowed */
function toggleInputMode(ev: React.MouseEvent) {
if (!lockEditorMode) {
setTypewriterMode(!typewriterMode)
console.log('test')
}
}
const worldTitle = gameInfo.data?.worlds.nodes[worldId]?.title
const levelTitle = ((levelId == 0) ?
t("Introduction") :
(
t("Level") +
` ${levelId}` +
(gameInfo.data?.worldSize[worldId] ? ` / ${gameInfo.data?.worldSize[worldId]}` : '') +
(levelInfo.data?.title ? ` : ${t(levelInfo?.data?.title, {ns: gameId})}` : '')
)
)
return
{worldTitle ? `${t("World")}: ${t(worldTitle, {ns: gameId})}` : ''}
{ levelTitle
}
{ levelId > 0 &&
}
{ levelId == gameInfo.data?.worldSize[worldId] ?
:
}
{ levelId > 0 &&
toggleInputMode(ev)}
title={lockEditorMode ? t("Editor mode is enforced!") : typewriterMode ? t("Editor mode") : t("Typewriter mode")} />
}
}
/** Content of the navigation on Mobile in a level. */
function MobileNavigationLevel () {
const { t } = useTranslation()
const {gameId, worldId, levelId} = useContext(GameIdContext)
const {page, setPage} = useContext(PageContext)
const gameInfo = useGetGameInfoQuery({game: gameId})
const levelInfo = useLoadLevelQuery({game: gameId, world: worldId, level: levelId})
let title = worldId ?
` ${levelId} / ${gameInfo.data?.worldSize[worldId]}`+ (levelInfo?.data?.title && ` : ${t(levelInfo?.data?.title, {ns: gameId})}`)
:
''
return