/* eslint-disable jsx-a11y/no-static-element-interactions */
/* eslint-disable jsx-a11y/click-events-have-key-events */
import { useState } from 'react';
import { generatePath, Link } from 'react-router-dom';
import clsx from 'clsx';
import ArrowSVG from '@/shared/assets/images/actions/arrowRight.svg?react';
import { PreformattedBlock } from '@/shared/ui/preformattedBlock';
import { absoluteRoutes } from '@/shared/config';
import { IdeaEvent } from '../../idea-event';
import { Method } from '../../consts';
import { FormattedUserMessageSentData } from '../../types';
import { DecodedLogBlock } from '../decoded-log-block';
import styles from './event.module.scss';
type Props = {
value: IdeaEvent | IdeaEvent[];
};
// TODO: use ExpansionPanel?
const Event = ({ value }: Props) => {
const [isOpen, setIsOpen] = useState(false);
const toggle = () => setIsOpen((prevValue) => !prevValue);
const arrowClassName = clsx(styles.arrow, isOpen && styles.open);
const isGroup = Array.isArray(value);
const event = isGroup ? value[0] : value;
const { method, heading, description, blockNumber } = event;
const counter = isGroup ? value.length : undefined;
const isLog = method === Method.UserMessageSent;
const getContent = ({ id, data }: IdeaEvent = event) => {
const formattedData = data.toHuman();
return isLog ? (
{description}