@electerm/electerm-react 5.0.7 → 5.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ import './logo.styl'
9
9
 
10
10
  export default function LogoElem () {
11
11
  return (
12
- <h1 className='mg3y font50'>
12
+ <h1 className='logo-elem mg3y font50'>
13
13
  <span className='iblock pd3 morph-shape mg1l mg1r'>
14
14
  <img src={logoPath2} className='iblock mwm-100 mg1l mg1r logo-filter logo-img' />
15
15
  </span>
@@ -3,8 +3,14 @@
3
3
  .logo-img-small
4
4
  height 28px
5
5
  border-radius 28px
6
- @media (max-width: 500px)
6
+ // the h1 vertical margin so the logo stops dominating the no-session panel.
7
+ .is-mobile
8
+ .logo-elem
9
+ margin-top 8px
10
+ margin-bottom 8px
11
+ .morph-shape
12
+ padding 6px
7
13
  .logo-img
8
- height 40px
14
+ height 32px
9
15
  .logo-img-small
10
16
  height 20px
@@ -111,13 +111,19 @@ export default auto(function CmdHistory (props) {
111
111
  }
112
112
  return (
113
113
  <div className='cmd-history-header pd2b'>
114
- <Switch
115
- checkedChildren={e('sortByFrequency')}
116
- unCheckedChildren={e('sortByFrequency')}
117
- checked={sortByFrequency}
118
- onChange={handleSortByFrequencyChange}
119
- size='small'
120
- />
114
+ <div className='cmd-history-sort'>
115
+ <Switch
116
+ checked={sortByFrequency}
117
+ onChange={handleSortByFrequencyChange}
118
+ size='small'
119
+ />
120
+ <span
121
+ className='cmd-history-sort-label pointer'
122
+ onClick={() => handleSortByFrequencyChange(!sortByFrequency)}
123
+ >
124
+ {e('sortByFrequency')}
125
+ </span>
126
+ </div>
121
127
  <UnorderedListOutlined
122
128
  className='cmd-history-clear-icon pointer clear-ai-icon icon-hover'
123
129
  title={e('clear')}
@@ -17,6 +17,14 @@
17
17
  justify-content space-between
18
18
  padding-bottom 8px
19
19
 
20
+ .cmd-history-sort
21
+ display flex
22
+ align-items center
23
+ gap 6px
24
+
25
+ .cmd-history-sort-label
26
+ user-select none
27
+
20
28
  .cmd-history-clear-icon
21
29
  font-size 14px
22
30
  padding 4px
@@ -2,7 +2,7 @@
2
2
  * quick commands footer selection wrap
3
3
  */
4
4
 
5
- import { useState, useRef } from 'react'
5
+ import { useState } from 'react'
6
6
  import { quickCommandLabelsLsKey, pinnedQuickCommandBarKey } from '../../common/constants'
7
7
  import { sortBy } from 'lodash-es'
8
8
  import { Button, Input, Select, Space, Flex } from 'antd'
@@ -25,21 +25,6 @@ const { Option } = Select
25
25
  export default function QuickCommandsFooterBox (props) {
26
26
  const [keyword, setKeyword] = useState('')
27
27
  const [label, setLabel] = useState(ls.getItem(quickCommandLabelsLsKey, ''))
28
- const timer = useRef(null)
29
-
30
- function handleMouseLeave () {
31
- timer.current = setTimeout(() => {
32
- toggle(false)
33
- }, 500)
34
- }
35
-
36
- function handleMouseEnter () {
37
- clearTimeout(timer.current)
38
- }
39
-
40
- function toggle (openQuickCommandBar) {
41
- window.store.openQuickCommandBar = openQuickCommandBar
42
- }
43
28
 
44
29
  function handleTogglePinned () {
45
30
  const current = !window.store.pinnedQuickCommandBar
@@ -209,9 +194,7 @@ export default function QuickCommandsFooterBox (props) {
209
194
  className: 'qm-wrap-tooltip',
210
195
  style: {
211
196
  left: w
212
- },
213
- onMouseLeave: handleMouseLeave,
214
- onMouseEnter: handleMouseEnter
197
+ }
215
198
  }
216
199
  return (
217
200
  <div
@@ -1,5 +1,10 @@
1
1
  /**
2
2
  * quick commands footer selection
3
+ *
4
+ * Click to toggle the quick-command bar. Click-based so it works identically
5
+ * on touch (mobile) and mouse (desktop) — the old hover-to-open model was
6
+ * unreliable on Android, where a tap synthesizes mouseleave and cancels the
7
+ * open timer.
3
8
  */
4
9
 
5
10
  import { PureComponent } from 'react'
@@ -7,33 +12,18 @@ import { Button } from 'antd'
7
12
  import './qm.styl'
8
13
 
9
14
  export default class QuickCommandsFooter extends PureComponent {
10
- componentWillUnmount () {
11
- clearTimeout(this.timer)
12
- this.timer = null
13
- }
14
-
15
- handleOpen = () => {
16
- this.timer = setTimeout(this.act, 500)
17
- }
18
-
19
- act = () => {
20
- window.store.openQuickCommandBar = true
21
- }
22
-
23
- handleMouseLeave = () => {
24
- clearTimeout(this.timer)
15
+ handleClick = () => {
16
+ const { store } = window
17
+ store.openQuickCommandBar = !store.openQuickCommandBar
25
18
  }
26
19
 
27
20
  render () {
28
21
  return (
29
- <div
30
- className='fleft relative quick-command-trigger-wrap'
31
- onMouseEnter={this.handleOpen}
32
- onMouseLeave={this.handleMouseLeave}
33
- >
22
+ <div className='fleft relative quick-command-trigger-wrap'>
34
23
  <Button
35
24
  size='small'
36
25
  type='text'
26
+ onClick={this.handleClick}
37
27
  >
38
28
  Q
39
29
  </Button>
@@ -44,22 +44,25 @@ export default auto(function HistoryPanel (props) {
44
44
  }
45
45
  return (
46
46
  <div className='history-header pd2x pd2b'>
47
- <Switch
48
- {...switchProps}
49
- />
47
+ <div className='history-sort'>
48
+ <Switch
49
+ checked={sortByFrequency}
50
+ onChange={handleSortByFrequencyChange}
51
+ size='small'
52
+ />
53
+ <span
54
+ className='history-sort-label pointer'
55
+ onClick={() => handleSortByFrequencyChange(!sortByFrequency)}
56
+ >
57
+ {e('sortByFrequency')}
58
+ </span>
59
+ </div>
50
60
  <UnorderedListOutlined
51
61
  {...clearIconProps}
52
62
  />
53
63
  </div>
54
64
  )
55
65
  }
56
- const switchProps = {
57
- checkedChildren: e('sortByFrequency'),
58
- unCheckedChildren: e('sortByFrequency'),
59
- checked: sortByFrequency,
60
- onChange: handleSortByFrequencyChange,
61
- size: 'small'
62
- }
63
66
  const clearIconProps = {
64
67
  className: 'history-clear-icon pointer clear-ai-icon icon-hover',
65
68
  title: window.translate('clear'),
@@ -57,6 +57,12 @@
57
57
  top 0
58
58
  z-index 10
59
59
  background var(--main)
60
+ .history-sort
61
+ display flex
62
+ align-items center
63
+ gap 6px
64
+ .history-sort-label
65
+ user-select none
60
66
  .history-clear-icon
61
67
  margin-left auto
62
68
  margin-right 0
@@ -51,7 +51,7 @@ export default function NoSessionPanel ({ height, onNewTab, onNewSsh, batch }) {
51
51
  )}
52
52
  <QuickConnect batch={batch} />
53
53
  </div>
54
- <div className='pd3'>
54
+ <div className='no-session-logo'>
55
55
  <LogoElem />
56
56
  </div>
57
57
  <div className='no-session-history' onClick={handleClick}>
@@ -1,28 +1,51 @@
1
1
  .no-sessions
2
2
  background var(--main)
3
3
  text-align center
4
- padding 50px 0
4
+ // stack buttons / logo / history; the history flexes to fill the remaining
5
+ // height, so the layout adapts to logo size and button wrapping without any
6
+ // fixed pixel offsets.
7
+ display flex
8
+ flex-direction column
5
9
  position absolute
6
10
  top 36px
7
11
  left 0
8
12
  right 0
9
13
  bottom 0
14
+ padding 50px 0
10
15
  z-index 11
11
16
  .no-session-btns
17
+ flex-shrink 0
12
18
  display flex
13
19
  flex-wrap wrap
14
20
  justify-content center
15
21
  align-items center
16
22
  gap 8px
17
23
  padding-bottom 8px
24
+ .no-session-logo
25
+ flex-shrink 0
26
+ padding 32px 0
18
27
  .no-session-history
19
- position absolute
20
- top 320px
21
- bottom 80px
22
- left 0
23
- right 0
28
+ flex 1
29
+ min-height 0
30
+ display flex
31
+ flex-direction column
32
+ overflow hidden
24
33
  .sidebar-panel-history
25
- overflow-y auto
34
+ // override the global sidebar absolute positioning (top:112px) so the
35
+ // history fills this flex item instead.
36
+ position static
37
+ flex 1
38
+ min-height 0
26
39
  .pd2x
27
40
  width 400px
28
- margin 0 auto
41
+ margin 0 auto
42
+ .is-mobile
43
+ .no-sessions
44
+ padding 20px 0
45
+ .no-session-logo
46
+ padding 8px 0
47
+ .no-session-history
48
+ .sidebar-panel-history
49
+ .pd2x
50
+ width auto
51
+ max-width 400px
@@ -178,12 +178,21 @@
178
178
 
179
179
  // ---------------------------------------------------------------------------
180
180
  // Touch-primary devices only (feature-detected via pointer media query, not
181
- // UA sniffing or viewport width). iOS Safari and Android Chrome auto-zoom the
182
- // page when focusing an input with font-size < 16px, and never zoom back out
183
- // on blur, leaving the page stuck zoomed. Desktop browsers (even with
184
- // touchscreens or narrow windows) report pointer: fine and never force-zoom,
185
- // so this never matches them. Force 16px on all focusable form fields (antd
186
- // inputs default to 14px) to prevent the zoom.
181
+ // UA sniffing or viewport width). Desktop browsers (even with touchscreens or
182
+ // narrow windows) report pointer: fine, so this never matches them.
183
+ //
184
+ // 1. iOS Safari and Android Chrome auto-zoom the page when focusing an input
185
+ // with font-size < 16px, and never zoom back out on blur, leaving the page
186
+ // stuck zoomed. Force 16px on all focusable form fields (antd inputs default
187
+ // to 14px) to prevent the zoom.
188
+ //
189
+ // 2. Mobile browsers also inflate text to improve readability
190
+ // (-webkit-text-size-adjust defaults to auto). Inside a fixed-size container
191
+ // this makes the text taller than its wrapper, so it gets clipped — the
192
+ // clearest victim is the antd small Switch, whose track is only 16px tall /
193
+ // 28px wide with overflow:hidden; the "sort by frequency" label gets blown
194
+ // past the track and chopped. Pin to 100% so the declared font-size is
195
+ // honored.
187
196
  // ---------------------------------------------------------------------------
188
197
  @media (pointer: coarse)
189
198
  input,
@@ -194,3 +203,6 @@
194
203
  .ant-input-number-input,
195
204
  .ant-select-selection-search-input
196
205
  font-size 16px !important
206
+ html
207
+ -webkit-text-size-adjust 100%
208
+ text-size-adjust 100%
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@electerm/electerm-react",
3
- "version": "5.0.7",
3
+ "version": "5.0.8",
4
4
  "description": "react components src for electerm",
5
5
  "main": "./client/components/main/main.jsx",
6
6
  "license": "MIT",