Skip to content

Commit 41acf9a

Browse files
committed
Polish up overall Frida config layout
1 parent feb78da commit 41acf9a

File tree

2 files changed

+61
-23
lines changed

2 files changed

+61
-23
lines changed

src/components/intercept/config/frida-config.tsx

Lines changed: 50 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ import { IconButton } from '../../common/icon-button';
2121

2222
const ConfigContainer = styled.div`
2323
user-select: text;
24-
max-height: 440px;
2524
2625
height: 100%;
27-
width: 100%;
26+
max-height: 390px;
2827
display: flex;
2928
flex-direction: column;
3029
justify-content: start;
3130
31+
margin: 5px -15px -15px -15px;
32+
width: calc(100% + 30px);
33+
3234
> p {
3335
line-height: 1.2;
3436
@@ -50,32 +52,59 @@ const ConfigContainer = styled.div`
5052
}
5153
`;
5254

53-
const BackAndSearchBlock = styled.div`
54-
margin: 5px -15px 0;
55+
const FridaTargetList = styled(InterceptionTargetList)`
56+
padding: 10px 0;
57+
margin: 0;
58+
`;
5559

60+
const SelectedHostBlock = styled.div`
5661
display: flex;
5762
flex-direction: row;
5863
align-items: stretch;
5964
6065
z-index: 1;
6166
box-shadow: 0 0 5px 2px rgba(0,0,0,${p => p.theme.boxShadowAlpha});
67+
`;
6268

69+
const SelectedHostName = styled.h2`
70+
height: 34px;
71+
flex-grow: 1;
72+
73+
line-height: 32px;
74+
text-align: center;
75+
76+
overflow: hidden;
77+
white-space: nowrap;
78+
text-overflow: ellipsis;
6379
`;
6480

6581
const BackButton = styled(IconButton).attrs(() => ({
6682
icon: ['fas', 'arrow-left'],
6783
title: 'Jump to this request on the View page'
6884
}))`
6985
font-size: ${p => p.theme.textSize};
70-
padding: 2px 10px 0;
86+
padding: 0 10px;
7187
`;
7288

73-
const SearchBox = styled(TextInput)`
74-
flex-grow: 1;
89+
// Spacer - used to center align the name despite the back button
90+
const NameSpacer = styled.div`
91+
flex-basis: 34px;
92+
flex-shrink: 999;
93+
min-width: 5px;
94+
`;
7595

76-
border: none;
96+
const SearchBox = styled(TextInput)`
97+
border-style: solid;
98+
border-width: 1px 0 1px 0;
99+
border-color: ${p => p.theme.inputHoverBackground};
77100
border-radius: 0;
101+
78102
padding: 10px 10px 8px;
103+
104+
:focus {
105+
outline: none;
106+
border-color: ${p => p.theme.inputBorder};
107+
}
79108
`;
80109

81110
@inject('proxyStore')
@@ -227,16 +256,18 @@ class FridaConfig extends React.Component<{
227256
);
228257

229258
return <ConfigContainer>
230-
<BackAndSearchBlock>
259+
<SelectedHostBlock>
231260
<BackButton onClick={this.deselectHost} />
232-
<SearchBox
233-
value={this.searchInput}
234-
onChange={this.onSearchChange}
235-
placeholder='Search for a target...'
236-
autoFocus={true}
237-
/>
238-
</BackAndSearchBlock>
239-
<InterceptionTargetList
261+
<SelectedHostName>{ selectedHost.name }</SelectedHostName>
262+
<NameSpacer />
263+
</SelectedHostBlock>
264+
<SearchBox
265+
value={this.searchInput}
266+
onChange={this.onSearchChange}
267+
placeholder='Search for a target...'
268+
autoFocus={true}
269+
/>
270+
<FridaTargetList
240271
spinnerText='Scanning for apps to intercept...'
241272
targets={targets.map(target => {
242273
const { id, name } = target;
@@ -248,9 +279,7 @@ class FridaConfig extends React.Component<{
248279
status: activating
249280
? 'activating'
250281
: 'available',
251-
content: <p>
252-
{ name }
253-
</p>
282+
content: name
254283
};
255284
})
256285
}
@@ -261,7 +290,7 @@ class FridaConfig extends React.Component<{
261290
}
262291

263292
return <ConfigContainer>
264-
<InterceptionTargetList
293+
<FridaTargetList
265294
spinnerText={`Waiting for ${this.deviceClassName} devices to attach to...`}
266295
targets={this.fridaHosts.map(host => {
267296
const { id, name, state } = host;

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const Spinner = styled(Icon).attrs(() => ({
2929

3030
const ListScrollContainer = styled.div`
3131
overflow-y: auto;
32+
overscroll-behavior: contain;
33+
3234
margin: 10px -15px;
3335
flex-grow: 1;
3436
flex-shrink: 1;
@@ -98,14 +100,21 @@ type TargetItem = {
98100

99101
@observer
100102
export class InterceptionTargetList extends React.Component<{
103+
className?: string,
101104
spinnerText: string,
102105
targets: TargetItem[],
103106
interceptTarget: (id: string) => void,
104107
ellipseDirection: 'left' | 'right'
105108
}> {
106109

107110
render() {
108-
const { spinnerText, targets, interceptTarget, ellipseDirection } = this.props;
111+
const {
112+
className,
113+
spinnerText,
114+
targets,
115+
interceptTarget,
116+
ellipseDirection
117+
} = this.props;
109118

110119
if (targets.length === 0) {
111120
return <SpinnerBlock>
@@ -114,7 +123,7 @@ export class InterceptionTargetList extends React.Component<{
114123
</SpinnerBlock>
115124
}
116125

117-
return <ListScrollContainer>
126+
return <ListScrollContainer className={className}>
118127
<TargetList>
119128
{ _.map(targets, (target: TargetItem) => <Target key={target.id}>
120129
<TargetButton

0 commit comments

Comments
 (0)