Skip to content

Commit a4edfa4

Browse files
Match old button cluster to right hand side of serial header
1 parent 8100d23 commit a4edfa4

1 file changed

Lines changed: 61 additions & 51 deletions

File tree

src/serial/SerialPanel.tsx

Lines changed: 61 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,8 @@ const SerialPanel = ({
198198

199199
const activeIndex = Math.max(0, sources.indexOf(activeTarget));
200200
const active = sources[activeIndex];
201-
const activeConnection = active === "simulator" && simulator ? simulator : device;
201+
const activeConnection =
202+
active === "simulator" && simulator ? simulator : device;
202203

203204
const sendCommand = (data: string) => {
204205
onSizeChange("open");
@@ -271,7 +272,7 @@ const SerialPanel = ({
271272
fontWeight="medium"
272273
fontSize="sm"
273274
px={3}
274-
py={2}
275+
alignSelf="stretch"
275276
borderBottomWidth={2}
276277
borderColor="transparent"
277278
backgroundColor={sourceBackground(source)}
@@ -290,13 +291,12 @@ const SerialPanel = ({
290291
);
291292
})}
292293
</TabList>
293-
<HStack spacing="0.5" pr={1} color="white">
294+
<HStack color="white">
294295
{showDeviceSync ? (
295296
<Text
296297
display="inline-flex"
297298
alignItems="center"
298299
whiteSpace="nowrap"
299-
pr={1}
300300
>
301301
<FormattedMessage
302302
id={
@@ -317,7 +317,7 @@ const SerialPanel = ({
317317
/>
318318
</Text>
319319
) : compactTraceback ? (
320-
<HStack spacing={1} pr={1} maxW="20rem" overflow="hidden">
320+
<HStack spacing={1} maxW="20rem" overflow="hidden">
321321
<Icon
322322
as={RiErrorWarningLine}
323323
fill="white"
@@ -364,50 +364,54 @@ const SerialPanel = ({
364364
id: compact ? "serial-expand" : "serial-collapse",
365365
})}
366366
/>
367-
{showHintsAndTips && (
368-
<IconButton
369-
variant="sidebar"
370-
color="white"
371-
isRound
372-
aria-label={intl.formatMessage({ id: "serial-hints-and-tips" })}
373-
icon={<RiInformationLine />}
374-
onClick={() => {
375-
logging.event({ type: "serial-info" });
376-
helpDisclosure.onOpen();
377-
}}
378-
/>
379-
)}
380-
<Menu placement={compact ? "top-end" : undefined}>
381-
<MenuButton
382-
as={IconButton}
383-
aria-label={intl.formatMessage({ id: "serial-menu" })}
384-
variant="sidebar"
385-
color="white"
386-
isRound
387-
icon={<MdMoreVert />}
388-
/>
389-
<Portal>
390-
<MenuList zIndex={zIndexAboveTerminal}>
391-
<MenuItem icon={<RiKeyboardBoxLine />} onClick={interrupt}>
392-
<FormattedMessage id="serial-ctrl-c-action" />
393-
</MenuItem>
394-
<MenuItem icon={<RiKeyboardBoxLine />} onClick={reset}>
395-
<FormattedMessage id="serial-ctrl-d-action" />
396-
</MenuItem>
397-
{!showHintsAndTips && (
398-
<>
399-
<MenuDivider />
400-
<MenuItem
401-
icon={<RiInformationLine />}
402-
onClick={helpDisclosure.onOpen}
403-
>
404-
<FormattedMessage id="serial-hints-and-tips" />
405-
</MenuItem>
406-
</>
407-
)}
408-
</MenuList>
409-
</Portal>
410-
</Menu>
367+
<HStack spacing="0.5">
368+
{showHintsAndTips && (
369+
<IconButton
370+
variant="sidebar"
371+
color="white"
372+
isRound
373+
aria-label={intl.formatMessage({
374+
id: "serial-hints-and-tips",
375+
})}
376+
icon={<RiInformationLine />}
377+
onClick={() => {
378+
logging.event({ type: "serial-info" });
379+
helpDisclosure.onOpen();
380+
}}
381+
/>
382+
)}
383+
<Menu placement={compact ? "top-end" : undefined}>
384+
<MenuButton
385+
as={IconButton}
386+
aria-label={intl.formatMessage({ id: "serial-menu" })}
387+
variant="sidebar"
388+
color="white"
389+
isRound
390+
icon={<MdMoreVert />}
391+
/>
392+
<Portal>
393+
<MenuList zIndex={zIndexAboveTerminal}>
394+
<MenuItem icon={<RiKeyboardBoxLine />} onClick={interrupt}>
395+
<FormattedMessage id="serial-ctrl-c-action" />
396+
</MenuItem>
397+
<MenuItem icon={<RiKeyboardBoxLine />} onClick={reset}>
398+
<FormattedMessage id="serial-ctrl-d-action" />
399+
</MenuItem>
400+
{!showHintsAndTips && (
401+
<>
402+
<MenuDivider />
403+
<MenuItem
404+
icon={<RiInformationLine />}
405+
onClick={helpDisclosure.onOpen}
406+
>
407+
<FormattedMessage id="serial-hints-and-tips" />
408+
</MenuItem>
409+
</>
410+
)}
411+
</MenuList>
412+
</Portal>
413+
</Menu>
414+
</HStack>
411415
</HStack>
412416
</HStack>
413417
{/* Terminals are stacked and toggled with visibility (never
@@ -459,13 +463,19 @@ const SerialPanel = ({
459463
onChange={reportState}
460464
/>
461465
<TerminalContext>
462-
<TerminalRegistrar source="simulator" registry={terminals} />
466+
<TerminalRegistrar
467+
source="simulator"
468+
registry={terminals}
469+
/>
463470
{terminal}
464471
</TerminalContext>
465472
</DeviceContextProvider>
466473
) : (
467474
<>
468-
<SourceStateReporter source="device" onChange={reportState} />
475+
<SourceStateReporter
476+
source="device"
477+
onChange={reportState}
478+
/>
469479
<TerminalContext>
470480
<TerminalRegistrar source="device" registry={terminals} />
471481
{terminal}

0 commit comments

Comments
 (0)