From 1896fd1a306b95049a84d7faae10e8461fa2e3a8 Mon Sep 17 00:00:00 2001 From: alinayejin Date: Tue, 5 Dec 2023 20:55:42 -0500 Subject: start/end link event --- .../CollectionFreeFormInfoUI.tsx | 25 ++++++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx index 2e3bfb1c7..0ec20a851 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormInfoUI.tsx @@ -30,8 +30,6 @@ export class CollectionFreeFormInfoUI extends React.Component ({ x: NumCast(this.firstDoc?.x), y: NumCast(this.firstDoc?.y), links: this.firstDoc && LinkManager.Instance.getAllDirectLinks(this.firstDoc) }), ({ x, y, links }) => { if ((x && x != this.firstDocPos.x) || (y && y != this.firstDocPos.y)) { - this.message = 'You moved the doc'; + this.message = 'You moved the doc.'; } if (links && links.length > 0) { this.message = 'You made your first link! You can also click the link icon to start and complete the link.'; @@ -52,17 +50,30 @@ export class CollectionFreeFormInfoUI extends React.Component ({ activeTool: Doc.ActiveTool, linkMenu: DocumentLinksButton.LinkEditorDocView }), - ({ activeTool, linkMenu }) => { + () => ({ activeTool: Doc.ActiveTool, viewingLinks: DocumentLinksButton.LinkEditorDocView }), + ({ activeTool, viewingLinks }) => { if (activeTool == InkTool.Pen) { this.message = "You're in pen mode! Click and drag to draw your first masterpiece."; } - if (linkMenu) { - this.message = 'To edit your links, click this pencil icon.'; + if (viewingLinks) { + this.message = 'Viewing links'; + } + if (Doc.ActiveTool === InkTool.Pen) { + this.message = 'Editing links'; } }, { fireImmediately: true } ); + this._disposers.reaction4 = reaction( + () => ({ startLink: DocumentLinksButton.StartLink, endLink: Doc.UserDoc().links }), + ({ startLink, endLink }) => { + if (startLink) { + this.message = "You've started a link."; + } else if (endLink) { + this.message = "You've completed a link."; + } + } + ); } componentWillUnmount(): void { -- cgit v1.2.3-70-g09d2