- {renderIcon({ status, icon })}
-
{title}
- {subTitle &&
{subTitle}
}
- {renderExtra({ extra })}
- {children &&
{children}
}
-
- );
-};
diff --git a/src/components/addresses/ContextualAddress.less b/src/components/addresses/ContextualAddress.less
new file mode 100644
index 0000000..5031814
--- /dev/null
+++ b/src/components/addresses/ContextualAddress.less
@@ -0,0 +1,21 @@
+// 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 (reference) "../../App.less";
+
+.contextual-address {
+ &:not(.contextual-address-allow-wrap) {
+ .address-metaname, .address-name, .address-raw-metaname,
+ .address-wallet {
+ white-space: nowrap;
+ }
+ }
+
+ .address-address, .address-original {
+ white-space: nowrap;
+ }
+
+ .address-original {
+ opacity: 0.8;
+ }
+}
diff --git a/src/components/addresses/ContextualAddress.tsx b/src/components/addresses/ContextualAddress.tsx
new file mode 100644
index 0000000..4419d54
--- /dev/null
+++ b/src/components/addresses/ContextualAddress.tsx
@@ -0,0 +1,134 @@
+// 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 classNames from "classnames";
+import { Tooltip, Typography } from "antd";
+
+import { useSelector } from "react-redux";
+import { RootState } from "../../store";
+import { useTranslation } from "react-i18next";
+import { Link } from "react-router-dom";
+
+import { KristAddress } from "../../krist/api/types";
+import { Wallet, useWallets } from "../../krist/wallets/Wallet";
+import { parseCommonMeta, CommonMeta } from "../../utils/commonmeta";
+import { stripNameSuffix } from "../../utils/currency";
+import { useBooleanSetting } from "../../utils/settings";
+
+import { KristNameLink } from "../names/KristNameLink";
+
+import "./ContextualAddress.less";
+
+const { Text } = Typography;
+
+interface Props {
+ address: KristAddress | string | null;
+ wallet?: Wallet | false;
+ metadata?: string;
+ source?: boolean;
+ hideNameAddress?: boolean;
+ allowWrap?: boolean;
+ neverCopyable?: boolean;
+ className?: string;
+}
+
+interface AddressMetanameProps {
+ nameSuffix: string;
+ address: string;
+ commonMeta: CommonMeta;
+ source: boolean;
+ hideNameAddress: boolean;
+}
+
+export function AddressMetaname({ nameSuffix, address, commonMeta, source, hideNameAddress }: AddressMetanameProps): JSX.Element {
+ const rawMetaname = (source ? commonMeta?.return : commonMeta?.recipient) || undefined;
+ const metaname = (source ? commonMeta?.returnMetaname : commonMeta?.metaname) || undefined;
+ const name = (source ? commonMeta?.returnName : commonMeta?.name) || undefined;
+ const nameWithoutSuffix = name ? stripNameSuffix(nameSuffix, name) : undefined;
+
+ return name
+ ? <>
+ {/* Display the name/metaname (e.g. foo@bar.kst) */}
+ {metaname && <>