blind UI for homepage

This commit is contained in:
Thibault Duplessis 2019-05-02 17:19:53 +07:00
parent 94a4c2af9f
commit 3fcb75b996
7 changed files with 81 additions and 66 deletions

View file

@ -131,6 +131,7 @@ object layout {
ctx.pref.is3d option cssTag("board-3d"),
ctx.pageData.inquiry.isDefined option cssTagNoTheme("mod.inquiry"),
ctx.userContext.impersonatedBy.isDefined option cssTagNoTheme("mod.impersonate"),
ctx.blind option cssTagNoTheme("blind"),
moreCss,
pieceSprite,
ctx.pref.coords == Pref.Coords.INSIDE option innerCoordsCss,
@ -250,6 +251,7 @@ object layout {
span(if (isProd && !isStage) ".org" else ".dev")
)
),
ctx.blind option h2("Navigation"),
topnav()
),
div(cls := "site-buttons")(

View file

@ -9,68 +9,65 @@ import controllers.routes
object topnav {
private def linkTitle(url: String, name: Frag)(implicit ctx: Context) =
if (ctx.blind) h2(name) else a(href := url)(name)
if (ctx.blind) h3(name) else a(href := url)(name)
def apply()(implicit ctx: Context) = st.nav(
id := "topnav",
cls := (if (ctx.blind) "blind" else "hover")
)(
st.section(
linkTitle("/", frag(
span(cls := "play")(trans.play()),
span(cls := "home")("lichess.org")
)),
div(role := "group")(
if (ctx.noBot) a(href := "/?any#hook")(trans.createAGame())
else a(href := "/?any#friend")(trans.playWithAFriend()),
ctx.noBot option frag(
a(href := routes.Tournament.home())(trans.tournament()),
a(href := routes.Simul.home)(trans.simultaneousExhibitions())
)
)
),
st.section(
linkTitle(routes.Puzzle.home.toString, trans.learnMenu()),
div(role := "group")(
ctx.noBot option frag(
a(href := routes.Learn.index)(trans.chessBasics()),
a(href := routes.Puzzle.home)(trans.training()),
a(href := routes.Practice.index)("Practice"),
a(href := routes.Coordinate.home)(trans.coordinates.coordinates())
),
a(href := routes.Study.allDefault(1))("Study"),
a(href := routes.Coach.allDefault(1))(trans.coaches())
)
),
st.section(
linkTitle(routes.Tv.index.toString, trans.watch()),
div(role := "group")(
a(href := routes.Tv.index)("Lichess TV"),
a(href := routes.Tv.games)(trans.currentGames()),
a(href := routes.Streamer.index())("Streamers"),
a(href := routes.Relay.index())("Broadcasts"),
ctx.noBot option a(href := routes.Video.index)(trans.videoLibrary())
)
),
st.section(
linkTitle(routes.User.list.toString, trans.community()),
div(role := "group")(
a(href := routes.User.list)(trans.players()),
NotForKids(frag(
a(href := routes.Team.home())(trans.teams()),
a(href := routes.ForumCateg.index)(trans.forum())
))
)
),
st.section(
linkTitle(routes.UserAnalysis.index.toString, trans.tools()),
div(role := "group")(
a(href := routes.UserAnalysis.index)(trans.analysis()),
a(href := s"${routes.UserAnalysis.index}#explorer")(trans.openingExplorer()),
a(href := routes.Editor.index)(trans.boardEditor()),
a(href := routes.Importer.importGame)(trans.importGame()),
a(href := routes.Search.index())(trans.advancedSearch())
def apply()(implicit ctx: Context) = st.nav(id := "topnav", role := "navigation")(
st.section(
linkTitle("/", frag(
span(cls := "play")(trans.play()),
span(cls := "home")("lichess.org")
)),
div(role := "group")(
if (ctx.noBot) a(href := "/?any#hook")(trans.createAGame())
else a(href := "/?any#friend")(trans.playWithAFriend()),
ctx.noBot option frag(
a(href := routes.Tournament.home())(trans.tournament()),
a(href := routes.Simul.home)(trans.simultaneousExhibitions())
)
)
),
st.section(
linkTitle(routes.Puzzle.home.toString, trans.learnMenu()),
div(role := "group")(
ctx.noBot option frag(
a(href := routes.Learn.index)(trans.chessBasics()),
a(href := routes.Puzzle.home)(trans.training()),
a(href := routes.Practice.index)("Practice"),
a(href := routes.Coordinate.home)(trans.coordinates.coordinates())
),
a(href := routes.Study.allDefault(1))("Study"),
a(href := routes.Coach.allDefault(1))(trans.coaches())
)
),
st.section(
linkTitle(routes.Tv.index.toString, trans.watch()),
div(role := "group")(
a(href := routes.Tv.index)("Lichess TV"),
a(href := routes.Tv.games)(trans.currentGames()),
a(href := routes.Streamer.index())("Streamers"),
a(href := routes.Relay.index())("Broadcasts"),
ctx.noBot option a(href := routes.Video.index)(trans.videoLibrary())
)
),
st.section(
linkTitle(routes.User.list.toString, trans.community()),
div(role := "group")(
a(href := routes.User.list)(trans.players()),
NotForKids(frag(
a(href := routes.Team.home())(trans.teams()),
a(href := routes.ForumCateg.index)(trans.forum())
))
)
),
st.section(
linkTitle(routes.UserAnalysis.index.toString, trans.tools()),
div(role := "group")(
a(href := routes.UserAnalysis.index)(trans.analysis()),
a(href := s"${routes.UserAnalysis.index}#explorer")(trans.openingExplorer()),
a(href := routes.Editor.index)(trans.boardEditor()),
a(href := routes.Importer.importGame)(trans.importGame()),
a(href := routes.Search.index())(trans.advancedSearch())
)
)
)
}

View file

@ -21,7 +21,7 @@ object bits {
)(implicit ctx: Context) = frag(
div(cls := "lobby__leaderboard lobby__box")(
div(cls := "lobby__box__top")(
span(cls := "title text", dataIcon := "C")(trans.leaderboard()),
h2(cls := "title text", dataIcon := "C")(trans.leaderboard()),
a(cls := "more", href := routes.User.list)(trans.more(), " »")
),
div(cls := "lobby__box__content")(
@ -40,7 +40,7 @@ object bits {
),
div(cls := "lobby__winners lobby__box")(
div(cls := "lobby__box__top")(
span(cls := "title text", dataIcon := "g")(trans.tournamentWinners()),
h2(cls := "title text", dataIcon := "g")(trans.tournamentWinners()),
a(cls := "more", href := routes.Tournament.leaderboard)(trans.more(), " »")
),
div(cls := "lobby__box__content")(
@ -56,7 +56,7 @@ object bits {
),
div(cls := "lobby__tournaments lobby__box")(
div(cls := "lobby__box__top")(
span(cls := "title text", dataIcon := "g")(trans.openTournaments()),
h2(cls := "title text", dataIcon := "g")(trans.openTournaments()),
a(cls := "more", href := routes.Tournament.home())(trans.more(), " »")
),
div(id := "enterable_tournaments", cls := "enterable_list lobby__box__content")(
@ -65,7 +65,7 @@ object bits {
),
div(cls := "lobby__simuls lobby__box")(
div(cls := "lobby__box__top")(
span(cls := "title text", dataIcon := "f")(trans.simultaneousExhibitions()),
h2(cls := "title text", dataIcon := "f")(trans.simultaneousExhibitions()),
a(cls := "more", href := routes.Simul.home())(trans.more(), " »")
),
div(id := "enterable_simuls", cls := "enterable_list lobby__box__content")(
@ -77,7 +77,7 @@ object bits {
def lastPosts(posts: List[lila.blog.MiniPost])(implicit ctx: Context): Option[Frag] = posts.nonEmpty option
div(cls := "lobby__blog lobby__box")(
div(cls := "lobby__box__top")(
span(cls := "title text", dataIcon := "6")(trans.latestUpdates()),
h2(cls := "title text", dataIcon := "6")(trans.latestUpdates()),
a(cls := "more", href := routes.Blog.index())(trans.more(), " »")
),
div(cls := "lobby__box__content")(

View file

@ -67,6 +67,7 @@ object home {
))(
div(cls := "lobby__table")(
div(cls := "lobby__start")(
ctx.blind option h2("Play"),
a(href := routes.Setup.hookForm, cls := List(
"button button-metal config_hook" -> true,
"disabled" -> (playban.isDefined || currentGame.isDefined || ctx.isBot)
@ -81,6 +82,7 @@ object home {
), trans.playWithTheMachine())
),
div(cls := "lobby__counters")(
ctx.blind option h2("Counters"),
a(id := "nb_connected_players", href := ctx.noBlind.option(routes.User.list.toString))(trans.nbPlayers(nbPlayersPlaceholder)),
a(id := "nb_games_in_play", href := ctx.noBlind.option(routes.Tv.games.toString))(
trans.nbGamesInPlay.plural(nbRounds, strong(nbRounds))
@ -91,6 +93,7 @@ object home {
playban.map(bits.playbanInfo) getOrElse
bits.lobbyApp,
div(cls := "lobby__side")(
ctx.blind option h2("Highlights"),
ctx.noKid option st.section(cls := "lobby__streams")(views.html.streamer.bits liveStreams streams),
div(cls := "lobby__spotlights")(
events.map(bits.spotlight),
@ -101,11 +104,13 @@ object home {
),
ctx.me map { u =>
div(cls := "timeline", dataHref := routes.Timeline.home)(
ctx.blind option h2("Timeline"),
views.html.timeline entries userTimeline,
// userTimeline.size >= 8 option
a(cls := "more", href := routes.Timeline.home)(trans.more(), " »")
)
} getOrElse div(cls := "about-side")(
ctx.blind option h2("About"),
trans.xIsAFreeYLibreOpenSourceChessServer("Lichess", a(cls := "blue", href := routes.Plan.features)(trans.really.txt())),
" ",
a(href := "/about")(trans.aboutX("Lichess"), "...")
@ -130,7 +135,7 @@ object home {
ctx.noBot option bits.underboards(tours, simuls, leaderboard, tournamentWinners),
ctx.noKid option div(cls := "lobby__forum lobby__box")(
div(cls := "lobby__box__top")(
span(cls := "title text", dataIcon := "d")(trans.latestForumPosts()),
h2(cls := "title text", dataIcon := "d")(trans.latestForumPosts()),
a(cls := "more", href := routes.ForumCateg.index)(trans.more(), " »")
),
div(cls := "lobby__box__content")(
@ -155,6 +160,7 @@ object home {
)
),
div(cls := "lobby__about")(
ctx.blind option h2("About"),
a(href := "/about")(trans.aboutX("Lichess")),
a(href := "/faq")("FAQ"),
a(href := "/contact")(trans.contact()),

View file

@ -9,6 +9,8 @@
color: $c-font-dim;
}
.title {
@extend %base-font;
font-size: 1em;
font-weight: bold;
color: $c-font-dim;
padding: .3em;

7
ui/site/css/_blind.scss Normal file
View file

@ -0,0 +1,7 @@
#topnav div {
visibility: visible;
font-size: .8em;
}
#main-wrap {
margin-top: 170px;
}

View file

@ -0,0 +1 @@
@import '../blind';