[UI > AssetBrowser] Improve search, add name copying
This commit is contained in:
parent
9f1fe6313d
commit
0ec19aaf5c
2 changed files with 8 additions and 1 deletions
|
@ -16,7 +16,7 @@ export default function AssetBrowser() {
|
||||||
title="SEARCH"
|
title="SEARCH"
|
||||||
/>
|
/>
|
||||||
<RN.FlatList
|
<RN.FlatList
|
||||||
data={Object.values(all).filter(a => a.name.startsWith(searchName))}
|
data={Object.values(all).filter(a => a.name.includes(searchName))}
|
||||||
renderItem={({ item }) => (
|
renderItem={({ item }) => (
|
||||||
<AssetDisplay asset={item} />
|
<AssetDisplay asset={item} />
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import { Asset } from "@types";
|
import { Asset } from "@types";
|
||||||
import { React, ReactNative as RN } from "@metro/common";
|
import { React, ReactNative as RN } from "@metro/common";
|
||||||
|
import { showToast } from "@ui/toasts";
|
||||||
|
import { getAssetIDByName } from "@ui/assets";
|
||||||
import { Forms } from "@ui/components";
|
import { Forms } from "@ui/components";
|
||||||
|
import copyText from "@lib/utils/copyText";
|
||||||
|
|
||||||
interface AssetDisplayProps {
|
interface AssetDisplayProps {
|
||||||
asset: Asset;
|
asset: Asset;
|
||||||
|
@ -20,6 +23,10 @@ export default function AssetDisplay({ asset }: AssetDisplayProps) {
|
||||||
<FormRow
|
<FormRow
|
||||||
label={`${asset.name} - ${asset.id}`}
|
label={`${asset.name} - ${asset.id}`}
|
||||||
trailing={() => <RN.Image source={asset.id} style={styles.asset} />}
|
trailing={() => <RN.Image source={asset.id} style={styles.asset} />}
|
||||||
|
onPress={() => {
|
||||||
|
copyText(asset.name);
|
||||||
|
showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link"))
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
Loading…
Reference in a new issue