xmr-btc-swap/src-gui/src/renderer/components/modal/feedback/LogViewer.tsx
Mohan 7d019bfb30
feat(gui): Partially available global state (#593)
* feat(gui): Partially availiable global state

* move tauri command into own module

* move commands list into src-tauri/src/commands.rs

* cleanup swap/src/cli/api.rs

* add contextRequirement attribute to PromiseInvokeButton

* amend

* allow wallet operation on partially availiable context

* improvements

* fix some linter errors

* limit amount of logs to 5k

* keep behaviour from before

* make sure if swapId is null useActiveSwapLogs, return no logs

* remove unused variable

* create ContextStatusType enum
2025-10-02 21:28:12 +02:00

85 lines
2 KiB
TypeScript

import {
Box,
Button,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
Paper,
Switch,
Typography,
} from "@mui/material";
import CliLogsBox from "renderer/components/other/RenderedCliLog";
import { HashedLog } from "store/features/logsSlice";
interface LogViewerProps {
open: boolean;
setOpen: (_: boolean) => void;
logs: HashedLog[];
setIsRedacted: (_: boolean) => void;
isRedacted: boolean;
}
export default function LogViewer({
open,
setOpen,
logs,
setIsRedacted,
isRedacted,
}: LogViewerProps) {
return (
<Dialog open={open} onClose={() => setOpen(false)} fullWidth>
<DialogContent>
<Box>
<DialogContentText>
<Box
style={{
display: "flex",
flexDirection: "row",
alignItems: "center",
}}
>
<Typography>
These are the logs that would be attached to your feedback
message and provided to us developers. They help us narrow down
the problem you encountered.
</Typography>
</Box>
</DialogContentText>
<CliLogsBox
label="Logs"
logs={logs}
topRightButton={
<Paper
style={{
display: "flex",
justifyContent: "flex-end",
alignItems: "center",
paddingLeft: "0.5rem",
}}
variant="outlined"
>
Redact
<Switch
color="primary"
checked={isRedacted}
onChange={(_, checked: boolean) => setIsRedacted(checked)}
/>
</Paper>
}
/>
</Box>
</DialogContent>
<DialogActions>
<Button
variant="contained"
color="primary"
onClick={() => setOpen(false)}
>
Close
</Button>
</DialogActions>
</Dialog>
);
}