import React from "react"; import { getCommonBounds } from "../element/bounds"; import { NonDeletedExcalidrawElement } from "../element/types"; import { t } from "../i18n"; import { AppState, ExcalidrawProps } from "../types"; import { CloseIcon } from "./icons"; import { Island } from "./Island"; import "./Stats.scss"; export const Stats = (props: { appState: AppState; setAppState: React.Component["setState"]; elements: readonly NonDeletedExcalidrawElement[]; onClose: () => void; renderCustomStats: ExcalidrawProps["renderCustomStats"]; }) => { const boundingBox = getCommonBounds(props.elements); return (
{CloseIcon}

{t("stats.title")}

{props.renderCustomStats?.(props.elements, props.appState)}
{t("stats.scene")}
{t("stats.elements")} {props.elements.length}
{t("stats.width")} {Math.round(boundingBox[2]) - Math.round(boundingBox[0])}
{t("stats.height")} {Math.round(boundingBox[3]) - Math.round(boundingBox[1])}
); };