lila/app/views/learn.scala

219 lines
5.2 KiB
Scala
Raw Permalink Normal View History

2019-01-15 00:13:14 -07:00
package views.html.learn
2019-04-22 02:45:52 -06:00
import play.api.libs.json.Json
2019-01-15 00:13:14 -07:00
import lila.api.Context
import lila.app.templating.Environment._
import lila.app.ui.ScalatagsTemplate._
import lila.common.String.html.safeJsonValue
import controllers.routes
object index {
import trans.learn.{ play => _, _ }
2019-12-13 07:30:20 -07:00
def apply(data: Option[play.api.libs.json.JsValue])(implicit ctx: Context) =
views.html.base.layout(
title = s"${learnChess.txt()} - ${byPlaying.txt()}",
2019-12-13 07:30:20 -07:00
moreJs = frag(
2020-07-31 05:52:49 -06:00
jsModule("learn"),
2020-09-04 08:10:30 -06:00
embedJsUnsafeLoadThen(s"""LichessLearn(document.getElementById('learn-app'), ${safeJsonValue(
2019-12-13 07:30:20 -07:00
Json.obj(
"data" -> data,
"i18n" -> i18nJsObject(i18nKeys)
2019-12-13 07:30:20 -07:00
)
2020-09-04 08:10:30 -06:00
)})""")
2019-12-13 07:30:20 -07:00
),
moreCss = cssTag("learn"),
openGraph = lila.app.ui
.OpenGraph(
title = "Learn chess by playing",
description = "You don't know much about chess? Excellent! Let's have fun and learn to play chess!",
url = s"$netBaseUrl${routes.Learn.index}"
2019-12-13 07:30:20 -07:00
)
.some,
2021-06-23 19:43:46 -06:00
zoomable = true,
chessground = false
2019-12-13 07:30:20 -07:00
) {
2019-03-24 19:34:45 -06:00
main(id := "learn-app")
2019-01-15 00:13:14 -07:00
}
private val i18nKeys: List[lila.i18n.MessageKey] =
List(
2020-05-05 13:20:43 -06:00
learnChess,
byPlaying,
menu,
progressX,
resetMyProgress,
youWillLoseAllYourProgress,
trans.learn.play,
chessPieces,
theRook,
itMovesInStraightLines,
rookIntro,
rookGoal,
grabAllTheStars,
theFewerMoves,
useTwoRooks,
rookComplete,
theBishop,
itMovesDiagonally,
bishopIntro,
youNeedBothBishops,
bishopComplete,
theQueen,
queenCombinesRookAndBishop,
queenIntro,
queenComplete,
theKing,
theMostImportantPiece,
kingIntro,
theKingIsSlow,
lastOne,
kingComplete,
theKnight,
itMovesInAnLShape,
knightIntro,
knightsHaveAFancyWay,
knightsCanJumpOverObstacles,
knightComplete,
thePawn,
itMovesForwardOnly,
pawnIntro,
pawnsMoveOneSquareOnly,
mostOfTheTimePromotingToAQueenIsBest,
pawnsMoveForward,
captureThenPromote,
useAllThePawns,
aPawnOnTheSecondRank,
grabAllTheStarsNoNeedToPromote,
pawnComplete,
pawnPromotion,
yourPawnReachedTheEndOfTheBoard,
itNowPromotesToAStrongerPiece,
selectThePieceYouWant,
fundamentals,
capture,
takeTheEnemyPieces,
captureIntro,
takeTheBlackPieces,
takeTheBlackPiecesAndDontLoseYours,
captureComplete,
protection,
keepYourPiecesSafe,
protectionIntro,
protectionComplete,
escape,
noEscape,
dontLetThemTakeAnyUndefendedPiece,
combat,
captureAndDefendPieces,
combatIntro,
combatComplete,
checkInOne,
attackTheOpponentsKing,
checkInOneIntro,
checkInOneGoal,
checkInOneComplete,
outOfCheck,
defendYourKing,
outOfCheckIntro,
escapeWithTheKing,
theKingCannotEscapeButBlock,
youCanGetOutOfCheckByTaking,
thisKnightIsCheckingThroughYourDefenses,
escapeOrBlock,
outOfCheckComplete,
mateInOne,
defeatTheOpponentsKing,
mateInOneIntro,
attackYourOpponentsKing,
mateInOneComplete,
intermediate,
boardSetup,
howTheGameStarts,
boardSetupIntro,
thisIsTheInitialPosition,
firstPlaceTheRooks,
thenPlaceTheKnights,
placeTheBishops,
placeTheQueen,
placeTheKing,
pawnsFormTheFrontLine,
boardSetupComplete,
castling,
theSpecialKingMove,
castlingIntro,
castleKingSide,
castleQueenSide,
theKnightIsInTheWay,
castleKingSideMovePiecesFirst,
castleQueenSideMovePiecesFirst,
youCannotCastleIfMoved,
youCannotCastleIfAttacked,
findAWayToCastleKingSide,
findAWayToCastleQueenSide,
castlingComplete,
enPassant,
theSpecialPawnMove,
enPassantIntro,
blackJustMovedThePawnByTwoSquares,
enPassantOnlyWorksImmediately,
enPassantOnlyWorksOnFifthRank,
takeAllThePawnsEnPassant,
enPassantComplete,
stalemate,
theGameIsADraw,
stalemateIntro,
stalemateGoal,
stalemateComplete,
advanced,
pieceValue,
evaluatePieceStrength,
pieceValueIntro,
queenOverBishop,
takeThePieceWithTheHighestValue,
2021-05-26 10:36:49 -06:00
pieceValueLegal,
pieceValueExchange,
pieceValueComplete,
checkInTwo,
twoMovesToGiveCheck,
checkInTwoIntro,
checkInTwoGoal,
checkInTwoComplete,
whatNext,
youKnowHowToPlayChess,
register,
getAFreeLichessAccount,
practice,
learnCommonChessPositions,
puzzles,
exerciseYourTacticalSkills,
videos,
watchInstructiveChessVideos,
playPeople,
opponentsFromAroundTheWorld,
playMachine,
testYourSkillsWithTheComputer,
letsGo,
stageX,
awesome,
excellent,
greatJob,
perfect,
outstanding,
wayToGo,
yesYesYes,
youreGoodAtThis,
nailedIt,
rightOn,
stageXComplete,
yourScore,
next,
backToMenu,
puzzleFailed,
retry
).map(_.key)
2019-01-15 00:13:14 -07:00
}