Skip to content

Commit b280be9

Browse files
committed
testing out a single pane UX
1 parent 0b07b69 commit b280be9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1177
-887
lines changed

packages/selenium-ide/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "selenium-ide",
3-
"version": "4.0.1-alpha.72",
3+
"version": "4.0.1-alpha.73",
44
"private": false,
55
"description": "Selenium IDE electron app",
66
"author": "Todd <[email protected]>",
@@ -111,7 +111,7 @@
111111
"@seleniumhq/code-export-python-pytest": "^4.0.0-alpha.4",
112112
"@seleniumhq/code-export-ruby-rspec": "^4.0.0-alpha.3",
113113
"@seleniumhq/get-driver": "^4.0.0-alpha.3",
114-
"@seleniumhq/side-api": "^4.0.0-alpha.41",
114+
"@seleniumhq/side-api": "^4.0.0-alpha.42",
115115
"@seleniumhq/side-commons": "^4.0.0-alpha.2",
116116
"@seleniumhq/side-model": "^4.0.0-alpha.5",
117117
"@seleniumhq/side-runtime": "^4.0.0-alpha.35",
@@ -126,6 +126,7 @@
126126
"react-dnd": "^16.0.1",
127127
"react-dnd-html5-backend": "^16.0.1",
128128
"react-dom": "^18.2.0",
129+
"react-resizable-panels": "^1.0.8",
129130
"scroll-into-view-if-needed": "^3.0.10",
130131
"selenium-webdriver": "^4.16.0",
131132
"side-code-export": "^4.0.0-alpha.13",

packages/selenium-ide/src/browser/components/ReorderableList.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,10 @@ import List, { ListProps } from '@mui/material/List'
33
import React, { FC } from 'react'
44

55
export type ReorderableListProps = ListProps & TableBodyProps & {
6-
bottomOffset: number
76
Component?: React.FC | React.ComponentClass
87
}
98

109
const ReorderableList: FC<ReorderableListProps> = ({
11-
bottomOffset,
1210
children,
1311
Component = List,
1412
sx = {},
@@ -18,7 +16,6 @@ const ReorderableList: FC<ReorderableListProps> = ({
1816
dense
1917
sx={{
2018
borderColor: 'primary.main',
21-
marginBottom: `${bottomOffset}px`,
2219
verticalAlign: 'top',
2320
...sx,
2421
}}

packages/selenium-ide/src/browser/helpers/preload-electron.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ export const cb = (isWebdriver: boolean) => () => new Promise<void>((resolve) =>
3030
})
3131
});
3232

33-
export default preload(api, cb(false))
33+
export default () => preload(api, cb(false))

packages/selenium-ide/src/browser/helpers/preload.ts

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,60 @@ export type NestedPartial<API> = {
2424
: API[K]
2525
}
2626

27-
export default (api: Api, ...cbs: (() => void)[]) =>
28-
async (
29-
apiSubset: NestedPartial<Api> & {
30-
mutators: NestedPartial<BrowserApiMutators>
31-
} = {
32-
...api,
33-
mutators,
34-
},
35-
) => {
36-
window.sideAPI = apiSubset as Api & { mutators: BrowserApiMutators }
37-
if (cbs?.length) {
38-
for (const cb of cbs) {
39-
await cb()
40-
}
27+
function isDictionary(obj: any): obj is Record<string, unknown> {
28+
if (typeof obj !== 'object' || obj === null) {
29+
return false
30+
}
31+
32+
for (const key in obj) {
33+
if (typeof key !== 'string') {
34+
return false
35+
}
36+
}
37+
38+
return true
39+
}
40+
41+
function getApiSubset(
42+
originalObj: any,
43+
nestedSubset: any
44+
): Record<string, any> | undefined {
45+
if (!isDictionary(originalObj)) {
46+
return originalObj
47+
}
48+
if (!isDictionary(nestedSubset)) {
49+
return undefined
50+
}
51+
const results: Record<string, any> = {}
52+
for (const key in nestedSubset) {
53+
const result = getApiSubset(originalObj[key], nestedSubset[key])
54+
if (result === undefined) {
55+
results[key] = originalObj[key]
56+
} else {
57+
results[key] = result
4158
}
59+
}
60+
return results
61+
}
62+
63+
type ApiWithMutators = Api & {
64+
mutators: BrowserApiMutators
65+
}
4266

43-
return cbs.reduce((acc, cb) => () => {
44-
acc()
45-
cb()
46-
})
67+
export default async (api: NestedPartial<Api>, ...cbs: (() => void)[]) => {
68+
window.sideAPI = {
69+
...api,
70+
mutators: getApiSubset(mutators, api),
71+
} as ApiWithMutators
72+
console.log(api, mutators, getApiSubset(mutators, api))
73+
if (cbs?.length) {
74+
for (const cb of cbs) {
75+
await cb()
76+
}
4777
}
78+
79+
return cbs.reduce((acc, cb) => () => {
80+
acc()
81+
cb()
82+
})
83+
}

packages/selenium-ide/src/browser/hooks/useKeyboundNav.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { useEffect } from 'react'
33

44
export interface useKeyboundNavInput {
55
activeSuite: string
6-
bottomOffset: number
76
selectedIndexes: number[]
87
tests: TestShape[]
98
}

packages/selenium-ide/src/browser/index.css

Lines changed: 44 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,19 @@ body,
1414
box-sizing: border-box;
1515
}
1616

17+
.resize-bar {
18+
background-color: #999;
19+
min-height: 4px;
20+
min-width: 4px;
21+
}
22+
1723
@media (prefers-color-scheme: dark) {
1824
html, body, #root {
1925
background-color: #111;
2026
}
27+
.resize-bar {
28+
background-color: #666;
29+
}
2130
}
2231

2332
/**
@@ -53,17 +62,22 @@ body,
5362
opacity: 0.75;
5463
}
5564

65+
.block {
66+
display: block;
67+
}
5668
/**
5769
* Flexbox
5870
*/
5971
.flex {
6072
display: flex !important;
6173
}
6274
.flex-1 {
75+
display: flex;
6376
min-height: 0;
6477
flex: 1 1 1px;
6578
}
6679
.flex-initial {
80+
display: flex;
6781
flex: 0 0 auto;
6882
}
6983
.flex-col {
@@ -89,6 +103,14 @@ body,
89103
.no-overflow-y {
90104
overflow-y: hidden;
91105
}
106+
.no-overflow-x {
107+
overflow-x: hidden;
108+
}
109+
.text-overflow {
110+
display: block;
111+
text-overflow: ellipsis;
112+
overflow-x: hidden;
113+
}
92114

93115
/**
94116
* Height
@@ -162,29 +184,38 @@ body,
162184
/**
163185
* Padding
164186
*/
165-
.pt-0 {
166-
padding-top: 0;
167-
}
168-
169187
.p-1 {
170188
padding: 0.125rem;
171189
}
172-
173-
.py-3 {
174-
padding-bottom: 0.5rem;
175-
padding-top: 0.5rem;
190+
.p-2 {
191+
padding: 0.25rem;
192+
}
193+
.p-3 {
194+
padding: 0.5rem;
176195
}
177-
178196
.p-4 {
179197
padding: 1rem;
180198
}
199+
.p-5 {
200+
padding: 2rem;
201+
}
202+
.pb-0 {
203+
padding-bottom: 0 !important;
204+
}
205+
.pt-0 {
206+
padding-top: 0 !important;
207+
}
181208
.pt-4 {
182209
padding-top: 1rem;
183210
}
184211
.px-4 {
185212
padding-left: 1rem;
186213
padding-right: 1rem;
187214
}
215+
.py-3 {
216+
padding-bottom: 0.5rem;
217+
padding-top: 0.5rem;
218+
}
188219
.py-4 {
189220
padding-bottom: 1rem;
190221
padding-top: 1rem;
@@ -268,12 +299,6 @@ body,
268299
padding-top: 14px;
269300
}
270301

271-
.playback-text {
272-
position: absolute;
273-
top: 45%;
274-
padding: 24px;
275-
}
276-
277302
/*
278303
* Playback command overlay colors
279304
*/
@@ -316,6 +341,10 @@ body,
316341
border-bottom: 0 !important;
317342
}
318343

344+
.square {
345+
border-radius: 0;
346+
}
347+
319348
/*
320349
* Stealing from here:
321350
* https://codepen.io/fahimfoysal/pen/wvpKjKq
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const SIDELogger: React.FC = () => {
1616
logContainer.current?.append(
1717
`${new Date().toLocaleTimeString()} [${level}] ${log}\n`
1818
)
19+
console.log(logContainer.current?.scrollHeight)
1920
window.scrollTo(0, logContainer.current?.scrollHeight ?? 0)
2021
}
2122
window.sideAPI.system.onLog.addListener(handleLog)
@@ -25,9 +26,8 @@ const SIDELogger: React.FC = () => {
2526
}, [logContainer])
2627
return (
2728
<>
28-
<pre ref={logContainer} style={consoleStyle} />
29-
<div className="p-1 pos-fixed" style={{ top: 0, right: 0 }}>
30-
<Paper className="p-1" elevation={3}>
29+
<div className="p-1 pos-abs" style={{ top: 0, right: 0 }}>
30+
<Paper className="p-1" elevation={3} square>
3131
<IconButton
3232
onClick={() => {
3333
if (logContainer.current) {
@@ -39,6 +39,11 @@ const SIDELogger: React.FC = () => {
3939
</IconButton>
4040
</Paper>
4141
</div>
42+
<pre
43+
className="fill overflow-y"
44+
ref={logContainer}
45+
style={consoleStyle}
46+
/>
4247
</>
4348
)
4449
}

packages/selenium-ide/src/browser/windows/Logger/renderer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import AppWrapper from 'browser/components/AppWrapper'
33
import renderWhenReady from 'browser/helpers/renderWhenReady'
4-
import SIDELogger from './components/Logger'
4+
import SIDELogger from './main'
55

66
const ProjectPlaybackControls = () =>(
77
<AppWrapper>
Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
import { WindowConfig } from 'browser/types'
2-
import Electron from 'electron'
32

4-
const dimensions = {
5-
height: 600,
6-
width: 800,
7-
}
8-
export const window: WindowConfig['window'] = () => {
9-
const display = Electron.screen.getPrimaryDisplay()
10-
return {
11-
...dimensions,
12-
x:
13-
Math.floor(display.bounds.width / 2) -
14-
Math.floor(dimensions.width / 2) -
15-
275,
16-
y:
17-
Math.floor(display.bounds.height / 2) -
18-
Math.floor(dimensions.height / 2) -
19-
50,
20-
title: 'Playback Window',
21-
}
22-
}
3+
export const window: WindowConfig['window'] = () => ({
4+
title: 'Playback Window',
5+
resizable: false,
6+
})
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Box from '@mui/material/Box'
2+
import Paper from '@mui/material/Paper'
3+
import Typography from '@mui/material/Typography'
4+
import React from 'react'
5+
6+
const ProjectPlaybackWindow = () => (
7+
<Box className="fill flex flex-col pos-rel">
8+
<Box className="flex flex-1 width-100" />
9+
<Paper className="flex flex-initial p-5 width-100">
10+
<Box className="block width-100">
11+
<Typography align="center" variant="subtitle1">
12+
This is where recording and playback will occur
13+
</Typography>
14+
</Box>
15+
</Paper>
16+
<Box className="flex flex-1 width-100" />
17+
</Box>
18+
)
19+
20+
export default ProjectPlaybackWindow

0 commit comments

Comments
 (0)