From 0ec19aaf5ccf9b9b354d9139e09469c034f4a35f Mon Sep 17 00:00:00 2001 From: Beef Date: Sun, 23 Oct 2022 01:37:49 +0100 Subject: [PATCH] [UI > AssetBrowser] Improve search, add name copying --- src/ui/settings/components/AssetBrowser.tsx | 2 +- src/ui/settings/components/AssetDisplay.tsx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/ui/settings/components/AssetBrowser.tsx b/src/ui/settings/components/AssetBrowser.tsx index 2487afb..77f736c 100644 --- a/src/ui/settings/components/AssetBrowser.tsx +++ b/src/ui/settings/components/AssetBrowser.tsx @@ -16,7 +16,7 @@ export default function AssetBrowser() { title="SEARCH" /> a.name.startsWith(searchName))} + data={Object.values(all).filter(a => a.name.includes(searchName))} renderItem={({ item }) => ( )} diff --git a/src/ui/settings/components/AssetDisplay.tsx b/src/ui/settings/components/AssetDisplay.tsx index 4a65b0e..51b9ad1 100644 --- a/src/ui/settings/components/AssetDisplay.tsx +++ b/src/ui/settings/components/AssetDisplay.tsx @@ -1,6 +1,9 @@ import { Asset } from "@types"; import { React, ReactNative as RN } from "@metro/common"; +import { showToast } from "@ui/toasts"; +import { getAssetIDByName } from "@ui/assets"; import { Forms } from "@ui/components"; +import copyText from "@lib/utils/copyText"; interface AssetDisplayProps { asset: Asset; @@ -20,6 +23,10 @@ export default function AssetDisplay({ asset }: AssetDisplayProps) { } + onPress={() => { + copyText(asset.name); + showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link")) + }} /> ) } \ No newline at end of file