Refactor settings UI and consolidate credits section

This commit is contained in:
kmmiio99o 2025-09-27 21:08:38 +02:00
parent f84f55448c
commit d756744160

View file

@ -1,11 +1,9 @@
import { plugin } from "@vendetta"; import { plugin } from "@vendetta";
import { storage } from "@vendetta/plugin";
import { useProxy } from "@vendetta/storage";
import { getAssetIDByName } from "@vendetta/ui/assets"; import { getAssetIDByName } from "@vendetta/ui/assets";
import { React } from "@vendetta/metro/common"; import { React } from "@vendetta/metro/common";
import { findByProps } from "@vendetta/metro"; import { findByProps } from "@vendetta/metro";
import { View } from "react-native"; import { View } from "react-native";
import { alerts } from "@vendetta/ui"; import { BundleUpdaterManager } from "@vendetta/metro/common";
const { ScrollView } = findByProps("ScrollView"); const { ScrollView } = findByProps("ScrollView");
const { TableRowGroup, TableSwitchRow, Stack, TableRow } = findByProps( const { TableRowGroup, TableSwitchRow, Stack, TableRow } = findByProps(
@ -47,13 +45,6 @@ if (!storage.pendingRestart) {
storage.pendingRestart = false; storage.pendingRestart = false;
} }
const Credits = {
PETPET: "wolfieeee",
FACTS: "jdev082",
LISTS: "Kitomanari",
KONOCHAN: ["btmc727", "Rico040"],
};
export default function Settings() { export default function Settings() {
useProxy(storage); useProxy(storage);
const [rerender, forceRerender] = React.useReducer((x) => x + 1, 0); const [rerender, forceRerender] = React.useReducer((x) => x + 1, 0);
@ -62,17 +53,8 @@ export default function Settings() {
React.useEffect(() => { React.useEffect(() => {
return () => { return () => {
if (storage.pendingRestart) { if (storage.pendingRestart) {
alerts.showConfirmationAlert({ storage.pendingRestart = false;
title: "Restart Required", BundleUpdaterManager.reload();
content:
"Command changes require Discord to restart. Would you like to restart now?",
confirmText: "Restart",
cancelText: "Later",
confirmColor: "brand",
onConfirm: () => {
window.enmity.plugins.reload("vendetta");
},
});
} }
}; };
}, []); }, []);
@ -85,7 +67,7 @@ export default function Settings() {
return ( return (
<View style={{ flex: 1 }}> <View style={{ flex: 1 }}>
<ScrollView style={{ flex: 1 }}> <ScrollView style={{ flex: 1, paddingBottom: 38 }}>
<Stack spacing={8}> <Stack spacing={8}>
{/* Facts Commands */} {/* Facts Commands */}
<TableRowGroup title="Facts Commands"> <TableRowGroup title="Facts Commands">
@ -109,11 +91,6 @@ export default function Settings() {
forceRerender(); forceRerender();
}} }}
/> />
<TableRow
label="Credits"
subLabel={`Facts commands by ${Credits.FACTS}`}
icon={getAssetIDByName("ic_info")}
/>
<TableSwitchRow <TableSwitchRow
label="/catfact" label="/catfact"
subLabel="Get random cat facts" subLabel="Get random cat facts"
@ -159,11 +136,6 @@ export default function Settings() {
forceRerender(); forceRerender();
}} }}
/> />
<TableRow
label="Credits"
subLabel={`List commands by ${Credits.LISTS}`}
icon={getAssetIDByName("ic_info")}
/>
<TableSwitchRow <TableSwitchRow
label="/plugin-list" label="/plugin-list"
subLabel="List all installed plugins" subLabel="List all installed plugins"
@ -182,11 +154,6 @@ export default function Settings() {
{/* Image Commands */} {/* Image Commands */}
<TableRowGroup title="Image Commands"> <TableRowGroup title="Image Commands">
<TableRow
label="Credits"
subLabel={`PetPet command by ${Credits.PETPET}`}
icon={getAssetIDByName("ic_info")}
/>
<TableSwitchRow <TableSwitchRow
label="/petpet" label="/petpet"
subLabel="Create pet-pet GIF of a user" subLabel="Create pet-pet GIF of a user"
@ -198,11 +165,6 @@ export default function Settings() {
{/* KonoChan Commands */} {/* KonoChan Commands */}
<TableRowGroup title="KonoChan Commands"> <TableRowGroup title="KonoChan Commands">
<TableRow
label="Credits"
subLabel={`KonoChan commands by ${Credits.KONOCHAN.join(" & ")}`}
icon={getAssetIDByName("ic_info")}
/>
<TableSwitchRow <TableSwitchRow
label="/konoself" label="/konoself"
subLabel="Get random image from KonoChan (private)" subLabel="Get random image from KonoChan (private)"
@ -219,7 +181,40 @@ export default function Settings() {
/> />
</TableRowGroup> </TableRowGroup>
{/* About Section */} {/* Credits */}
<TableRowGroup title="Credits">
<TableRow
label="Facts Commands"
subLabel="by jdev082"
icon={getAssetIDByName("ic_info")}
/>
<TableRow
label="List Commands"
subLabel="by Kitomanari"
icon={getAssetIDByName("ic_list")}
/>
<TableRow
label="PetPet Command"
subLabel="by wolfieeee"
icon={getAssetIDByName("ic_image")}
/>
<TableRow
label="KonoChan Commands"
subLabel="by btmc727 & Rico040"
icon={getAssetIDByName("ic_image")}
/>
</TableRowGroup>
{/* Actions */}
<TableRowGroup title="Actions">
<TableRow
label="Reload Discord"
icon={getAssetIDByName("ic_message_retry")}
onPress={() => BundleUpdaterManager.reload()}
/>
</TableRowGroup>
{/* About */}
<TableRowGroup title="About"> <TableRowGroup title="About">
<TableRow <TableRow
label="All-In-One Commands" label="All-In-One Commands"