diff --git a/src/main.tsx b/src/main.tsx index 59d33f6e..3b6207ee 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -43,6 +43,10 @@ type InterObsValue = { timeoutid? : any, }; +function renderCmdText(text : string) : any { + return ⌘{text}; +} + function isBlank(s : string) : boolean { return (s == null || s == ""); } @@ -1510,8 +1514,8 @@ class CmdInput extends React.Component<{}, {}> { -
-
focus input (⌘I)
+
+
focus input ({renderCmdText("I")})
{historyShow ? "close history (esc)" : "show history (ctrl-r)"}
@@ -2119,11 +2123,6 @@ class ScreenTabs extends React.Component<{session : Session}, {}> { GlobalCommandRunner.switchScreen(screenId); } - handleContextMenu(e : any, screenId : string) : void { - e.preventDefault(); - console.log("handle context menu!", screenId); - } - componentDidMount() : void { this.componentDidUpdate(); } @@ -2156,6 +2155,14 @@ class ScreenTabs extends React.Component<{session : Session}, {}> { this.stopScrolling_debounced(); } + @boundMethod + openScreenSettings(e : any, screen : Screen) : void { + e.preventDefault(); + mobx.action(() => { + GlobalModel.screenSettingsModal.set({sessionId: screen.sessionId, screenId: screen.screenId}); + })(); + } + render() { let {session} = this.props; if (session == null) { @@ -2172,17 +2179,29 @@ class ScreenTabs extends React.Component<{session : Session}, {}> { } } return ( -
- -
this.handleSwitchScreen(screen.screenId)} onContextMenu={(event) => this.handleContextMenu(event, screen.screenId)}> - {screen.name.get()} - -
⌘{index+1}
-
+
+
+ +
this.handleSwitchScreen(screen.screenId)} onContextMenu={(event) => this.openScreenSettings(event, screen)}> + {screen.name.get()} + +
{renderCmdText(String(index+1))}
+
this.openScreenSettings(e, screen)} title="Settings" className="tab-gear">
+
+ 9}> +
this.openScreenSettings(e, screen)} title="Settings" className="tab-gear">
+
+
+
+
+
- -
-
⌘T
+ +
+
+
move left {renderCmdText("[")}
+
move right {renderCmdText("]")}
+
new tab {renderCmdText("T")}
); @@ -2580,27 +2599,96 @@ class AlertModal extends React.Component<{}, {}> { let title = message.title ?? "Alert"; let isConfirm = message.confirm; return ( -
+
-
-
-

{title}

- +
+
+

{title}

+
+ +
-
+

{message.message}

-
-
+
+
- - +
OK
+
Cancel
- +
OK
- +
+ ); + } +} + +@mobxReact.observer +class ScreenSettingsModal extends React.Component<{sessionId : string, screenId : string}, {}> { + @boundMethod + closeModal() : void { + mobx.action(() => { + GlobalModel.screenSettingsModal.set(null); + })(); + } + + @boundMethod + handleOK() : void { + mobx.action(() => { + GlobalModel.screenSettingsModal.set(null); + })(); + console.log("ok"); + } + + render() { + let {sessionId, screenId} = this.props; + let screen = GlobalModel.getScreenById(sessionId, screenId); + if (screen == null) { + return null; + } + let opts = screen.opts.get(); + let tabColor = "default"; + if (opts != null && !isBlank(opts.tabcolor)) { + tabColor = opts.tabcolor; + } + return ( +
+
+
+
+
screen settings ({screen.name.get()})
+
+ +
+
+
+
+ sessionid - {screen.sessionId} +
+
+ screenid - {screen.screenId} +
+
+ name - {screen.name.get()} +
+
+ tabcolor - {tabColor} +
+
+ archived - {screen.archived.get() ? "true" : "false"} +
+
+ index - {screen.screenIdx.get()} +
+
+
+
OK
+
Cancel
+
+
); } @@ -2649,10 +2737,9 @@ class WelcomeModal extends React.Component<{}, {}> { } render() { - let title = "welcome to [prompt]"; let pageNum = this.pageNum.get(); return ( -
+
@@ -2661,7 +2748,7 @@ class WelcomeModal extends React.Component<{}, {}> {
-
+

Prompt is a new terminal to help save you time and keep your command-line life organized. Here's a couple quick tips to get your started! @@ -2738,6 +2825,7 @@ class Main extends React.Component<{}, {}> { } render() { + let ssm = GlobalModel.screenSettingsModal.get(); return (

@@ -2753,6 +2841,9 @@ class Main extends React.Component<{}, {}> { + + +
); } diff --git a/src/model.ts b/src/model.ts index 551c8512..df23d44e 100644 --- a/src/model.ts +++ b/src/model.ts @@ -2252,6 +2252,7 @@ class Model { alertMessage : OV = mobx.observable.box(null, {name: "alertMessage"}); alertPromiseResolver : (result : boolean) => void; welcomeModalOpen : OV = mobx.observable.box(false, {name: "welcomeModalOpen"}); + screenSettingsModal : OV<{sessionId : string, screenId : string}> = mobx.observable.box(null, {name: "screenSettingsModal"}); inputModel : InputModel; bookmarksModel : BookmarksModel; diff --git a/src/sh2.less b/src/sh2.less index 849ccce4..6e7ea8b9 100644 --- a/src/sh2.less +++ b/src/sh2.less @@ -817,6 +817,25 @@ body::-webkit-scrollbar { } } +.screen-tabs-container { + position: relative; + + &:hover { + z-index: 200; + } + + &:hover .cmd-hints { + display: flex; + } + + .cmd-hints { + position: absolute; + bottom: -18px; + left: 0px; + display: flex; + } +} + .screen-tabs { height: 30px; display: flex; @@ -824,6 +843,7 @@ body::-webkit-scrollbar { border-top: 1px solid #666; border-right: 1px solid #eee; overflow-x: overlay; + overflow-y: visible; align-items: center; &::-webkit-scrollbar { @@ -872,21 +892,38 @@ body::-webkit-scrollbar { } } - .tab-index { + .tab-index, .tab-gear { position: absolute; right: 5px; font-weight: normal; display: none; } + + &:hover .tab-gear { + display: block; + + &:hover { + i { + display: block; + position: relative; + top: 2px; + font-size: 15px; + } + } + } } &:hover .screen-tab .tab-index { display: block; } + &:hover .screen-tab:hover .tab-index { + display: none; + } + .screen-tab.new-screen { - width: 80px; - min-width: 80px; + width: 30px; + min-width: 30px; background-color: black; border-right: none; color: #ccc; @@ -1747,7 +1784,7 @@ body .xterm .xterm-viewport { z-index: 100; &.has-info { - padding-top: 5px; + padding-top: 10px; } .focus-indicator { @@ -1792,45 +1829,10 @@ body .xterm .xterm-viewport { line-height: 0; } - .cmd-input-hints { + .cmd-hints { position: absolute; bottom: -14px; right: 0px; - .mono-font(10px); - display: flex; - flex-direction: row; - - .hint-item { - padding: 0px 5px 0px 5px; - border-radius: 0 0 3px 3px; - cursor: pointer; - - &:hover { - font-weight: bold; - } - } - - .hint-item:not(:last-child) { - margin-right: 8px; - } - - .hint-item.color-green { - color: black; - background-color: @tab-green; - - &:hover { - color: white; - } - } - - .hint-item.color-white { - color: black; - background-color: @term-white; - - &:hover { - background-color: @term-bright-white; - } - } } textarea { @@ -2613,38 +2615,39 @@ input[type=checkbox] { } .modal.alert-modal { - .modal-card { - min-width: 350px; - max-width: 640px; - width: auto; - - header { - padding: 10px; - font-size: 1.5rem; - } - - footer { - padding: 10px; - justify-content: center; + footer { + justify-content: center; + + .button { + margin-left: 20px; } - .modal-card-body { - padding: 10px; - - p { - text-align: center; - } + .button:first-child { + margin-left: 0; } } } -.modal.welcome-modal { +.modal.screen-settings-modal { + footer { + justify-content: center; + + .button { + margin-left: 20px; + } + + .button:first-child { + margin-left: 0; + } + } +} + +.modal.prompt-modal { .modal-content { - /* box-shadow: 5px 5px 5px #333; */ border-radius: 5px; border: 5px solid #333; } - + header { background-color: #000; display: flex; @@ -2672,7 +2675,7 @@ input[type=checkbox] { } } - .welcome-content { + .inner-content { background-color: #222; padding: 15px 10px 15px 10px; color: @term-white; @@ -2692,7 +2695,11 @@ input[type=checkbox] { background-color: #222; padding: 15px 10px 10px 10px; border-top: 1px solid #666; + } +} +.modal.welcome-modal { + footer { .prev-button { margin-left: 15px; width: 100px; @@ -2730,3 +2737,37 @@ input[type=checkbox] { flex-grow: 1; } +.cmd-hints { + .mono-font(10px); + display: flex; + flex-direction: row; + + .hint-item { + padding: 0px 5px 0px 5px; + border-radius: 0 0 3px 3px; + cursor: pointer; + } + + .hint-item:not(:last-child) { + margin-right: 8px; + } + + .hint-item.color-green { + color: black; + background-color: @tab-green; + + &:hover { + color: white; + } + } + + .hint-item.color-white { + color: black; + background-color: @term-white; + + &:hover { + background-color: @term-bright-white; + } + } +} +