aboutsummaryrefslogtreecommitdiffhomepage
path: root/frontend/src/pages/System/Logs/modal.tsx
blob: 2979097577eb071d66eeec4c6f7062c3f1e65b8a (plain)
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
import { withModal } from "@/modules/modals";
import { Code, Text } from "@mantine/core";
import { FunctionComponent, useMemo } from "react";

interface Props {
  stack: string;
}

const SystemLogModal: FunctionComponent<Props> = ({ stack }) => {
  const result = useMemo(
    () =>
      stack.split("\\n").map((v, idx) => (
        <Text my="xs" inherit key={idx}>
          {v}
        </Text>
      )),
    [stack],
  );

  return <Code block>{result}</Code>;
};

export default withModal(SystemLogModal, "system-log", {
  title: "Stack Traceback",
  size: "xl",
});