Skip to content

Commit 8ce41bf

Browse files
committed
tutor UI wip
1 parent a694603 commit 8ce41bf

File tree

2 files changed

+65
-61
lines changed

2 files changed

+65
-61
lines changed

modules/tutor/src/main/ui/TutorOpening.scala

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -29,82 +29,86 @@ final class TutorOpening(helpers: Helpers, bits: TutorBits, perfUi: TutorPerfUi)
2929
bits.page(
3030
title = s"Lichess Tutor • ${perfReport.perf.trans}${as.name}${report.family.name.value}",
3131
menu = openingMenu(perfReport, report, as, user)
32-
)(cls := "tutor__opening box"):
32+
)(cls := "tutor__opening tutor-layout"):
3333
frag(
34-
boxTop(
35-
h1(
36-
a(
37-
href := routes.Tutor.openings(user.username, perfReport.perf.key),
38-
dataIcon := Icon.LessThan,
39-
cls := "text"
40-
),
41-
bits.otherUser(user),
42-
perfReport.perf.trans,
43-
": ",
44-
report.family.name,
45-
" as ",
46-
as.name
47-
)
48-
),
49-
bits.mascotSays(
50-
div(
51-
cls := "lpv lpv--todo",
52-
st.data("pgn") := report.family.anyOpening.pgn,
53-
st.data("title") := report.family.name
34+
div(cls := "box tutor__first-box")(
35+
boxTop(
36+
h1(
37+
a(
38+
href := routes.Tutor.openings(user.username, perfReport.perf.key),
39+
dataIcon := Icon.LessThan,
40+
cls := "text"
41+
),
42+
bits.otherUser(user),
43+
perfReport.perf.trans,
44+
": ",
45+
report.family.name,
46+
" as ",
47+
as.name
48+
)
5449
),
55-
div(cls := "mascot-says__content__text")(
56-
p(
57-
"You played the ",
58-
report.family.name.value,
59-
" in ",
60-
report.performance.mine.count.localize,
61-
" games, which is ",
62-
bits.percentFrag(perfReport.openingFrequency(as, report)),
63-
" of the time you played as ",
64-
as.name,
65-
"."
50+
bits.mascotSays(
51+
div(
52+
cls := "lpv lpv--todo",
53+
st.data("pgn") := report.family.anyOpening.pgn,
54+
st.data("title") := report.family.name
6655
),
67-
div(cls := "mascot-says__buttons")(
68-
a(
69-
cls := "button button-no-upper text",
70-
dataIcon := Icon.InfoCircle,
71-
href := bits.openingUrl(report.family.anyOpening)
72-
)("Learn about this opening"),
73-
a(
74-
cls := "button button-no-upper text",
75-
dataIcon := Icon.Book,
76-
href := s"${routes.UserAnalysis
77-
.pgn(report.family.anyOpening.pgn.value.replace(" ", "_"))}#explorer/${user.username}"
78-
)("Personal opening explorer"),
79-
puzzle
56+
div(cls := "mascot-says__content__text")(
57+
p(
58+
"You played the ",
59+
report.family.name.value,
60+
" in ",
61+
report.performance.mine.count.localize,
62+
" games, which is ",
63+
bits.percentFrag(perfReport.openingFrequency(as, report)),
64+
" of the time you played as ",
65+
as.name,
66+
"."
67+
),
68+
div(cls := "mascot-says__buttons")(
69+
a(
70+
cls := "button button-no-upper text",
71+
dataIcon := Icon.InfoCircle,
72+
href := bits.openingUrl(report.family.anyOpening)
73+
)("Learn about this opening"),
74+
a(
75+
cls := "button button-no-upper text",
76+
dataIcon := Icon.Book,
77+
href := s"${routes.UserAnalysis
78+
.pgn(report.family.anyOpening.pgn.value.replace(" ", "_"))}#explorer/${user.username}"
79+
)("Personal opening explorer"),
80+
puzzle
81+
)
8082
)
8183
)
8284
),
83-
div(cls := "tutor__pad tutor-grades")(
85+
div(cls := "box tutor__pad tutor-grades")(
8486
grade.peerGradeWithDetail(concept.performance, report.performance.toOption, InsightPosition.Game),
8587
grade.peerGradeWithDetail(concept.accuracy, report.accuracy, InsightPosition.Move),
8688
grade.peerGradeWithDetail(concept.tacticalAwareness, report.awareness, InsightPosition.Move)
8789
)
8890
)
8991

9092
def openings(report: TutorPerfReport, user: User)(using ctx: Context) =
91-
bits.page(menu = perfUi.menu(user, report, "openings"))(cls := "tutor__openings box"):
93+
bits.page(menu = perfUi.menu(user, report, "openings"))(cls := "tutor__openings tutor-layout"):
9294
frag(
93-
boxTop(
94-
h1(
95-
a(
96-
href := routes.Tutor.perf(user.username, report.perf.key),
97-
dataIcon := Icon.LessThan,
98-
cls := "text"
99-
),
100-
bits.otherUser(user),
101-
report.perf.trans,
102-
" openings"
95+
div(cls := "tutor__first-box box")(
96+
boxTop(
97+
h1(
98+
a(
99+
href := routes.Tutor.perf(user.username, report.perf.key),
100+
dataIcon := Icon.LessThan,
101+
cls := "text"
102+
),
103+
bits.otherUser(user),
104+
report.perf.trans,
105+
" openings"
106+
)
107+
),
108+
bits.mascotSays(
109+
report.openingHighlights(3).map(compare.show)
103110
)
104111
),
105-
bits.mascotSays(
106-
report.openingHighlights(3).map(compare.show)
107-
),
108112
div(cls := "tutor__openings__colors tutor__pad")(Color.all.map { color =>
109113
st.section(cls := "tutor__openings__color")(
110114
h2("Your ", color.name, " openings"),

ui/tutor/css/_openings.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
flex: 250px 1 1;
99
h2 {
1010
font-size: 2em;
11-
margin-bottom: 1em;
11+
margin-bottom: $block-gap;
1212
}
1313
&__openings {
1414
display: grid;

0 commit comments

Comments
 (0)