Skip to content

Commit

Permalink
also fix NVUI in puzzles and analysis - for #13077
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 23, 2023
1 parent 684bfce commit 450dd8e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
3 changes: 2 additions & 1 deletion ui/analyse/src/plugins/nvui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const borderSound = throttled('outOfBound');
const errorSound = throttled('error');

export function initModule(ctrl: AnalyseController) {
const notify = new Notify(ctrl.redraw),
const notify = new Notify(),
moveStyle = styleSetting(),
pieceStyle = pieceSetting(),
prefixStyle = prefixSetting(),
Expand All @@ -67,6 +67,7 @@ export function initModule(ctrl: AnalyseController) {

return {
render(): VNode {
notify.redraw = ctrl.redraw;
const d = ctrl.data,
style = moveStyle.get();
if (!ctrl.chessground)
Expand Down
7 changes: 4 additions & 3 deletions ui/puzzle/src/plugins/nvui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { renderSetting } from 'nvui/setting';
import { Notify } from 'nvui/notify';
import { commands } from 'nvui/command';
import * as control from '../control';
import { bind, onInsert, Redraw } from 'common/snabbdom';
import { bind, onInsert } from 'common/snabbdom';
import { Api } from 'chessground/api';
import throttle from 'common/throttle';

Expand All @@ -38,8 +38,8 @@ const selectSound = throttled('select');
const borderSound = throttled('outOfBound');
const errorSound = throttled('error');

export function initModule(redraw: Redraw) {
const notify = new Notify(redraw),
export function initModule() {
const notify = new Notify(),
moveStyle = styleSetting(),
prefixStyle = prefixSetting(),
pieceStyle = pieceSetting(),
Expand All @@ -48,6 +48,7 @@ export function initModule(redraw: Redraw) {

return {
render(ctrl: Controller): VNode {
notify.redraw = ctrl.redraw;
const ground = ctrl.ground() || createGround(ctrl);

return h(
Expand Down
1 change: 0 additions & 1 deletion ui/round/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ export default class RoundController {
}, 3000);

this.socket = makeSocket(opts.socketSend, this);
this.nvui?.setRedraw(redraw);

if (d.clock)
this.clock = new ClockController(d, {
Expand Down
2 changes: 0 additions & 2 deletions ui/round/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import RoundController from './ctrl';
import { ChatCtrl, ChatPlugin } from 'chat';
import * as cg from 'chessground/types';
import * as Prefs from 'common/prefs';
import { Redraw } from 'common/snabbdom';

export interface Untyped {
[key: string]: any;
Expand All @@ -17,7 +16,6 @@ export interface NvuiPlugin {
playPremove: (ctrl: RoundController) => void;
premoveInput: string;
render(ctrl: RoundController): VNode;
setRedraw(redraw: Redraw): void;
}

export interface SocketOpts {
Expand Down
4 changes: 1 addition & 3 deletions ui/round/src/plugins/nvui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ export function initModule(): NvuiPlugin {
lichess.pubsub.on('round.suggestion', notify.set);

return {
setRedraw(redraw) {
notify.redraw = redraw;
},
premoveInput: '',
playPremove(ctrl: RoundController) {
const nvui = ctrl.nvui!;
Expand All @@ -66,6 +63,7 @@ export function initModule(): NvuiPlugin {
},
submitMove: undefined,
render(ctrl: RoundController): VNode {
notify.redraw = ctrl.redraw;
const d = ctrl.data,
nvui = ctrl.nvui!,
step = plyStep(d, ctrl.ply),
Expand Down

0 comments on commit 450dd8e

Please sign in to comment.