From c98b2c7e25c0f60c1e81796e8954a1ca37d051b3 Mon Sep 17 00:00:00 2001 From: Beef Date: Thu, 27 Oct 2022 18:16:46 +0100 Subject: [PATCH] [Settings] Seperate pages and components --- src/ui/settings/AssetDisplay.tsx | 32 +++++++++++++++++++ .../{components => pages}/AssetBrowser.tsx | 2 +- .../{components => pages}/General.tsx | 2 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 src/ui/settings/AssetDisplay.tsx rename src/ui/settings/{components => pages}/AssetBrowser.tsx (92%) rename src/ui/settings/{components => pages}/General.tsx (98%) diff --git a/src/ui/settings/AssetDisplay.tsx b/src/ui/settings/AssetDisplay.tsx new file mode 100644 index 0000000..51b9ad1 --- /dev/null +++ b/src/ui/settings/AssetDisplay.tsx @@ -0,0 +1,32 @@ +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; +} + +const { FormRow } = Forms; + +const styles = RN.StyleSheet.create({ + asset: { + width: 32, + height: 32, + } +}); + +export default function AssetDisplay({ asset }: AssetDisplayProps) { + return ( + } + onPress={() => { + copyText(asset.name); + showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link")) + }} + /> + ) +} \ No newline at end of file diff --git a/src/ui/settings/components/AssetBrowser.tsx b/src/ui/settings/pages/AssetBrowser.tsx similarity index 92% rename from src/ui/settings/components/AssetBrowser.tsx rename to src/ui/settings/pages/AssetBrowser.tsx index 77f736c..9c750b9 100644 --- a/src/ui/settings/components/AssetBrowser.tsx +++ b/src/ui/settings/pages/AssetBrowser.tsx @@ -1,7 +1,7 @@ import { React, ReactNative as RN } from "@metro/common"; import { Forms } from "@ui/components"; import { all } from "@ui/assets"; -import AssetDisplay from "./AssetDisplay"; +import AssetDisplay from "@ui/settings/components/AssetDisplay"; const { FormInput } = Forms diff --git a/src/ui/settings/components/General.tsx b/src/ui/settings/pages/General.tsx similarity index 98% rename from src/ui/settings/components/General.tsx rename to src/ui/settings/pages/General.tsx index 71c9731..9fa3b25 100644 --- a/src/ui/settings/components/General.tsx +++ b/src/ui/settings/pages/General.tsx @@ -3,7 +3,7 @@ import { DISCORD_SERVER, GITHUB } from "@lib/constants"; import { connectToDebugWS } from "@lib/debug"; import { getAssetIDByName } from "@ui/assets"; import { Forms } from "@ui/components"; -import Version from "./Version"; +import Version from "@ui/settings/components/Version"; const { FormRow, FormSection, FormInput } = Forms; const hermesProps = window.HermesInternal.getRuntimeProperties();