updates for bookmarked/pinned

This commit is contained in:
sawka
2023-02-20 18:01:47 -08:00
parent 088e00f9da
commit e47c31e414
4 changed files with 80 additions and 13 deletions
+45 -7
View File
@@ -655,6 +655,23 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
} }
} }
@boundMethod
clickPin() {
let {line} = this.props;
if (!line.pinned) {
GlobalCommandRunner.linePin(line.lineid, true);
}
else {
GlobalCommandRunner.linePin(line.lineid, false);
}
}
@boundMethod
clickBookmark() {
let {line} = this.props;
GlobalCommandRunner.lineBookmark(line.lineid);
}
@boundMethod @boundMethod
handleResizeButton() { handleResizeButton() {
console.log("resize button"); console.log("resize button");
@@ -739,12 +756,15 @@ class LineCmd extends React.Component<{sw : ScreenWindow, line : LineType, width
</div> </div>
</div> </div>
<div key="spacer" className="flex-spacer"/> <div key="spacer" className="flex-spacer"/>
<div key="star" className={cn("line-star", {"active": line.star > 0})} onClick={this.clickStar}> <div key="pin" title="Pin" className={cn("line-icon", {"active": line.pinned})} onClick={this.clickPin}>
<If condition={!line.star || line.star == 0}> <i className="fa fa-thumb-tack"/>
<i className="fa fa-star-o"/> </div>
<div key="bookmark" title="Bookmark" className={cn("line-icon", "line-bookmark", {"active": line.bookmarked})} onClick={this.clickBookmark}>
<If condition={!line.bookmarked}>
<i className="fa fa-bookmark-o"/>
</If> </If>
<If condition={line.star > 0}> <If condition={line.bookmarked}>
<i className="fa fa-star"/> <i className="fa fa-bookmark"/>
</If> </If>
</div> </div>
</div> </div>
@@ -2817,6 +2837,10 @@ class MainSideBar extends React.Component<{}, {}> {
GlobalCommandRunner.createNewSession(); GlobalCommandRunner.createNewSession();
} }
handleNewSharedSession() {
console.log("create shared session");
}
clickRemotes() { clickRemotes() {
GlobalCommandRunner.showAllRemotes(); GlobalCommandRunner.showAllRemotes();
} }
@@ -2850,6 +2874,11 @@ class MainSideBar extends React.Component<{}, {}> {
})(); })();
} }
@boundMethod
handleBookmarksClick() : void {
console.log("click bookmarks");
}
render() { render() {
let model = GlobalModel; let model = GlobalModel;
let activeSessionId = model.activeSessionId.get(); let activeSessionId = model.activeSessionId.get();
@@ -2911,15 +2940,24 @@ class MainSideBar extends React.Component<{}, {}> {
<li className="new-session"><a onClick={() => this.handleNewSession()}><i className="fa fa-plus"/> New Session</a></li> <li className="new-session"><a onClick={() => this.handleNewSession()}><i className="fa fa-plus"/> New Session</a></li>
</If> </If>
</ul> </ul>
<p className="menu-label">
Shared Sessions
</p>
<ul className="menu-list">
<li className="new-session"><a onClick={() => this.handleNewSharedSession()}><i className="fa fa-plus"/> New Session</a></li>
</ul>
<ul className="menu-list" style={{marginTop: 20, display: "none"}}> <ul className="menu-list" style={{marginTop: 20, display: "none"}}>
<li className="menu-history"><a onClick={this.handleHistoryClick}><i className="fa fa-clock-o"/> HISTORY</a></li> <li className="menu-history"><a onClick={this.handleHistoryClick}><i className="fa fa-clock-o"/> HISTORY</a></li>
</ul> </ul>
<ul className="menu-list" style={{marginTop: 20}}>
<li className="menu-bookmarks"><a onClick={this.handleBookmarksClick}><i className="fa fa-bookmark"/> BOOKMARKS</a></li>
</ul>
<div className="spacer"></div> <div className="spacer"></div>
<If condition={GlobalModel.debugSW.get() && sw != null}> <If condition={GlobalModel.debugSW.get() && sw != null}>
<div> <div>
focus={sw.focusType.get()}<br/> focus={sw.focusType.get()}<br/>
sline={sw.selectedLine.get()}<br/> sline={sw.selectedLine.get()}<br/>
termfocus={sw.termLineNumFocus.get()}<br/> termfocus={sw.termLineNumFocus.get()}<br/>
</div> </div>
</If> </If>
<p className="menu-label"> <p className="menu-label">
+8
View File
@@ -2417,6 +2417,14 @@ class CommandRunner {
lineStar(lineId : string, starVal : number) { lineStar(lineId : string, starVal : number) {
GlobalModel.submitCommand("line", "star", [lineId, String(starVal)], {"nohist": "1"}, true); GlobalModel.submitCommand("line", "star", [lineId, String(starVal)], {"nohist": "1"}, true);
} }
lineBookmark(lineId : string) {
GlobalModel.submitCommand("line", "bookmark", [lineId], {"nohist": "1"}, true);
}
linePin(lineId : string, val : boolean) {
GlobalModel.submitCommand("line", "pin", [lineId, (val ? "1" : "0")], {"nohist": "1"}, true);
}
}; };
function cmdPacketString(pk : FeCmdPacketType) : string { function cmdPacketString(pk : FeCmdPacketType) : string {
+25 -6
View File
@@ -282,6 +282,10 @@ html, body, #main {
li.menu-history { li.menu-history {
margin-left: -10px; margin-left: -10px;
} }
li.menu-bookmarks {
margin-left: -10px;
}
} }
.menu-list.remotes-menu-list { .menu-list.remotes-menu-list {
@@ -458,19 +462,34 @@ html, body, #main {
margin-left: 2px; margin-left: 2px;
} }
.line-star { .line-icon {
display: none; display: none;
cursor: pointer; cursor: pointer;
padding: 3px; padding: 3px;
font-size: 1.5rem; font-size: 1.5rem;
} }
.line-star.active { .line-icon.line-bookmark.active {
display: block; cursor: auto;
color: @term-bright-yellow;
} }
&:hover .line-star { .line-icon + .line-icon {
margin-left: 5px;
}
.line-icon.active {
display: block;
i.fa-star, i.fa-thumb-tack {
color: @term-bright-yellow;
}
i.fa-bookmark {
color: @term-bright-blue;
}
}
&:hover .line-icon {
display: block; display: block;
} }
@@ -632,7 +651,7 @@ html, body, #main {
top: 4px; top: 4px;
} }
.line-star { .line-icon {
padding-top: 0; padding-top: 0;
padding-bottom: 0; padding-bottom: 0;
font-size: 20px; font-size: 20px;
+2
View File
@@ -31,6 +31,8 @@ type LineType = {
contentheight? : number, contentheight? : number,
star? : number, star? : number,
archived? : boolean, archived? : boolean,
bookmarked? : boolean,
pinned? : boolean,
ephemeral? : boolean, ephemeral? : boolean,
remove? : boolean, remove? : boolean,
}; };