add next/home back button to chat
This commit is contained in:
@@ -14,6 +14,7 @@ import { GameHint, InteractiveGoalsWithHints } from './infoview/rpc_api'
|
|||||||
import { lastStepHasErrors } from './infoview/goals'
|
import { lastStepHasErrors } from './infoview/goals'
|
||||||
|
|
||||||
import '../css/chat.css'
|
import '../css/chat.css'
|
||||||
|
import { faHome } from '@fortawesome/free-solid-svg-icons'
|
||||||
|
|
||||||
/** Split a string by double newlines and filters out empty segments. */
|
/** Split a string by double newlines and filters out empty segments. */
|
||||||
function splitIntro (intro : string) {
|
function splitIntro (intro : string) {
|
||||||
@@ -72,12 +73,14 @@ export function ChatButtons ({counter=undefined, setCounter=()=>{}, introMessage
|
|||||||
setCounter?: React.Dispatch<React.SetStateAction<number>>
|
setCounter?: React.Dispatch<React.SetStateAction<number>>
|
||||||
introMessages?: GameHintWithStep[]
|
introMessages?: GameHintWithStep[]
|
||||||
}) {
|
}) {
|
||||||
|
let { t } = useTranslation()
|
||||||
|
|
||||||
const { mobile } = useContext(PreferencesContext)
|
const { mobile } = useContext(PreferencesContext)
|
||||||
const { gameId, worldId, levelId } = useContext(GameIdContext)
|
const { gameId, worldId, levelId } = useContext(GameIdContext)
|
||||||
const {setPage} = useContext(PageContext)
|
const {setPage} = useContext(PageContext)
|
||||||
const dispatch = useAppDispatch()
|
const dispatch = useAppDispatch()
|
||||||
const gameInfo = useGetGameInfoQuery({game: gameId})
|
const gameInfo = useGetGameInfoQuery({game: gameId})
|
||||||
|
const { proof } = useContext(ProofContext)
|
||||||
|
|
||||||
const readIntro = useSelector(selectReadIntro(gameId, worldId))
|
const readIntro = useSelector(selectReadIntro(gameId, worldId))
|
||||||
|
|
||||||
@@ -124,6 +127,20 @@ export function ChatButtons ({counter=undefined, setCounter=()=>{}, introMessage
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{ (worldId && levelId) ? <MoreHelpButton /> : <></> }
|
{ (worldId && levelId) ? <MoreHelpButton /> : <></> }
|
||||||
|
{ (worldId && levelId && proof?.completed) ?
|
||||||
|
(levelId == gameInfo.data?.worldSize[worldId] ?
|
||||||
|
<Button className="btn"
|
||||||
|
title=""
|
||||||
|
to={`/${gameId}`} >
|
||||||
|
<FontAwesomeIcon icon={faHome} /> {t("Home")}
|
||||||
|
</Button> :
|
||||||
|
<Button className="btn"
|
||||||
|
title=""
|
||||||
|
to={`/${gameId}/world/${worldId}/level/${levelId + 1}`} >
|
||||||
|
{t("Next")} <FontAwesomeIcon icon={faArrowRight} />
|
||||||
|
|
||||||
|
</Button>
|
||||||
|
) : <></> }
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,6 +193,7 @@
|
|||||||
|
|
||||||
.goal-tab {
|
.goal-tab {
|
||||||
/* border: 2px dotted darkgreen; */
|
/* border: 2px dotted darkgreen; */
|
||||||
|
padding: .2rem;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
font-family: "JuliaMono", monospace;
|
font-family: "JuliaMono", monospace;
|
||||||
|
|||||||
Reference in New Issue
Block a user