@@ -11,7 +11,7 @@ net {
ip = "5.196.91.160"
asset {
domain = ${net.domain}
version = 2030
version = 2032
}
email = "contact@lichess.org"
crawlable = false
@@ -38,7 +38,6 @@ export interface StudyPracticeCtrl {
data: StudyPracticeData;
goal: Prop<Goal>;
success: Prop<boolean | null>;
comment: Prop<string | undefined>;
nbMoves: Prop<number>;
reset(): void;
isWhite(): boolean;
@@ -10,28 +10,20 @@ import AnalyseCtrl from '../../ctrl';
export default function(root: AnalyseCtrl, studyData: StudyData, data: StudyPracticeData): StudyPracticeCtrl {

const goal = prop<Goal>(root.data.practiceGoal!),
comment = prop<string | undefined>(undefined),
nbMoves = prop(0),
// null = ongoing, true = win, false = fail
success = prop<boolean | null>(null),
sound = makeSound(),
analysisUrl = prop(''),
autoNext = storedProp('practice-auto-next', true);

function makeComment(treeRoot: Tree.Node) {
if (!treeRoot.comments) return;
comment(treeRoot.comments[0].text);
delete treeRoot.comments;
}

function onLoad() {
root.showAutoShapes = readOnlyProp(true);
root.showGauge = readOnlyProp(true);
root.showComputer = readOnlyProp(true);
goal(root.data.practiceGoal!);
nbMoves(0);
success(null);
makeComment(root.tree.root);
const chapter = studyData.chapter;
history.replaceState(null, chapter.name, data.url + '/' + chapter.id);
analysisUrl('/analysis/standard/' + root.node.fen.replace(/ /g, '_') + '?color=' + root.bottomColor());
@@ -90,10 +82,7 @@ export default function(root: AnalyseCtrl, studyData: StudyData, data: StudyPrac
}

return {
onReload() {
comment('');
onLoad();
},
onReload: onLoad,
onJump() {
// reset failure state if no failed move found in mainline history
if (success() === false && !root.nodeList.find(n => !!n.fail)) success(null);
@@ -103,7 +92,6 @@ export default function(root: AnalyseCtrl, studyData: StudyData, data: StudyPrac
data,
goal,
success,
comment,
nbMoves,
reset() {
root.tree.root.children = [];
@@ -50,12 +50,13 @@ function renderGoal(practice: StudyPracticeCtrl, inMoves: number) {

export function underboard(ctrl: StudyCtrl): VNode | undefined {
if (ctrl.vm.loading) return h('div.feedback', spinner());
const p = ctrl.practice!;
const gb = ctrl.gamebookPlay();
const p = ctrl.practice!,
gb = ctrl.gamebookPlay(),
pinned = ctrl.data.chapter.description;
if (gb) return h('div', [
h('div.feedback.ongoing', [
p.comment() ? h('div.comment', {
hook: innerHTML(p.comment(), text => enrichText(text!, true))
pinned ? h('div.comment', {
hook: innerHTML(pinned, text => enrichText(text!, true))
}) : null
])
]);
@@ -82,8 +83,8 @@ export function underboard(ctrl: StudyCtrl): VNode | undefined {
return h('div', [
h('div.feedback.ongoing', [
h('div.goal', [renderGoal(p, p.goal().moves! - p.nbMoves())]),
p.comment() ? h('div.comment', {
hook: innerHTML(p.comment(), text => enrichText(text!, true))
pinned ? h('div.comment', {
hook: innerHTML(pinned, text => enrichText(text!, true))
}) : null
]),
boolSetting({