[UI > AssetBrowser] Improve search, add name copying

This commit is contained in:
Beef 2022-10-23 01:37:49 +01:00
parent 9f1fe6313d
commit 0ec19aaf5c
2 changed files with 8 additions and 1 deletions

View file

@ -16,7 +16,7 @@ export default function AssetBrowser() {
title="SEARCH"
/>
<RN.FlatList
data={Object.values(all).filter(a => a.name.startsWith(searchName))}
data={Object.values(all).filter(a => a.name.includes(searchName))}
renderItem={({ item }) => (
<AssetDisplay asset={item} />
)}

View file

@ -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) {
<FormRow
label={`${asset.name} - ${asset.id}`}
trailing={() => <RN.Image source={asset.id} style={styles.asset} />}
onPress={() => {
copyText(asset.name);
showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link"))
}}
/>
)
}