From cd917a4ba21e65d12de3c3254cb3120caeac7e93 Mon Sep 17 00:00:00 2001 From: nin0dev Date: Sat, 3 Aug 2024 08:13:51 -0400 Subject: [PATCH] =?UTF-8?q?finished=20settings=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/rpcEditor/ReplaceSettings.tsx | 119 +++++++++++++++++++--- src/plugins/rpcEditor/index.tsx | 5 +- 2 files changed, 106 insertions(+), 18 deletions(-) diff --git a/src/plugins/rpcEditor/ReplaceSettings.tsx b/src/plugins/rpcEditor/ReplaceSettings.tsx index 881d0b252..4811a0751 100644 --- a/src/plugins/rpcEditor/ReplaceSettings.tsx +++ b/src/plugins/rpcEditor/ReplaceSettings.tsx @@ -8,7 +8,7 @@ import { CheckedTextInput } from "@components/CheckedTextInput"; import { Margins } from "@utils/margins"; import { identity } from "@utils/misc"; import { findByPropsLazy } from "@webpack"; -import { Card, Forms, PresenceStore, React, Select, SnowflakeUtils, Switch, UserStore } from "@webpack/common"; +import { Card, Forms, PresenceStore, React, Select, SnowflakeUtils, Switch, TextInput, UserStore } from "@webpack/common"; import { Activity, ActivityType, AppIdSetting, makeEmptyAppId } from "."; @@ -38,7 +38,7 @@ export function ReplaceTutorial() { { activities.length === 0 ? No running activities : activities.map(activity => { return activity.flags !== 48 ? {activity.name}: {activity.application_id} : null; /* hide spotify */ }) } - Available variables + Available variables In all fields, you can put in variables that'll automatically be replaced by their content:
@@ -47,6 +47,12 @@ export function ReplaceTutorial() {
                     :large_image:, :large_text:, :small_image:, :small_text:
                 
+ More details + + Leave a field empty to leave it as is. +
+ Set a field to "null" to hide it on the presence. +
); } @@ -58,13 +64,6 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { appIds[index][key] = val; - if (val && key === "appId") { - appIds[index].appName = "Unknown"; - } - - if (appIds[index].appId === "" && index !== appIds.length - 1) - appIds.splice(index, 1); - save(); update(); } @@ -73,9 +72,9 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { <> { appIds.map((setting, i) => - + { - setting.appId ? + isValidSnowflake(setting.appId) ? { @@ -84,10 +83,10 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { className={Margins.bottom8} hideBorder={true} > - Edit the app + Apply edits to app : Add new application } - Application ID + Application ID { @@ -98,7 +97,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) { } /> { - setting.appId && <> + isValidSnowflake(setting.appId) && <> New activity type