diff --git a/packages/page-society/src/Overview/DesignKusama.tsx b/packages/page-society/src/Overview/DesignKusama.tsx new file mode 100644 index 0000000000..c09a303e27 --- /dev/null +++ b/packages/page-society/src/Overview/DesignKusama.tsx @@ -0,0 +1,77 @@ +// Copyright 2017-2021 @polkadot/app-society authors & contributors +// SPDX-License-Identifier: Apache-2.0 + +import type { AccountId } from '@polkadot/types/interfaces'; + +import React, { useEffect, useRef, useState } from 'react'; + +import { KUSAMA_GENESIS } from '@polkadot/apps-config'; +import { Button, Modal } from '@polkadot/react-components'; +import { useApi, useToggle } from '@polkadot/react-hooks'; + +import drawCanary, { PADD, SIZE } from '../draw/canary'; +import { useTranslation } from '../translate'; + +interface Props { + accountId: AccountId; +} + +const CANVAS_STYLE = { + display: 'block', + margin: '0 auto' +}; + +const HEIGHT = (SIZE * 2) + (PADD * 1); +const WIDTH = (SIZE * 3) + (PADD * 2); + +function DesignKusama ({ accountId }: Props): React.ReactElement | null { + const { t } = useTranslation(); + const { api } = useApi(); + const canvasRef = useRef(null); + const [onKusama] = useState(() => api.genesisHash.eq(KUSAMA_GENESIS)); + const [isShowing, toggleDesign] = useToggle(); + + useEffect((): void => { + if (canvasRef.current) { + const ctx = canvasRef.current.getContext('2d'); + + if (ctx) { + drawCanary(ctx, accountId); + } + } + }); + + if (!onKusama) { + return null; + } + + return ( + <> +