From 91d7ebf815b4a2372fcb89a89e0c42d1e342ef96 Mon Sep 17 00:00:00 2001 From: Michele Alberti <michele.alberti@cea.fr> Date: Wed, 20 May 2020 14:30:16 +0200 Subject: [PATCH] [ivette] Put history count on the right of arrows, with width. --- ivette/src/renderer/Controller.tsx | 33 ++++++++++++++---------------- ivette/src/renderer/style.css | 2 +- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/ivette/src/renderer/Controller.tsx b/ivette/src/renderer/Controller.tsx index 700b22beca7..d463bdbac3b 100644 --- a/ivette/src/renderer/Controller.tsx +++ b/ivette/src/renderer/Controller.tsx @@ -78,10 +78,10 @@ function buildServerConfig(argv: string[], cwd?: string) { function insertConfig(hs: string[], cfg: Server.Configuration) { const cmd = dumpServerConfig(cfg).trim(); - const newhs = hs - .map((h) => h.trim()) - .filter((h: string) => h !== cmd && h !== '') - .slice(0, 50); + const newhs = + hs.map((h) => h.trim()) + .filter((h: string) => h !== cmd && h !== '') + .slice(0, 50); newhs.unshift(cmd); return newhs; } @@ -232,20 +232,9 @@ const RenderConsole = () => { const edited = 0 <= cursor; const n = history.length; - let LABEL: string | JSX.Element = 'Console'; - if (edited) { - LABEL = ( - <Label title="History (last command comes first)"> - Command - <span className="controller-rank"> - {1 + cursor} / {n} - </span> - </Label> - ); - } return ( <> - <TitleBar label={LABEL}> + <TitleBar label={edited ? 'Command line' : 'Console'}> <IconButton icon="TRASH" display={edited} @@ -273,18 +262,26 @@ const RenderConsole = () => { title="Next command" /> <Space /> + <Label + className="controller-rank" + title="History (last command first)" + display={edited} + > + {1 + cursor} / {n} + </Label> + <Space /> <IconButton icon="MEDIA.PLAY" display={edited} disabled={isEmpty} onClick={doExec} - title="Execute Command" + title="Execute command" /> <IconButton icon="TERMINAL" selected={edited} onClick={doSwitch} - title="Edit Command" + title="Toggle command line editing" /> </TitleBar> <Text diff --git a/ivette/src/renderer/style.css b/ivette/src/renderer/style.css index 783b1386ebf..9b3d079f492 100644 --- a/ivette/src/renderer/style.css +++ b/ivette/src/renderer/style.css @@ -4,7 +4,7 @@ .controller-rank { color: #888 ; - margin-left: 12px ; + min-width: 50px; } /* -------------------------------------------------------------------------- */ -- GitLab