INNER CODE UNIT · TypeScript
view
gbtami/pychess-variants · client/main.ts:197
export function view(el: HTMLElement, model: PyChessModel): VNode {
const { base: variant } = splitVariantKey(model.variant);
const twoBoards = variant ? VARIANTS[variant].twoBoards : false;
switch (el.getAttribute('data-view')) {
case 'about':
return h('div#main-wrap', aboutView(model));
case 'level8win':
case 'profile':
return h('div#profile', profileView(model));
case 'tv':
case 'round':
if (twoBoards) {
return h('main#main-wrap.bug', bugRoundView(model));
} else {
return h('div#main-wrap', [h('main.round', roundView(model))]);
}
case 'embed':
return h('div', model.study ? studyEmbedView(model) : embedView(model));