import { AnalyticsOutlined, Key, ThumbDown } from '@mui/icons-material' import clsx from 'clsx' import { ComponentType, Fragment, ReactNode } from 'react' import { useTranslation } from 'react-i18next' import { Button } from '../buttons' import { StatusCard } from '../StatusCard' import { ProposalVoteButton } from './ProposalVoteButton' export type ProposalStatusAndInfoProps = { status?: string info: { Icon: ComponentType<{ className: string }> label: string Value: ComponentType<{ className: string }> }[] inline?: boolean action?: { header?: ReactNode label?: string description?: string Icon?: ComponentType<{ className: string }> loading?: boolean doAction?: () => void } // Present if can veto. vetoOrEarlyExecute?: { loading: 'veto' | 'earlyExecute' | false onVeto: () => void | Promise /** * If defined, the vetoer is allowed to execute instead of veto. */ onEarlyExecute?: () => void | Promise /** * Whether or not this is part of the Neutron fork overrule flow. */ isNeutronOverrule: boolean /** * Whether or not the connected wallet can veto. */ walletCanVeto: boolean /** * Whether or not the vetoer is a DAO and the current user is a member of * that vetoer DAO. */ isVetoerDaoMember: boolean } footer?: ReactNode className?: string /** * Voter component. Only shown on desktop. Should only be defined if can vote. */ Voter?: ComponentType<{ className: string }> } export const ProposalStatusAndInfo = ({ status, info, inline = false, action, vetoOrEarlyExecute, footer, className, Voter, }: ProposalStatusAndInfoProps) => { const { t } = useTranslation() return (
{!!status && (

{t('title.status')}

{status}

)}
{info.map(({ Icon, label, Value }, index) => (

{label}

))}
{action && (
{action.header} {action.doAction && ( )} {action.description && ( )}
)} {Voter && ( )} {vetoOrEarlyExecute && (
{!vetoOrEarlyExecute.isNeutronOverrule && vetoOrEarlyExecute.isVetoerDaoMember && ( )} {vetoOrEarlyExecute.onEarlyExecute && ( )}
{vetoOrEarlyExecute.onEarlyExecute && ( )}
)} {footer && (
{footer}
)}
) }