Skip to content

Commit

Permalink
Fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Carbrex committed Jul 6, 2024
1 parent 2caefd0 commit f7155e1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 18 deletions.
1 change: 1 addition & 0 deletions ui/analyse/src/study/relay/relayView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export function relayView(
const ctx: RelayViewContext = { ...viewContext(ctrl, deps), study, deps, relay, allowVideo: allowVideo() };

const renderTourView = () => [renderRelayTour(ctx), tourSide(ctx), deps.relayManager(relay, study)];

return renderMain(ctx, [
ctrl.keyboardHelp && keyboardView(ctrl),
deps.studyView.overboard(study),
Expand Down
21 changes: 9 additions & 12 deletions ui/analyse/src/view/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ export const renderMaterialDiffs = (ctrl: AnalyseCtrl): [VNode, VNode] =>
export const addChapterId = (study: StudyCtrl | undefined, cssClass: string) =>
cssClass + (study && study.data.chapter ? '.' + study.data.chapter.id : '');

function broadcastChatHandler(ctrl: AnalyseCtrl):BroadcastChatHandler {
function broadcastChatHandler(ctrl: AnalyseCtrl): BroadcastChatHandler {
const encode = (text: string): string => {
if (ctrl.study?.relay && !ctrl.study.relay.tourShow()) {
let chapterId = ctrl.study.currentChapter().id;
let ply = ctrl.study.currentNode().ply;
const chapterId = ctrl.study.currentChapter().id;
const ply = ctrl.study.currentNode().ply;
// '\ue666' was arbitrarily chosen from the unicode private use area to separate the text from the chapterId and ply
text = text + '\ue666' + chapterId + '\ue666' + ply;
}
Expand All @@ -402,7 +402,7 @@ function broadcastChatHandler(ctrl: AnalyseCtrl):BroadcastChatHandler {
};
const jumpToMove = (msg: string): void => {
if (msg.includes('\ue666') && ctrl.study?.relay) {
let segs = msg.split('\ue666');
const segs = msg.split('\ue666');
if (segs.length == 3) {
const [_, chapterId, ply] = segs;
ctrl.study.setChapter(chapterId);
Expand All @@ -411,19 +411,16 @@ function broadcastChatHandler(ctrl: AnalyseCtrl):BroadcastChatHandler {
}
};
const canJumpToMove = (msg: string): boolean => {
if (msg.includes('\ue666') && ctrl.study?.relay) {
let segs = msg.split('\ue666');
if (segs.length == 3) {
return true;
}
if (msg.includes('\ue666') && ctrl.study?.relay && msg.split('\ue666').length === 3) {
return true;
}
return false;
}
};
return {
encode,
getClearedText,
jumpToMove,
canJumpToMove
canJumpToMove,
};
}

Expand All @@ -433,7 +430,7 @@ export function makeChat(ctrl: AnalyseCtrl, insert: (chat: HTMLElement) => void)
chatEl.classList.add('mchat');
insert(chatEl);
const chatOpts = ctrl.opts.chat;
chatOpts.broadcastChatHandler= broadcastChatHandler(ctrl);
chatOpts.broadcastChatHandler = broadcastChatHandler(ctrl);
chatOpts.instance?.then(c => c.destroy());
chatOpts.enhance = { plies: true, boards: !!ctrl.study?.relay };
chatOpts.instance = site.makeChat(chatOpts);
Expand Down
4 changes: 0 additions & 4 deletions ui/chat/css/_discussion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,13 @@
}

a.jump {
// display: none;
position: absolute;
top: 5px;
font-size: medium;
@include inline-end(5px);
cursor: pointer;
margin-inline-end: 3px;
padding: 1px 5px;
// opacity: 0.7;
// color: $c-accent;

}

&__say {
Expand Down
2 changes: 1 addition & 1 deletion ui/chat/src/ctrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
ChatData,
NoteCtrl,
ChatPalantir,
BroadcastChatHandler,
} from './interfaces';
import { PresetCtrl, presetCtrl } from './preset';
import { noteCtrl } from './note';
import { moderationCtrl } from './moderation';
import { prop } from 'common';
import { BroadcastChatHandler } from './interfaces';

export default class ChatCtrl {
data: ChatData;
Expand Down
1 change: 0 additions & 1 deletion ui/chat/src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export interface Line {
ply?: number;
}


export interface BroadcastChatHandler {
encode(text: string): string;
getClearedText(msg: string): string;
Expand Down

0 comments on commit f7155e1

Please sign in to comment.