Skip to content

Commit 469a004

Browse files
committed
style
1 parent 034906f commit 469a004

File tree

1 file changed

+38
-86
lines changed

1 file changed

+38
-86
lines changed

site/src/modules/resources/PortForwardButton.tsx

Lines changed: 38 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ import TextField from "@mui/material/TextField";
3535
import SensorsIcon from "@mui/icons-material/Sensors";
3636
import LockIcon from "@mui/icons-material/Lock";
3737
import LockOpenIcon from "@mui/icons-material/LockOpen";
38+
import IconButton from "@mui/material/IconButton";
39+
import CloseIcon from "@mui/icons-material/Close";
40+
import Grid from "@mui/material/Grid";
3841

3942
export interface PortForwardButtonProps {
4043
host: string;
@@ -215,8 +218,8 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
215218
<Stack
216219
key={port.port}
217220
direction="row"
218-
justifyContent="space-between"
219221
alignItems="center"
222+
justifyContent="space-between"
220223
>
221224
<Link
222225
underline="none"
@@ -228,6 +231,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
228231
<SensorsIcon css={{ width: 14, height: 14 }} />
229232
{label}
230233
</Link>
234+
<Stack direction="row" gap={2} justifyContent="flex-end" alignItems="center">
231235
<Link
232236
underline="none"
233237
css={styles.portLink}
@@ -240,6 +244,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
240244
<Button size="small" variant="text">
241245
Share
242246
</Button>
247+
</Stack>
243248
</Stack>
244249
);
245250
})}
@@ -252,9 +257,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
252257
>
253258
<HelpTooltipTitle>Shared Ports</HelpTooltipTitle>
254259
<HelpTooltipText css={{ color: theme.palette.text.secondary }}>
255-
{listeningPorts?.length === 0
256-
? "No ports are shared."
257-
: "Ports can be shared with other Coder users or with the public."}
260+
Ports can be shared with other Coder users or with the public.
258261
</HelpTooltipText>
259262
<div>
260263
{sharedPorts?.map((share) => {
@@ -287,27 +290,36 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
287290
)}
288291
{label}
289292
</Link>
290-
<Stack direction="row" gap={1}>
291-
<FormControl size="small">
292-
<Select
293-
sx={{
294-
boxShadow: "none",
295-
".MuiOutlinedInput-notchedOutline": { border: 0 },
296-
"&.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":
297-
{
298-
border: 0,
299-
},
300-
"&.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":
301-
{
302-
border: 0,
303-
},
304-
}}
305-
value={share.share_level}
306-
>
307-
<MenuItem value="Authenticated">Authenticated</MenuItem>
308-
<MenuItem value="Public">Public</MenuItem>
309-
</Select>
310-
</FormControl>
293+
<Stack direction="row" justifyContent="flex-end">
294+
<FormControl size="small">
295+
<Select
296+
sx={{
297+
boxShadow: "none",
298+
".MuiOutlinedInput-notchedOutline": { border: 0 },
299+
"&.MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline":
300+
{
301+
border: 0,
302+
},
303+
"&.MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline":
304+
{
305+
border: 0,
306+
},
307+
}}
308+
value={share.share_level}
309+
>
310+
<MenuItem value="authenticated">Authenticated</MenuItem>
311+
<MenuItem value="public">Public</MenuItem>
312+
</Select>
313+
</FormControl>
314+
<IconButton>
315+
<CloseIcon
316+
css={{
317+
width: 14,
318+
height: 14,
319+
color: theme.palette.text.primary,
320+
}}
321+
/>
322+
</IconButton>
311323
</Stack>
312324
</Stack>
313325
);
@@ -328,69 +340,9 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
328340
<MenuItem value="Public">Public</MenuItem>
329341
</Select>
330342
</FormControl>
331-
<Button variant="contained">Add Shared Port</Button>
343+
<Button variant="contained">Share Port</Button>
332344
</Stack>
333345
</div>
334-
335-
{/* <div css={{ padding: 20 }}>
336-
<HelpTooltipTitle>Forward port</HelpTooltipTitle>
337-
<HelpTooltipText css={{ color: theme.palette.text.secondary }}>
338-
Access ports running on the agent:
339-
</HelpTooltipText>
340-
341-
<form
342-
css={styles.newPortForm}
343-
onSubmit={(e) => {
344-
e.preventDefault();
345-
const formData = new FormData(e.currentTarget);
346-
const port = Number(formData.get("portNumber"));
347-
const url = portForwardURL(
348-
host,
349-
port,
350-
agent.name,
351-
workspaceName,
352-
username,
353-
);
354-
window.open(url, "_blank");
355-
}}
356-
>
357-
<input
358-
aria-label="Port number"
359-
name="portNumber"
360-
type="number"
361-
placeholder="Type a port number..."
362-
min={0}
363-
max={65535}
364-
required
365-
css={styles.newPortInput}
366-
/>
367-
<Button
368-
type="submit"
369-
size="small"
370-
variant="text"
371-
css={{
372-
paddingLeft: 12,
373-
paddingRight: 12,
374-
minWidth: 0,
375-
}}
376-
>
377-
<OpenInNewOutlined
378-
css={{
379-
flexShrink: 0,
380-
width: 14,
381-
height: 14,
382-
color: theme.palette.text.primary,
383-
}}
384-
/>
385-
</Button>
386-
</form>
387-
388-
<HelpTooltipLinksGroup>
389-
<HelpTooltipLink href={docs("/networking/port-forwarding#dashboard")}>
390-
Learn more
391-
</HelpTooltipLink>
392-
</HelpTooltipLinksGroup>
393-
</div> */}
394346
</>
395347
);
396348
};

0 commit comments

Comments
 (0)