Skip to content

Commit cb29157

Browse files
committed
Improve ADB setup UX for one/zero connected devices
Currently it's not usually possible to see the UI when only one device is connected, but we might enable this in future, since it makes it easier to tell what's going on (and lead users to the docs if required).
1 parent 2c4ce54 commit cb29157

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

src/components/intercept/config/android-adb-config.tsx

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ const ConfigContainer = styled.div`
4646
}
4747
`;
4848

49+
const Footer = styled.p`
50+
font-size: 85%;
51+
font-style: italic;
52+
`;
4953

5054
@inject('proxyStore')
5155
@inject('rulesStore')
@@ -81,12 +85,35 @@ class AndroidAdbConfig extends React.Component<{
8185

8286
render() {
8387
return <ConfigContainer>
84-
<p>
85-
There are multiple ADB devices connected.
86-
</p>
87-
<p>
88-
Pick which device you'd like to intercept:
89-
</p>
88+
{ this.deviceIds.length > 1
89+
? <>
90+
<p>
91+
There are multiple ADB devices connected.
92+
</p>
93+
<p>
94+
Pick which device you'd like to intercept:
95+
</p>
96+
</>
97+
: this.deviceIds.length === 1
98+
// Should only happen if a device disappears after UI opens, due to
99+
// componentDidMount auto-setup for the single-device case.
100+
? <>
101+
<p>
102+
There is one ADB device connected.
103+
</p>
104+
<p>
105+
Select the device below to begin setup:
106+
</p>
107+
</>
108+
// No devices connected:
109+
: <>
110+
<p>
111+
There are no ADB devices connected.
112+
</p>
113+
<p>
114+
Connect an Android device to ADB to begin setup.
115+
</p>
116+
</> }
90117

91118
<InterceptionTargetList
92119
spinnerText='Waiting for Android devices to intercept...'
@@ -110,6 +137,12 @@ class AndroidAdbConfig extends React.Component<{
110137
interceptTarget={this.interceptDevice}
111138
ellipseDirection='right'
112139
/>
140+
141+
<Footer>
142+
Take a look at <a
143+
href="https://httptoolkit.com/docs/guides/android/"
144+
>the Android docs</a> for a detailed setup guide.
145+
</Footer>
113146
</ConfigContainer>;
114147
}
115148

src/components/intercept/config/intercept-target-list.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ import { Button } from '../../common/inputs';
99

1010
const SpinnerBlock = styled.div`
1111
text-align: center;
12+
flex-grow: 1;
13+
flex-shrink: 1;
14+
15+
display: flex;
16+
flex-direction: column;
17+
justify-content: center;
18+
align-items: center;
1219
`;
1320

1421
const Spinner = styled(Icon).attrs(() => ({
@@ -24,6 +31,8 @@ const ListScrollContainer = styled.div`
2431
max-height: 279px;
2532
overflow-y: auto;
2633
margin: 10px -15px;
34+
flex-grow: 1;
35+
flex-shrink: 1;
2736
`;
2837

2938
const TargetList = styled.ul`

0 commit comments

Comments
 (0)