File size: 1,335 Bytes
a61ba58 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
import React from "react";
import { Box, Paper } from "@mui/material";
// Composant pour afficher du JSON avec coloration syntaxique
const JsonView = ({ data, maxHeight = "500px" }) => (
<Box
sx={{
backgroundColor: "grey.900",
p: 2,
borderRadius: 1,
position: "relative",
}}
>
<Box
sx={{
maxHeight,
overflow: "auto",
fontFamily: "monospace",
"&::-webkit-scrollbar": {
width: "8px",
height: "8px",
},
"&::-webkit-scrollbar-track": {
backgroundColor: "grey.800",
borderRadius: "4px",
},
"&::-webkit-scrollbar-thumb": {
backgroundColor: "grey.600",
borderRadius: "4px",
"&:hover": {
backgroundColor: "grey.500",
},
},
"& pre": {
margin: 0,
color: "success.light",
fontSize: "0.75rem",
whiteSpace: "pre-wrap",
wordBreak: "break-word",
},
}}
>
<pre>{JSON.stringify(data, null, 2)}</pre>
</Box>
</Box>
);
export const DebugConsole = ({ gameState, currentStory }) => {
return (
<Paper variant="outlined" sx={{ height: "calc(100vh - 100px)" }}>
<JsonView data={{ gameState, currentStory }} maxHeight="100%" />
</Paper>
);
};
|