// Copyright (c) 2020-2021 Drew Lemmy // This file is part of KristWeb 2 under GPL-3.0. // Full details: https://github.com/tmpim/KristWeb2/blob/master/LICENSE.txt import React from "react"; import { Select } from "antd"; import { useSelector } from "react-redux"; import { RootState } from "../../store"; import { useTranslation } from "react-i18next"; import { WalletFormatName, ADVANCED_FORMATS } from "../../krist/wallets/formats/WalletFormat"; interface Props { initialFormat: WalletFormatName; } export function getSelectWalletFormat({ initialFormat }: Props): JSX.Element { const advancedWalletFormats = useSelector((s: RootState) => s.settings.walletFormats); const { t } = useTranslation(); return <Select> <Select.Option value="kristwallet">{t("addWallet.walletFormatKristWallet")}</Select.Option> {(advancedWalletFormats || ADVANCED_FORMATS.includes(initialFormat)) && <> <Select.Option value="kristwallet_username_appendhashes">{t("addWallet.walletFormatKristWalletUsernameAppendhashes")}</Select.Option> <Select.Option value="kristwallet_username">{t("addWallet.walletFormatKristWalletUsername")}</Select.Option> <Select.Option value="jwalelset">{t("addWallet.walletFormatJwalelset")}</Select.Option> </>} <Select.Option value="api">{t("addWallet.walletFormatApi")}</Select.Option> </Select>; }