Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add top banner #2381

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 105 additions & 100 deletions src/public/app/layouts/desktop_layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import OpenNoteButtonWidget from "../widgets/buttons/open_note_button_widget.js"
import MermaidWidget from "../widgets/mermaid.js";
import BookmarkButtons from "../widgets/bookmark_buttons.js";
import NoteWrapperWidget from "../widgets/note_wrapper.js";
import BannerMessageWidget from "../widgets/banner_message.js";

export default class DesktopLayout {
constructor(customWidgets) {
Expand All @@ -57,113 +58,117 @@ export default class DesktopLayout {

return new RootContainer()
.setParent(appContext)
.child(new FlexContainer("column")
.id("launcher-pane")
.css("width", "53px")
.child(new GlobalMenuWidget())
.child(new ButtonWidget()
.icon("bx-file-blank")
.title("New note")
.command("createNoteIntoInbox"))
.child(new ButtonWidget()
.icon("bx-search")
.title("Search")
.command("searchNotes"))
.child(new ButtonWidget()
.icon("bx-send")
.title("Jump to note")
.command("jumpToNote"))
.child(new OpenNoteButtonWidget()
.targetNote('globalnotemap'))
.child(new ButtonWidget()
.icon("bx-history")
.title("Show recent changes")
.command("showRecentChanges"))
.child(new CalendarWidget())
.child(new SpacerWidget(40, 0))
.child(new BannerMessageWidget())
.child(new FlexContainer("row")
.withFullSize()
.child(new FlexContainer("column")
.id("plugin-buttons")
.contentSized())
.child(new BookmarkButtons())
.child(new SpacerWidget(0, 1000))
.child(new ProtectedSessionStatusWidget())
.child(new SyncStatusWidget())
.child(new LeftPaneToggleWidget())
)
.child(new LeftPaneContainer()
.child(new QuickSearchWidget())
.child(appContext.mainTreeWidget)
.child(...this.customWidgets.get('left-pane'))
)
.child(new FlexContainer('column')
.id('rest-pane')
.css("flex-grow", "1")
.child(new FlexContainer('row')
.child(new TabRowWidget())
.child(new TitleBarButtonsWidget())
.css('height', '40px')
.id("launcher-pane")
.css("width", "53px")
.child(new GlobalMenuWidget())
.child(new ButtonWidget()
.icon("bx-file-blank")
.title("New note")
.command("createNoteIntoInbox"))
.child(new ButtonWidget()
.icon("bx-search")
.title("Search")
.command("searchNotes"))
.child(new ButtonWidget()
.icon("bx-send")
.title("Jump to note")
.command("jumpToNote"))
.child(new OpenNoteButtonWidget()
.targetNote('globalnotemap'))
.child(new ButtonWidget()
.icon("bx-history")
.title("Show recent changes")
.command("showRecentChanges"))
.child(new CalendarWidget())
.child(new SpacerWidget(40, 0))
.child(new FlexContainer("column")
.id("plugin-buttons")
.contentSized())
.child(new BookmarkButtons())
.child(new SpacerWidget(0, 1000))
.child(new ProtectedSessionStatusWidget())
.child(new SyncStatusWidget())
.child(new LeftPaneToggleWidget())
)
.child(new FlexContainer('row')
.filling()
.collapsible()
.child(new FlexContainer('column')
.child(new LeftPaneContainer()
.child(new QuickSearchWidget())
.child(appContext.mainTreeWidget)
.child(...this.customWidgets.get('left-pane'))
)
.child(new FlexContainer('column')
.id('rest-pane')
.css("flex-grow", "1")
.child(new FlexContainer('row')
.child(new TabRowWidget())
.child(new TitleBarButtonsWidget())
.css('height', '40px')
)
.child(new FlexContainer('row')
.filling()
.collapsible()
.id('center-pane')
.child(new SplitNoteContainer(() =>
new NoteWrapperWidget()
.child(new FlexContainer('row').class('title-row')
.css("height", "50px")
.css('align-items', "center")
.cssBlock('.title-row > * { margin: 5px; }')
.child(new NoteIconWidget())
.child(new NoteTitleWidget())
.child(new SpacerWidget(0, 1))
.child(new ClosePaneButton())
.child(new CreatePaneButton())
)
.child(
new RibbonContainer()
.ribbon(new SearchDefinitionWidget())
.ribbon(new EditedNotesWidget())
.ribbon(new BookPropertiesWidget())
.ribbon(new NotePropertiesWidget())
.ribbon(new FilePropertiesWidget())
.ribbon(new ImagePropertiesWidget())
.ribbon(new PromotedAttributesWidget())
.ribbon(new BasicPropertiesWidget())
.ribbon(new OwnedAttributeListWidget())
.ribbon(new InheritedAttributesWidget())
.ribbon(new NotePathsWidget())
.ribbon(new NoteMapRibbonWidget())
.ribbon(new SimilarNotesWidget())
.ribbon(new NoteInfoWidget())
.button(new EditButton())
.button(new ButtonWidget()
.icon('bx-history')
.title("Note Revisions")
.command("showNoteRevisions")
.titlePlacement("bottom"))
.button(new NoteActionsWidget())
.child(new FlexContainer('column')
.filling()
.collapsible()
.id('center-pane')
.child(new SplitNoteContainer(() =>
new NoteWrapperWidget()
.child(new FlexContainer('row').class('title-row')
.css("height", "50px")
.css('align-items', "center")
.cssBlock('.title-row > * { margin: 5px; }')
.child(new NoteIconWidget())
.child(new NoteTitleWidget())
.child(new SpacerWidget(0, 1))
.child(new ClosePaneButton())
.child(new CreatePaneButton())
)
.child(
new RibbonContainer()
.ribbon(new SearchDefinitionWidget())
.ribbon(new EditedNotesWidget())
.ribbon(new BookPropertiesWidget())
.ribbon(new NotePropertiesWidget())
.ribbon(new FilePropertiesWidget())
.ribbon(new ImagePropertiesWidget())
.ribbon(new PromotedAttributesWidget())
.ribbon(new BasicPropertiesWidget())
.ribbon(new OwnedAttributeListWidget())
.ribbon(new InheritedAttributesWidget())
.ribbon(new NotePathsWidget())
.ribbon(new NoteMapRibbonWidget())
.ribbon(new SimilarNotesWidget())
.ribbon(new NoteInfoWidget())
.button(new EditButton())
.button(new ButtonWidget()
.icon('bx-history')
.title("Note Revisions")
.command("showNoteRevisions")
.titlePlacement("bottom"))
.button(new NoteActionsWidget())
)
.child(new NoteUpdateStatusWidget())
.child(new MermaidWidget())
.child(
new ScrollingContainer()
.filling()
.child(new SqlTableSchemasWidget())
.child(new NoteDetailWidget())
.child(new NoteListWidget())
.child(new SearchResultWidget())
.child(new SqlResultWidget())
)
.child(...this.customWidgets.get('node-detail-pane'))
)
.child(new NoteUpdateStatusWidget())
.child(new MermaidWidget())
.child(
new ScrollingContainer()
.filling()
.child(new SqlTableSchemasWidget())
.child(new NoteDetailWidget())
.child(new NoteListWidget())
.child(new SearchResultWidget())
.child(new SqlResultWidget())
)
.child(...this.customWidgets.get('node-detail-pane'))
)
.child(...this.customWidgets.get('center-pane'))
)
.child(new RightPaneContainer()
.child(...this.customWidgets.get('right-pane'))
)
.child(...this.customWidgets.get('center-pane'))
)
.child(new RightPaneContainer()
.child(...this.customWidgets.get('right-pane'))
)
)
);
Expand Down
29 changes: 29 additions & 0 deletions src/public/app/services/timer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// https://stackoverflow.com/a/3969760
export default class Timer {
timerId;
start;
remaining;
callback;

constructor(callback, delay) {
this.remaining = delay;
this.callback = callback;

this.resume()
}

pause() {
clearTimeout(this.timerId);
this.remaining -= Date.now() - this.start;
}

resume() {
this.start = Date.now();
clearTimeout(this.timerId);
this.timerId = setTimeout(this.callback, this.remaining);
}

clear() {
clearTimeout(this.timerId);
}
}
Loading