diff --git a/src/core/ui/settings/pages/Developer/AssetBrowser.tsx b/src/core/ui/settings/pages/Developer/AssetBrowser.tsx index c4e0a600..dbda78d1 100644 --- a/src/core/ui/settings/pages/Developer/AssetBrowser.tsx +++ b/src/core/ui/settings/pages/Developer/AssetBrowser.tsx @@ -1,5 +1,6 @@ import AssetDisplay from "@core/ui/settings/pages/Developer/AssetDisplay"; import { assetsMap } from "@lib/api/assets"; +import { Text } from "@metro/common/components"; import { ErrorBoundary, Search } from "@ui/components"; import { FlatList, View } from "react-native"; @@ -14,6 +15,7 @@ export default function AssetBrowser() { 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) => } diff --git a/src/core/ui/settings/pages/Developer/AssetDisplay.tsx b/src/core/ui/settings/pages/Developer/AssetDisplay.tsx index 16cc431e..ae0a6847 100644 --- a/src/core/ui/settings/pages/Developer/AssetDisplay.tsx +++ b/src/core/ui/settings/pages/Developer/AssetDisplay.tsx @@ -1,35 +1,60 @@ -import { Asset } from "@lib/api/assets"; +import { Asset, findAssetId } from "@lib/api/assets"; import { lazyDestructure } from "@lib/utils/lazy"; import { findByProps } from "@metro"; import { clipboard } from "@metro/common"; -import { Stack, TableRow } from "@metro/common/components"; +import { Stack, TableRow, Text } from "@metro/common/components"; import { showToast } from "@ui/toasts"; import { Image } from "react-native"; const { openAlert } = lazyDestructure(() => findByProps("openAlert", "dismissAlert")); const { AlertModal, AlertActionButton } = lazyDestructure(() => findByProps("AlertModal", "AlertActions")); +const displayable = new Set(['png', 'jpg', 'svg']); + +const iconMap = { + jsona: 'ic_file_text', + lottie: 'ic_image', + webm: 'CirclePlayIcon-primary', + ttf: 'ic_add_text', + default: 'UnknownGameIcon' +}; + interface AssetDisplayProps { asset: Asset; } export default function AssetDisplay({ asset }: AssetDisplayProps) { + return ( } - onPress={() => { + subLabel={`Index: ${asset.index} Type: ${asset.type}`} + icon={ + displayable.has(asset.type) + ? + : + } + onPress={() => openAlert("revenge-asset-display-details", } + content={`Index: ${asset.index}\nModule ID: ${asset.moduleId}\nType: ${asset.type}`} + extraContent={ + displayable.has(asset.type) + ? + : ( + Asset type {asset.type.toUpperCase()} is not supported for preview. + ) + } actions={ copyToClipboard(asset.name)} /> copyToClipboard(asset.index.toString())} /> } - />); - }} + />) + } /> ); } diff --git a/src/core/ui/settings/pages/Fonts/FontEditor.tsx b/src/core/ui/settings/pages/Fonts/FontEditor.tsx index 8398119c..40ac61b5 100644 --- a/src/core/ui/settings/pages/Fonts/FontEditor.tsx +++ b/src/core/ui/settings/pages/Fonts/FontEditor.tsx @@ -3,8 +3,6 @@ import { createProxy, useProxy } from "@core/vendetta/storage"; import { FontDefinition, fonts, removeFont, saveFont, updateFont, validateFont } from "@lib/addons/fonts"; import { getCurrentTheme } from "@lib/addons/themes"; import { findAssetId } from "@lib/api/assets"; -import { semanticColors } from "@lib/ui/color"; -import { createStyles, TextStyleSheet } from "@lib/ui/styles"; import { safeFetch } from "@lib/utils"; import { lazyDestructure } from "@lib/utils/lazy"; import { NavigationNative } from "@metro/common"; @@ -14,13 +12,6 @@ import { ErrorBoundary } from "@ui/components"; import { useMemo, useRef, useState } from "react"; import { ScrollView, View } from "react-native"; -const useStyles = createStyles({ - errorText: { - ...TextStyleSheet["text-xs/medium"], - color: semanticColors.TEXT_DANGER, - }, -}); - const actionSheet = findByPropsLazy("hideActionSheet"); const { openAlert } = lazyDestructure(() => findByProps("openAlert", "dismissAlert")); const { AlertModal, AlertActionButton } = lazyDestructure(() => findByProps("AlertModal", "AlertActions")); @@ -278,8 +269,6 @@ export default function FontEditor(props: { const [importing, setIsImporting] = useState(false); const [errors, setErrors] = useState | undefined>(); - const styles = useStyles(); - const memoEntry = useMemo(() => { return createProxy(props.name ? { ...fonts[props.name].main } : {}).proxy; }, [props.name]); @@ -343,7 +332,7 @@ export default function FontEditor(props: { return {error.message} : url} + subLabel={error ? {error.message} : url} trailing={ } /> - {errors && Some font entries cannot be imported. Please modify the entries and try again.} + {errors && Some font entries cannot be imported. Please modify the entries and try again.}