diff --git a/src/equicordplugins/profileSets/components/presetManager.tsx b/src/equicordplugins/profileSets/components/presetManager.tsx index 85e876870..9386e52d1 100644 --- a/src/equicordplugins/profileSets/components/presetManager.tsx +++ b/src/equicordplugins/profileSets/components/presetManager.tsx @@ -186,8 +186,6 @@ export function PresetManager({ section, guildId }: PresetManagerProps) { > Random - -
+ +
+ + {section === "server" && ( +
+ setGuildId(v as string)} + /> +
+ )} + + {section === "server" && !guildId ? ( +

You are not in any servers yet.

+ ) : ( + + )} + + ); +} + +export default wrapTab(ProfileSetsTab, "Profile Sets"); diff --git a/src/equicordplugins/profileSets/index.tsx b/src/equicordplugins/profileSets/index.tsx index c474658b1..dfea8ba65 100644 --- a/src/equicordplugins/profileSets/index.tsx +++ b/src/equicordplugins/profileSets/index.tsx @@ -7,13 +7,15 @@ import "./styles.css"; import { definePluginSettings } from "@api/Settings"; +import { UserIcon } from "@components/Icons"; +import SettingsPlugin from "@plugins/_core/settings"; import { EquicordDevs } from "@utils/constants"; import { classNameFactory } from "@utils/css"; +import { removeFromArray } from "@utils/misc"; import definePlugin, { OptionType } from "@utils/types"; -import { React } from "@webpack/common"; +import { SettingsRouter } from "@webpack/common"; -import { PresetManager } from "./components/presetManager"; -import { loadPresets, PresetSection } from "./utils/storage"; +import { loadPresets } from "./utils/storage"; export const cl = classNameFactory("vc-profile-presets-"); export const settings = definePluginSettings({ @@ -28,30 +30,27 @@ export const settings = definePluginSettings({ export default definePlugin({ name: "ProfileSets", - description: "Allows you to save and load different profile presets, via the Profile Section in Settings.", + description: "Allows you to save and load different profile presets.", tags: ["Appearance", "Customisation", "Utility"], authors: [EquicordDevs.omaw, EquicordDevs.justjxke], settings, - patches: [ - { - find: "DefaultCustomizationSections: user cannot be undefined", - replacement: { - match: /return.{0,50}children:\[(?=.{0,50},\{placeholder:)/, - replace: "$&$self.renderPresetSection(\"main\")," - } + toolboxActions: { + "Open Profile Sets": () => { + SettingsRouter.openUserSettings("equicord_profile_sets_panel"); }, - { - find: "USER_SETTINGS_GUILD_PROFILE)", - replacement: { - match: /guildId:(\i\.id),onChange:(\i)\}\)(?=.{0,25}profilePreviewTitle:)/, - replace: 'guildId:$1,onChange:$2}),$self.renderPresetSection("server",$1)' - } - } - ], + }, + start() { loadPresets("main"); + SettingsPlugin.customEntries.push({ + key: "equicord_profile_sets", + title: "Profile Sets", + Component: require("./components/profileSetsTab").default, + Icon: UserIcon + }); + }, + + stop() { + removeFromArray(SettingsPlugin.customEntries, e => e.key === "equicord_profile_sets"); }, - renderPresetSection(section: PresetSection, guildId?: string) { - return ; - } }); diff --git a/src/equicordplugins/profileSets/styles.css b/src/equicordplugins/profileSets/styles.css index 40a99482c..77230b5a9 100644 --- a/src/equicordplugins/profileSets/styles.css +++ b/src/equicordplugins/profileSets/styles.css @@ -1,3 +1,22 @@ +.vc-profile-presets-tab-heading { + margin-bottom: 16px; +} + +.vc-profile-presets-section-switch { + display: flex; + gap: 8px; + margin-bottom: 16px; +} + +.vc-profile-presets-guild-picker { + max-width: 300px; + margin-bottom: 16px; +} + +.vc-profile-presets-empty-state { + color: var(--text-muted); +} + .vc-profile-presets-section { margin-bottom: 20px; padding: 0;