Comment out code temporarily
This commit is contained in:
@@ -4,7 +4,7 @@ import {
|
|||||||
ReactNode,
|
ReactNode,
|
||||||
FC,
|
FC,
|
||||||
useState,
|
useState,
|
||||||
useCallback,
|
// useCallback,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { Notepad, Prohibit } from "phosphor-react";
|
import { Notepad, Prohibit } from "phosphor-react";
|
||||||
import useStayScrolled from "react-stay-scrolled";
|
import useStayScrolled from "react-stay-scrolled";
|
||||||
@@ -12,10 +12,11 @@ import NextLink from "next/link";
|
|||||||
|
|
||||||
import Container from "./Container";
|
import Container from "./Container";
|
||||||
import LogText from "./LogText";
|
import LogText from "./LogText";
|
||||||
import state, { ILog } from "../state";
|
// import state, { ILog } from "../state";
|
||||||
|
import { ILog } from "../state";
|
||||||
import { Pre, Link, Heading, Button, Text, Flex, Box } from ".";
|
import { Pre, Link, Heading, Button, Text, Flex, Box } from ".";
|
||||||
import regexifyString from "regexify-string";
|
// import regexifyString from "regexify-string";
|
||||||
import { useSnapshot } from "valtio";
|
// import { useSnapshot } from "valtio";
|
||||||
import { AccountDialog } from "./Accounts";
|
import { AccountDialog } from "./Accounts";
|
||||||
|
|
||||||
interface ILogBox {
|
interface ILogBox {
|
||||||
@@ -154,41 +155,41 @@ export const Log: FC<ILog> = ({
|
|||||||
defaultCollapsed,
|
defaultCollapsed,
|
||||||
jsonData: _jsonData,
|
jsonData: _jsonData,
|
||||||
}) => {
|
}) => {
|
||||||
const [expanded, setExpanded] = useState(!defaultCollapsed);
|
// const [expanded, setExpanded] = useState(!defaultCollapsed);
|
||||||
const { accounts } = useSnapshot(state);
|
// const { accounts } = useSnapshot(state);
|
||||||
const [dialogAccount, setDialogAccount] = useState<string | null>(null);
|
const [dialogAccount, setDialogAccount] = useState<string | null>(null);
|
||||||
|
|
||||||
const enrichAccounts = useCallback(
|
// const enrichAccounts = useCallback(
|
||||||
(str?: string): ReactNode => {
|
// (str?: string): ReactNode => {
|
||||||
if (!str || !accounts.length) return null;
|
// if (!str || !accounts.length) return null;
|
||||||
|
|
||||||
const pattern = `(${accounts.map((acc) => acc.address).join("|")})`;
|
// const pattern = `(${accounts.map((acc) => acc.address).join("|")})`;
|
||||||
const res = regexifyString({
|
// const res = regexifyString({
|
||||||
pattern: new RegExp(pattern, "gim"),
|
// pattern: new RegExp(pattern, "gim"),
|
||||||
decorator: (match, idx) => {
|
// decorator: (match, idx) => {
|
||||||
const name = accounts.find((acc) => acc.address === match)?.name;
|
// const name = accounts.find((acc) => acc.address === match)?.name;
|
||||||
return (
|
// return (
|
||||||
<Link
|
// <Link
|
||||||
key={match + idx}
|
// key={match + idx}
|
||||||
as="a"
|
// as="a"
|
||||||
onClick={() => setDialogAccount(match)}
|
// onClick={() => setDialogAccount(match)}
|
||||||
title={match}
|
// title={match}
|
||||||
highlighted
|
// highlighted
|
||||||
>
|
// >
|
||||||
{name || match}
|
// {name || match}
|
||||||
</Link>
|
// </Link>
|
||||||
);
|
// );
|
||||||
},
|
// },
|
||||||
input: str,
|
// input: str,
|
||||||
});
|
// });
|
||||||
|
|
||||||
return <>{res}</>;
|
// return <>{res}</>;
|
||||||
},
|
// },
|
||||||
[accounts]
|
// [accounts]
|
||||||
);
|
// );
|
||||||
_message = _message.trim().replace(/\n /gi, "\n");
|
_message = _message.trim().replace(/\n /gi, "\n");
|
||||||
const message = enrichAccounts(_message);
|
// const message = enrichAccounts(_message);
|
||||||
const jsonData = enrichAccounts(_jsonData);
|
// const jsonData = enrichAccounts(_jsonData);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
Reference in New Issue
Block a user