gamebook code renaming
This commit is contained in:
parent
5318e742a1
commit
b1edce0aa6
|
@ -1,25 +1,25 @@
|
|||
.gb_editor .lichess_game .lichess_ground {
|
||||
.gb_edit .lichess_game .lichess_ground {
|
||||
margin-bottom: -517px;
|
||||
}
|
||||
.gb_editor .gamebook_wrap {
|
||||
.gb_edit .gamebook_wrap {
|
||||
height: 500px;
|
||||
}
|
||||
.gb_editor .gamebook {
|
||||
.gb_edit .gamebook {
|
||||
background: #e0e0e0;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
}
|
||||
.gb_editor .gamebook .deviation,
|
||||
.gb_editor .gamebook .hint {
|
||||
.gb_edit .gamebook .deviation,
|
||||
.gb_edit .gamebook .hint {
|
||||
padding-top: 8px;
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
}
|
||||
.gb_editor .gamebook label {
|
||||
.gb_edit .gamebook label {
|
||||
display: block;
|
||||
padding: 0 0 8px 10px;
|
||||
}
|
||||
.gb_editor .gamebook textarea {
|
||||
.gb_edit .gamebook textarea {
|
||||
resize: vertical;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
|
@ -27,23 +27,23 @@
|
|||
border-width: 1px 0;
|
||||
padding: 5px;
|
||||
}
|
||||
.gb_editor .gamebook .hint textarea {
|
||||
.gb_edit .gamebook .hint textarea {
|
||||
height: 5em;
|
||||
}
|
||||
.gb_editor .gamebook .legend {
|
||||
.gb_edit .gamebook .legend {
|
||||
padding: 8px 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
.gb_editor .gamebook .legend::before {
|
||||
.gb_edit .gamebook .legend::before {
|
||||
display: block;
|
||||
float: left;
|
||||
font-size: 2.5em;
|
||||
margin: 2px 8px 0 0;
|
||||
opacity: 0.5;
|
||||
}
|
||||
.gb_editor .gamebook .todo {
|
||||
.gb_edit .gamebook .todo {
|
||||
border-left: 5px solid #dc322f;
|
||||
}
|
||||
.gb_editor .gamebook .done {
|
||||
.gb_edit .gamebook .done {
|
||||
border-left: 5px solid #759900;
|
||||
}
|
2
public/stylesheets/gamebook.play.css
Normal file
2
public/stylesheets/gamebook.play.css
Normal file
|
@ -0,0 +1,2 @@
|
|||
.gb_play .gamebook {
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
.gb_player .gamebook {
|
||||
}
|
|
@ -28,7 +28,7 @@ import { make as makeEvalCache, EvalCache } from './evalCache';
|
|||
import { compute as computeAutoShapes } from './autoShape';
|
||||
import { nextGlyphSymbol } from './nodeFinder';
|
||||
import { AnalyseOpts, AnalyseData, AnalyseDataWithTree, Key, CgDests, JustCaptured } from './interfaces';
|
||||
import GamebookPlayerCtrl from './study/gamebook/player/gamebookPlayerCtrl';
|
||||
import GamebookPlayCtrl from './study/gamebook/play/gamebookPlayCtrl';
|
||||
|
||||
const li = window.lichess;
|
||||
|
||||
|
@ -789,8 +789,8 @@ export default class AnalyseCtrl {
|
|||
this.togglePractice();
|
||||
}
|
||||
|
||||
gamebookPlayer = (): GamebookPlayerCtrl | undefined => {
|
||||
return this.study && this.study.gamebookPlayer();
|
||||
gamebookPlay = (): GamebookPlayCtrl | undefined => {
|
||||
return this.study && this.study.gamebookPlay();
|
||||
}
|
||||
|
||||
private withCg<A>(f: (cg: ChessgroundApi) => A): A | undefined {
|
||||
|
|
|
@ -8,7 +8,7 @@ import { throttle } from 'common';
|
|||
import { path as treePath } from 'tree';
|
||||
|
||||
export function running(ctrl: AnalyseCtrl): boolean {
|
||||
return !!ctrl.study && ctrl.study.data.chapter.gamebook && !ctrl.gamebookPlayer();
|
||||
return !!ctrl.study && ctrl.study.data.chapter.gamebook && !ctrl.gamebookPlay();
|
||||
}
|
||||
|
||||
export function render(ctrl: AnalyseCtrl): VNode {
|
||||
|
@ -67,9 +67,7 @@ export function render(ctrl: AnalyseCtrl): VNode {
|
|||
];
|
||||
|
||||
return h('div.gamebook_wrap', {
|
||||
hook: {
|
||||
insert: _ => window.lichess.loadCss('/assets/stylesheets/gamebook.editor.css')
|
||||
}
|
||||
hook: { insert: _ => window.lichess.loadCss('/assets/stylesheets/gamebook.edit.css') }
|
||||
}, [
|
||||
h('div.gamebook', content)
|
||||
]);
|
|
@ -1,7 +1,7 @@
|
|||
import AnalyseCtrl from '../../../ctrl';
|
||||
import { StudyCtrl } from '../../interfaces';
|
||||
|
||||
export default class GamebookPlayerCtrl {
|
||||
export default class GamebookPlayCtrl {
|
||||
|
||||
root: AnalyseCtrl;
|
||||
|
|
@ -1,22 +1,22 @@
|
|||
import { h } from 'snabbdom'
|
||||
import { VNode } from 'snabbdom/vnode'
|
||||
import GamebookPlayerCtrl from './gamebookPlayerCtrl';
|
||||
import GamebookPlayCtrl from './gamebookPlayCtrl';
|
||||
// import AnalyseCtrl from '../../../ctrl';
|
||||
import { innerHTML } from '../../../util';
|
||||
import { enrichText } from '../../studyComments';
|
||||
// import { MaybeVNodes } from '../../../interfaces';
|
||||
// import { throttle } from 'common';
|
||||
|
||||
export function render(ctrl: GamebookPlayerCtrl): VNode {
|
||||
export function render(ctrl: GamebookPlayCtrl): VNode {
|
||||
|
||||
const root = ctrl.root,
|
||||
isMyMove = root.turnColor() === root.data.orientation,
|
||||
comment = (root.node.comments || [])[0];
|
||||
|
||||
return h('div.gamebook', {
|
||||
hook: { insert: _ => window.lichess.loadCss('/assets/stylesheets/gamebook.player.css') }
|
||||
hook: { insert: _ => window.lichess.loadCss('/assets/stylesheets/gamebook.play.css') }
|
||||
}, [
|
||||
h('div.player', [
|
||||
h('div.play', [
|
||||
h('div.turn', isMyMove ? 'Your move' : 'Opponent move'),
|
||||
h('div.comment', {
|
||||
hook: comment && innerHTML(comment.text, text => enrichText(text, true))
|
|
@ -2,7 +2,7 @@ import { Prop } from 'common';
|
|||
import { NotifCtrl } from './notif';
|
||||
import { AnalyseData } from '../interfaces';
|
||||
import { StudyPracticeCtrl } from './practice/interfaces';
|
||||
import GamebookPlayerCtrl from './gamebook/player/gamebookPlayerCtrl';
|
||||
import GamebookPlayCtrl from './gamebook/play/gamebookPlayCtrl';
|
||||
|
||||
export interface StudyCtrl {
|
||||
data: StudyData;
|
||||
|
@ -34,7 +34,7 @@ export interface StudyCtrl {
|
|||
userJump(path: Tree.Path): void;
|
||||
currentNode(): Tree.Node;
|
||||
practice?: StudyPracticeCtrl;
|
||||
gamebookPlayer(): GamebookPlayerCtrl | undefined;
|
||||
gamebookPlay(): GamebookPlayCtrl | undefined;
|
||||
mutateCgConfig(config: any): void;
|
||||
redraw(): void;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import * as tours from './studyTour';
|
|||
import * as xhr from './studyXhr';
|
||||
import { path as treePath } from 'tree';
|
||||
import { StudyCtrl, StudyVm, Tab, TagTypes, StudyData, StudyChapterMeta, ReloadData } from './interfaces';
|
||||
import GamebookPlayerCtrl from './gamebook/player/gamebookPlayerCtrl';
|
||||
import GamebookPlayCtrl from './gamebook/play/gamebookPlayCtrl';
|
||||
|
||||
const li = window.lichess;
|
||||
|
||||
|
@ -190,14 +190,14 @@ export default function(data: StudyData, ctrl: AnalyseCtrl, tagTypes: TagTypes,
|
|||
|
||||
const practice: StudyPracticeCtrl | undefined = practiceData && practiceCtrl(ctrl, data, practiceData);
|
||||
|
||||
let gamebookPlayer: GamebookPlayerCtrl | undefined;
|
||||
let gamebookPlay: GamebookPlayCtrl | undefined;
|
||||
|
||||
function instanciateGamebookPlayer() {
|
||||
if (!data.chapter.gamebook || members.canContribute()) return gamebookPlayer = undefined;
|
||||
if (gamebookPlayer && gamebookPlayer.chapterId === vm.chapterId) return;
|
||||
gamebookPlayer = new GamebookPlayerCtrl(ctrl, vm.chapterId);
|
||||
function instanciateGamebookPlay() {
|
||||
if (!data.chapter.gamebook || members.canContribute()) return gamebookPlay = undefined;
|
||||
if (gamebookPlay && gamebookPlay.chapterId === vm.chapterId) return;
|
||||
gamebookPlay = new GamebookPlayCtrl(ctrl, vm.chapterId);
|
||||
}
|
||||
instanciateGamebookPlayer();
|
||||
instanciateGamebookPlay();
|
||||
|
||||
function mutateCgConfig(config) {
|
||||
config.drawable.onChange = function(shapes) {
|
||||
|
@ -297,7 +297,7 @@ export default function(data: StudyData, ctrl: AnalyseCtrl, tagTypes: TagTypes,
|
|||
userJump: ctrl.userJump,
|
||||
currentNode,
|
||||
practice,
|
||||
gamebookPlayer: () => gamebookPlayer,
|
||||
gamebookPlay: () => gamebookPlay,
|
||||
mutateCgConfig,
|
||||
redraw,
|
||||
socketHandlers: {
|
||||
|
|
|
@ -18,8 +18,8 @@ import { view as keyboardView} from './keyboard';
|
|||
import explorerView from './explorer/explorerView';
|
||||
import retroView from './retrospect/retroView';
|
||||
import practiceView from './practice/practiceView';
|
||||
import * as gbEditor from './study/gamebook/gamebookEditor';
|
||||
import * as gbPlayer from './study/gamebook/player/gamebookPlayerView';
|
||||
import * as gbEdit from './study/gamebook/gamebookEdit';
|
||||
import * as gbPlay from './study/gamebook/play/gamebookPlayView';
|
||||
import * as studyView from './study/studyView';
|
||||
import { view as forkView } from './fork'
|
||||
import { render as acplView } from './acpl'
|
||||
|
@ -247,9 +247,9 @@ export default function(ctrl: AnalyseCtrl): VNode {
|
|||
menuIsOpen = ctrl.actionMenu.open,
|
||||
chapter = ctrl.study && ctrl.study.data.chapter,
|
||||
studyStateClass = chapter ? chapter.id + ctrl.study!.vm.loading : 'nostudy',
|
||||
gamebookPlayer = ctrl.gamebookPlayer(),
|
||||
gamebookPlayerView = gamebookPlayer && gbPlayer.render(gamebookPlayer),
|
||||
gamebookEditorView = gbEditor.running(ctrl) ? gbEditor.render(ctrl) : undefined;
|
||||
gamebookPlay = ctrl.gamebookPlay(),
|
||||
gamebookPlayView = gamebookPlay && gbPlay.render(gamebookPlay),
|
||||
gamebookEditView = gbEdit.running(ctrl) ? gbEdit.render(ctrl) : undefined;
|
||||
return h('div.analyse.cg-512', [
|
||||
h('div.' + studyStateClass, {
|
||||
hook: {
|
||||
|
@ -261,8 +261,8 @@ export default function(ctrl: AnalyseCtrl): VNode {
|
|||
class: {
|
||||
'gauge_displayed': ctrl.showEvalGauge(),
|
||||
'no_computer': !ctrl.showComputer(),
|
||||
'gb_editor': !!gamebookEditorView,
|
||||
'gb_player': !!gamebookPlayerView
|
||||
'gb_edit': !!gamebookEditView,
|
||||
'gb_play': !!gamebookPlayView
|
||||
}
|
||||
}, [
|
||||
h('div.lichess_game', {
|
||||
|
@ -271,19 +271,19 @@ export default function(ctrl: AnalyseCtrl): VNode {
|
|||
}
|
||||
}, [
|
||||
visualBoard(ctrl),
|
||||
h('div.lichess_ground', gamebookPlayerView || [
|
||||
h('div.lichess_ground', gamebookPlayView || [
|
||||
menuIsOpen ? null : renderClocks(ctrl),
|
||||
menuIsOpen ? null : crazyView(ctrl, ctrl.topColor(), 'top'),
|
||||
...(menuIsOpen ? [actionMenu(ctrl)] : [
|
||||
cevalView.renderCeval(ctrl),
|
||||
showCevalPvs ? cevalView.renderPvs(ctrl) : null,
|
||||
renderAnalyse(ctrl, concealOf),
|
||||
gamebookEditorView ? null : forkView(ctrl, concealOf),
|
||||
gamebookEditView ? null : forkView(ctrl, concealOf),
|
||||
retroView(ctrl) || practiceView(ctrl) || explorerView(ctrl)
|
||||
]),
|
||||
menuIsOpen ? null : crazyView(ctrl, ctrl.bottomColor(), 'bottom'),
|
||||
buttons(ctrl),
|
||||
gamebookEditorView
|
||||
gamebookEditView
|
||||
])
|
||||
])
|
||||
]),
|
||||
|
|
Loading…
Reference in a new issue