[Cleanup] Lots of tidying, fill out API object

This commit is contained in:
Beef 2022-10-28 18:50:40 +01:00
parent c98b2c7e25
commit 7610a97b78
11 changed files with 52 additions and 48 deletions

View file

@ -17,7 +17,7 @@ export default function patchAssets() {
const asset = assetsModule.getAssetByID(id);
if (!asset) break;
if (all[asset.name]) continue;
all[asset.name] = { ...asset, id: id }
all[asset.name] = { ...asset, id: id };
};
} catch {};
}

View file

@ -1,4 +1,3 @@
import { findByProps } from "@metro/filters";
// TODO: Type individual props
export const Forms = findByProps("FormSection");

View file

@ -1,32 +0,0 @@
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 (
<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"))
}}
/>
)
}

View file

@ -25,7 +25,7 @@ export default function AssetDisplay({ asset }: AssetDisplayProps) {
trailing={() => <RN.Image source={asset.id} style={styles.asset} />}
onPress={() => {
copyText(asset.name);
showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link"))
showToast("Copied asset name to clipboard.", getAssetIDByName("toast_copy_link"));
}}
/>
)

View file

@ -20,7 +20,7 @@ export default function Version({ label, version, icon }: VersionProps) {
trailing={() => <FormText>{version}</FormText>}
onPress={() => {
copyText(`${label} - ${version}`);
showToast("Copied version to clipboard.", getAssetIDByName("toast_copy_link"))
showToast("Copied version to clipboard.", getAssetIDByName("toast_copy_link"));
}}
/>
)

View file

@ -1,6 +1,6 @@
import { React, ReactNative as RN, url } from "@metro/common";
import { DISCORD_SERVER, GITHUB } from "@lib/constants";
import { connectToDebugWS } from "@lib/debug";
import { connectToDebugger } from "@lib/debug";
import { getAssetIDByName } from "@ui/assets";
import { Forms } from "@ui/components";
import Version from "@ui/settings/components/Version";
@ -62,7 +62,7 @@ export default function General() {
label="Connect to debug websocket"
leading={() => <FormRow.Icon source={getAssetIDByName("copy")} />}
trailing={FormRow.Arrow}
onPress={() => connectToDebugWS(debuggerUrl)}
onPress={() => connectToDebugger(debuggerUrl)}
/>
<FormRow
label="Reload Discord"

View file

@ -3,6 +3,6 @@ import { toasts } from "@metro/common";
export function showToast(content: string, asset: number) {
return toasts.open({
content: content,
source: asset
source: asset,
});
}