From 0bdb90ef3d800d70de858eb27c7eca60f100f413 Mon Sep 17 00:00:00 2001 From: Bwlok Date: Fri, 7 Nov 2025 06:55:56 +0100 Subject: [PATCH 1/2] Improve AssetBrowser displaying --- .../settings/pages/Developer/AssetBrowser.tsx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/core/ui/settings/pages/Developer/AssetBrowser.tsx b/src/core/ui/settings/pages/Developer/AssetBrowser.tsx index b1bdcbb..bc91c95 100644 --- a/src/core/ui/settings/pages/Developer/AssetBrowser.tsx +++ b/src/core/ui/settings/pages/Developer/AssetBrowser.tsx @@ -3,7 +3,7 @@ import { iterateAssets } from "@lib/api/assets"; import { Text } from "@metro/common/components"; import { ErrorBoundary, Search } from "@ui/components"; import { useMemo } from "react"; -import { FlatList, View } from "react-native"; +import { FlatList, View, ScrollView } from "react-native"; export default function AssetBrowser() { const [search, setSearch] = React.useState(""); @@ -16,15 +16,18 @@ export default function AssetBrowser() { style={{ margin: 10 }} onChangeText={(v: string) => setSearch(v)} /> - - Some assets types cannot be displayed and will be marked in red. - a.name.includes(search) || a.id.toString() === search)} - renderItem={({ item }: any) => } - contentContainerStyle={{ overflow: 'hidden', backgroundColor: 'transparent', borderRadius: 16 }} - keyExtractor={a => a.name} - /> - + + + Some assets types cannot be displayed and will be marked in red. + a.name.includes(search) || a.id.toString() === search)} + renderItem={({ item }: any) => } + contentContainerStyle={{ overflow: 'hidden', backgroundColor: 'transparent', borderRadius: 16 }} + scrollEnabled={false} + keyExtractor={a => a.id.toString()} + /> + + ); From f80888f8afa15d0797805becdf4a652fcdbd02b1 Mon Sep 17 00:00:00 2001 From: Bwlok Date: Fri, 7 Nov 2025 06:57:46 +0100 Subject: [PATCH 2/2] feat(Dev): Add option to filter NonImage Assets --- .../settings/pages/Developer/AssetBrowser.tsx | 55 ++++++++++++++++--- 1 file changed, 46 insertions(+), 9 deletions(-) diff --git a/src/core/ui/settings/pages/Developer/AssetBrowser.tsx b/src/core/ui/settings/pages/Developer/AssetBrowser.tsx index bc91c95..785cb78 100644 --- a/src/core/ui/settings/pages/Developer/AssetBrowser.tsx +++ b/src/core/ui/settings/pages/Developer/AssetBrowser.tsx @@ -1,27 +1,64 @@ import AssetDisplay from "@core/ui/settings/pages/Developer/AssetDisplay"; -import { iterateAssets } from "@lib/api/assets"; +import { iterateAssets, findAssetId } from "@lib/api/assets"; import { Text } from "@metro/common/components"; import { ErrorBoundary, Search } from "@ui/components"; import { useMemo } from "react"; -import { FlatList, View, ScrollView } from "react-native"; +import { FlatList, View, ScrollView, TouchableOpacity, Image } from "react-native"; + +const displayable = new Set(['png', 'jpg', 'svg']); export default function AssetBrowser() { const [search, setSearch] = React.useState(""); + const [showNonImages, setShowNonImages] = React.useState(false); + const all = useMemo(() => Array.from(iterateAssets()), []); + const filteredData = useMemo(() => { + let result = all.filter(a => a.name.includes(search) || a.id.toString() === search); + + if (!showNonImages) { + result = result.filter(a => displayable.has(a.type)); + } + + return result; + }, [all, search, showNonImages]); + + return ( - setSearch(v)} - /> + + + setSearch(v)} + /> + + setShowNonImages(!showNonImages)} + > + + + - Some assets types cannot be displayed and will be marked in red. + {showNonImages && ( + Some assets types cannot be displayed and will be marked in red. + )} a.name.includes(search) || a.id.toString() === search)} - renderItem={({ item }: any) => } + data={filteredData} + renderItem={({ item }: any) => } contentContainerStyle={{ overflow: 'hidden', backgroundColor: 'transparent', borderRadius: 16 }} scrollEnabled={false} keyExtractor={a => a.id.toString()}