-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a655833
commit 5209ed4
Showing
19 changed files
with
226 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { KeyboardArrowDownOutlined } from "@mui/icons-material"; | ||
import { Box, Button, ButtonProps } from "@mui/material"; | ||
import { Props } from "./FeaturePicker"; | ||
|
||
export function FeaturePickerButton({ | ||
children, | ||
icon, | ||
showArrow, | ||
...props | ||
}: ButtonProps & Pick<Props, "icon" | "showArrow">) { | ||
return ( | ||
<Button | ||
{...props} | ||
startIcon={icon} | ||
endIcon={ | ||
showArrow && ( | ||
<KeyboardArrowDownOutlined | ||
sx={{ | ||
ml: -0.5, | ||
color: "text.primary", | ||
opacity: (t) => | ||
props.disabled ? t.palette.action.disabledOpacity : 1, | ||
}} | ||
/> | ||
) | ||
} | ||
> | ||
<Box | ||
sx={{ | ||
color: "text.primary", | ||
opacity: (t) => | ||
props.disabled ? t.palette.action.disabledOpacity : 1, | ||
}} | ||
> | ||
{children} | ||
</Box> | ||
</Button> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
client/src/components/layer-editor/layers/TracePreview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { Box } from "@mui/material"; | ||
import { ScriptViewer } from "components/script-editor/ScriptEditor"; | ||
import beautify from "json-beautify"; | ||
import { take } from "lodash"; | ||
import { Trace } from "protocol"; | ||
|
||
export function TracePreview({ | ||
trace, | ||
language = "json", | ||
}: { | ||
trace?: Trace; | ||
language?: string; | ||
}) { | ||
return ( | ||
<Box sx={{ width: "100%", height: "100%" }}> | ||
<ScriptViewer | ||
options={{ readOnly: true }} | ||
language={language} | ||
value={ | ||
trace | ||
? beautify( | ||
{ | ||
...trace, | ||
events: take(trace.events, 10), | ||
}, | ||
null as any, | ||
2, | ||
1 | ||
) | ||
: "No data" | ||
} | ||
/> | ||
</Box> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.