From 5b4d197c4867100ae2575f4852b642242f201858 Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Sun, 5 Jan 2025 13:52:35 +0100 Subject: [PATCH] Refactor Notes interface and update related logic to use 'path' instead of 'file' #23 --- src/models/Demos.ts | 4 ++-- src/panels/DemoPanel.ts | 4 ++-- src/services/NotesService.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/models/Demos.ts b/src/models/Demos.ts index 149123a..9fb5338 100644 --- a/src/models/Demos.ts +++ b/src/models/Demos.ts @@ -20,8 +20,8 @@ export interface Demo { } export interface Notes { - file: string; - show?: boolean; + path: string; + showOnTrigger?: boolean; } export interface Icons { diff --git a/src/panels/DemoPanel.ts b/src/panels/DemoPanel.ts index 1a3cf73..5b23950 100644 --- a/src/panels/DemoPanel.ts +++ b/src/panels/DemoPanel.ts @@ -97,7 +97,7 @@ export class DemoPanel { ctxValue = "demo-time.lastStep"; } - const hasNotes = notesFolder && demo.notes?.file ? true : false; + const hasNotes = notesFolder && demo.notes?.path ? true : false; if (hasNotes) { ctxValue += " demo-time.hasNotes"; } @@ -129,7 +129,7 @@ export class DemoPanel { undefined, parseWinPath(path), idx, - demo.notes?.file + demo.notes?.path ); }); diff --git a/src/services/NotesService.ts b/src/services/NotesService.ts index dcff7c7..50c0a00 100644 --- a/src/services/NotesService.ts +++ b/src/services/NotesService.ts @@ -16,8 +16,8 @@ export class NotesService { } public static async showNotes(demo: Demo) { - if (demo.notes && demo.notes.file && demo.notes.show) { - NotesService.openNotes(demo.notes.file); + if (demo.notes && demo.notes.path && demo.notes.showOnTrigger) { + NotesService.openNotes(demo.notes.path); } }