relocate study static video
parent
c35d622d5e
commit
6e400513cf
|
@ -725,7 +725,7 @@ div.undertable_inner {
|
|||
.board_left.no_chat .study_box .list {
|
||||
max-height: 500px;
|
||||
}
|
||||
div.side_box.embed {
|
||||
div.chapter_embed {
|
||||
line-height: 0;
|
||||
border: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { h } from 'snabbdom'
|
||||
import { VNode } from 'snabbdom/vnode'
|
||||
import { bind, plural, dataIcon, toYouTubeEmbed, innerHTML } from '../util';
|
||||
import { bind, plural, dataIcon } from '../util';
|
||||
import { view as memberView } from './studyMembers';
|
||||
import { view as chapterView } from './studyChapters';
|
||||
import { view as chapterNewFormView } from './chapterNewForm';
|
||||
|
@ -135,22 +135,10 @@ export function main(ctrl: StudyCtrl): VNode {
|
|||
if (activeTab === 'members') panel = memberView(ctrl);
|
||||
else if (activeTab === 'chapters') panel = chapterView(ctrl);
|
||||
|
||||
const embedUrl = ctrl.data.chapter.embed;
|
||||
|
||||
const sideBox = h('div.side_box.study_box', [
|
||||
return h('div.side_box.study_box', [
|
||||
tabs,
|
||||
panel
|
||||
]);
|
||||
|
||||
return embedUrl ? h('div', [
|
||||
sideBox,
|
||||
h('div.side_box.embed', {
|
||||
hook: innerHTML(embedUrl, t => {
|
||||
const html = toYouTubeEmbed(t, 140);
|
||||
return html || (ctrl.members.canContribute() ? 'Invalid YouTube URL' : '')
|
||||
})
|
||||
})
|
||||
]) : sideBox;
|
||||
}
|
||||
|
||||
export function contextMenu(ctrl: StudyCtrl, path: Tree.Path, node: Tree.Node): VNode[] {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { h } from 'snabbdom'
|
|||
import { VNode } from 'snabbdom/vnode'
|
||||
|
||||
import * as chessground from './ground';
|
||||
import { synthetic, bind, dataIcon, iconTag, spinner } from './util';
|
||||
import { synthetic, bind, dataIcon, iconTag, spinner, toYouTubeEmbed, innerHTML } from './util';
|
||||
import { game, router, view as gameView } from 'game';
|
||||
import { path as treePath } from 'tree';
|
||||
import treeView from './treeView';
|
||||
|
@ -239,6 +239,16 @@ function renderChapterName(ctrl: AnalyseCtrl) {
|
|||
if (ctrl.embed && ctrl.study) return h('div.chapter_name', ctrl.study.currentChapter().name);
|
||||
}
|
||||
|
||||
export function chapterEmbed(ctrl: AnalyseCtrl): VNode | undefined {
|
||||
const embed = ctrl.study && ctrl.study.data.chapter.embed;
|
||||
if (embed) return h('div.chapter_embed', {
|
||||
hook: innerHTML(embed, t => {
|
||||
const html = toYouTubeEmbed(t, 157);
|
||||
return html || (ctrl.study!.members.canContribute() ? 'Invalid YouTube URL' : '')
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
let firstRender = true;
|
||||
|
||||
export default function(ctrl: AnalyseCtrl): VNode {
|
||||
|
@ -271,8 +281,9 @@ export default function(ctrl: AnalyseCtrl): VNode {
|
|||
}
|
||||
}, [
|
||||
visualBoard(ctrl),
|
||||
h('div.lichess_ground', gamebookPlayView || [
|
||||
h('div.lichess_ground', gamebookPlay ? [chapterEmbed(ctrl), gamebookPlayView] : [
|
||||
menuIsOpen ? null : renderClocks(ctrl),
|
||||
chapterEmbed(ctrl),
|
||||
menuIsOpen ? null : crazyView(ctrl, ctrl.topColor(), 'top'),
|
||||
...(menuIsOpen ? [actionMenu(ctrl)] : [
|
||||
cevalView.renderCeval(ctrl),
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"strictNullChecks": true,
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedLocals": true,
|
||||
"noEmitOnError": true,
|
||||
"noImplicitAny": false,
|
||||
"noImplicitReturns": false,
|
||||
|
|
Loading…
Reference in New Issue