From ffc4e301f876342b70add23ecbcef6516ed76390 Mon Sep 17 00:00:00 2001 From: everestmcarthur <280397636+everestmcarthur@users.noreply.github.com> Date: Sat, 1 Aug 2026 14:47:10 -0400 Subject: [PATCH] ServerDrawer: fold in BetterFolders' auto-collapse and hide-icons features --- README.md | 2 +- plugins/server-drawer/manifest.json | 3 +- .../src/components/FolderItem.tsx | 19 +++++++++--- plugins/server-drawer/src/index.ts | 7 ++++- .../src/patches/autoCollapseFolders.ts | 31 +++++++++++++++++++ plugins/server-drawer/src/ui/Settings.tsx | 20 ++++++++++++ site/meta.json | 8 +++-- 7 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 plugins/server-drawer/src/patches/autoCollapseFolders.ts diff --git a/README.md b/README.md index adf5a8e..2816ed8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ To install: open Discord with Revenge installed, go to **Settings → Plugins**, | FakeProfileThemesAndEffects | Revived | Profile theming and profile effects without Nitro. Fork of [shipwr3ckd's FPTE](https://github.com/shipwr3ckd/FPTE) - fixed a crash on every profile-editor open, confirmed via on-device diagnostics. | `https://rp.jarviscli.dev/fake-profile-themes-and-effects/install/` | | BetterTimestamps | Revived | Calendar-relative, fully relative, ISO 8601, or a custom moment.js timestamp format, for both messages and day dividers. | `https://rp.jarviscli.dev/better-timestamps/install/` | | CopyRoleColor | Revived | Long-press a role pill to copy its color as hex. | `https://rp.jarviscli.dev/copy-role-color/install/` | -| ServerDrawer | Revived | Replaces the Quest Dock with an expandable server grid, hides the left server rail down to a single DMs icon, long-press a server for its context menu, one-tap create/join. Fork of [kmmiio99o's ServerDrawer](https://github.com/kmmiio99o/vd-plugins/tree/main/plugins/ServerDrawer) - fixed an unguarded lookup that could silently skip every patch after it. | `https://rp.jarviscli.dev/server-drawer/install/` | +| ServerDrawer | Revived | Replaces the Quest Dock with an expandable server grid, hides the left server rail down to a single DMs icon, long-press a server for its context menu, one-tap create/join, auto-collapse folders. Fork of [kmmiio99o's ServerDrawer](https://github.com/kmmiio99o/vd-plugins/tree/main/plugins/ServerDrawer) - fixed an unguarded lookup that could silently skip every patch after it. Folder options adapted from [fres621's BetterFolders](https://github.com/fres621/vendetta-plugins/tree/master/plugins/BetterFolders), rebuilt against the drawer's own folders since BetterFolders' target component no longer exists. | `https://rp.jarviscli.dev/server-drawer/install/` | | YouBar+ | Revived | Up to 2 configurable buttons (None/Direct Messages/Settings) on the YouBar, in your chosen order. Fork of [Purple-EyeZ's YouBar+](https://github.com/Purple-EyeZ/RevengePlugins/tree/main/plugins/YouBarPlus) - fixed a startup race condition where the button patch could silently never apply for an entire session. | `https://rp.jarviscli.dev/you-bar-plus/install/` | ### Productivity diff --git a/plugins/server-drawer/manifest.json b/plugins/server-drawer/manifest.json index e36b5e6..ed7945b 100644 --- a/plugins/server-drawer/manifest.json +++ b/plugins/server-drawer/manifest.json @@ -3,7 +3,8 @@ "description": "Replaces the Quest Dock with a server grid drawer above the YouBar - tap to expand, long-press a server for its context menu, plus a one-tap create/join button.", "authors": [ { "name": "everestmcarthur" }, - { "name": "kmmiio99o" } + { "name": "kmmiio99o" }, + { "name": "fres" } ], "main": "src/index.ts", "vendetta": { diff --git a/plugins/server-drawer/src/components/FolderItem.tsx b/plugins/server-drawer/src/components/FolderItem.tsx index 0076189..5d3eb74 100644 --- a/plugins/server-drawer/src/components/FolderItem.tsx +++ b/plugins/server-drawer/src/components/FolderItem.tsx @@ -2,6 +2,8 @@ import React from "react"; import { View, Text, Animated, Pressable, Image, ViewStyle, StyleSheet } from "react-native"; import { findByProps, findByStoreName } from "@vendetta/metro"; import { getAssetIDByName } from "@vendetta/ui/assets"; +import { storage } from "@vendetta/plugin"; +import { useProxy } from "@vendetta/storage"; import { useFolderExpanded, GuildNode } from "../utils/theme"; import GuildIcon from "./GuildIcon"; import GuildItem from "./GuildItem"; @@ -53,15 +55,23 @@ function FolderBadge({ node }: { node: GuildNode }) { } function FolderCover({ node }: { node: GuildNode }) { + useProxy(storage); const col = folderColor(node.color); + return ( - {node.children.slice(0, 4).map((ch, i) => ( - - + {storage.hideFolderIcons ? ( + + - ))} + ) : ( + node.children.slice(0, 4).map((ch, i) => ( + + + + )) + )} @@ -72,6 +82,7 @@ const fc = StyleSheet.create({ outer: { width: ICON, height: ICON }, icon: { width: ICON, height: ICON, borderRadius: 16, overflow: "hidden" }, cell: { position: "absolute", width: MINI, height: MINI, borderRadius: 8, overflow: "hidden" }, + plainIcon: { width: ICON, height: ICON, alignItems: "center", justifyContent: "center" }, }); function FadeIn({ children }: { children: React.ReactNode }) { diff --git a/plugins/server-drawer/src/index.ts b/plugins/server-drawer/src/index.ts index a5b91c2..8df5736 100644 --- a/plugins/server-drawer/src/index.ts +++ b/plugins/server-drawer/src/index.ts @@ -7,6 +7,7 @@ import { patchGetQuestAsset } from "./patches/getQuestAsset"; import { patchExpanded, patchEmpty } from "./patches/contentPatch"; import { patchHideGuildsBar } from "./patches/hideGuildsBar"; import { patchCreateElement } from "./patches/createElementIntercept"; +import { patchAutoCollapseFolders } from "./patches/autoCollapseFolders"; import Settings from "./ui/Settings"; let cleanups: (() => void)[] = []; @@ -44,7 +45,9 @@ function applyAll() { if (tryPatch("hideGuildsBar", () => patchHideGuildsBar(cleanups))) applied.push("hideGuildsBar"); } - logger.log(`[ServerDrawer] onLoad done - ${applied.length}/11 patches applied (${applied.join(", ") || "none"})`); + if (tryPatch("autoCollapseFolders", () => patchAutoCollapseFolders(cleanups))) applied.push("autoCollapseFolders"); + + logger.log(`[ServerDrawer] onLoad done - ${applied.length}/12 patches applied (${applied.join(", ") || "none"})`); } function unpatchAll() { @@ -67,6 +70,8 @@ export default { onLoad: () => { storage.hideGuildsBar ??= true; storage.showUnreadBadges ??= true; + storage.autoCollapseFolders ??= false; + storage.hideFolderIcons ??= false; applyAll(); }, diff --git a/plugins/server-drawer/src/patches/autoCollapseFolders.ts b/plugins/server-drawer/src/patches/autoCollapseFolders.ts new file mode 100644 index 0000000..3cf9e1b --- /dev/null +++ b/plugins/server-drawer/src/patches/autoCollapseFolders.ts @@ -0,0 +1,31 @@ +import { findByStoreName } from "@vendetta/metro"; +import { FluxDispatcher } from "@vendetta/metro/common"; +import { storage } from "@vendetta/plugin"; + +// Adapted from fres621's BetterFolders (autoCollapse.ts) - ported as a ServerDrawer feature +// instead of a standalone plugin because BetterFolders' other half (hideIcons) patches a +// "GuildContainer" component that no longer exists in current Discord builds at all, and its +// icon-collapsing behavior only made sense for the native server rail, which ServerDrawer already +// replaces. This half doesn't touch that component - it only reacts to the same folder-expand +// store/event ServerDrawer's own FolderItem already uses, so it works standalone here. +export function patchAutoCollapseFolders(cleanups: (() => void)[]): boolean { + const ExpandedGuildFolderStore = findByStoreName("ExpandedGuildFolderStore"); + if (!ExpandedGuildFolderStore?.getExpandedFolders) return false; + + const listener = ({ folderId }: { folderId?: string | number }) => { + if (!storage.autoCollapseFolders || folderId == null) return; + + const expanded = ExpandedGuildFolderStore.getExpandedFolders(); + if (!(expanded instanceof Set) || !expanded.has(folderId)) return; + + for (const id of expanded) { + if (id !== folderId) { + FluxDispatcher.dispatch({ type: "TOGGLE_GUILD_FOLDER_EXPAND", folderId: id }); + } + } + }; + + FluxDispatcher.subscribe("TOGGLE_GUILD_FOLDER_EXPAND", listener); + cleanups.push(() => FluxDispatcher.unsubscribe("TOGGLE_GUILD_FOLDER_EXPAND", listener)); + return true; +} diff --git a/plugins/server-drawer/src/ui/Settings.tsx b/plugins/server-drawer/src/ui/Settings.tsx index 3ad9bda..4d171fb 100644 --- a/plugins/server-drawer/src/ui/Settings.tsx +++ b/plugins/server-drawer/src/ui/Settings.tsx @@ -35,6 +35,26 @@ export default function Settings() { onValueChange={(v: boolean) => { storage.showUnreadBadges = v; }} /> + + { storage.autoCollapseFolders = v; }} + /> + { storage.hideFolderIcons = v; }} + /> + + + The folder options above are ported from fres621's BetterFolders - its other half + (hiding icons in the native left server rail) patched a component that no longer + exists in current Discord builds, so it's been rebuilt here instead, where it + actually applies to what you see. + ); } diff --git a/site/meta.json b/site/meta.json index 30ed7ba..cdd9efc 100644 --- a/site/meta.json +++ b/site/meta.json @@ -241,15 +241,17 @@ "category": "Moderation & Appearance", "status": "revived", "accent": "#F97316", - "tagline": "Turns the Quest Dock into an expandable server grid, above the YouBar.", - "note": "Fork of kmmiio99o's ServerDrawer. One lookup (useMobileQuestDock) was missing an optional-chaining guard - if that lookup came back empty, the whole onLoad threw and every patch after it in the sequence never got applied, not just that one surface. Fixed, plus every patch call is now wrapped so a single bad lookup only skips its own surface.", + "tagline": "Turns the Quest Dock into an expandable server grid, with smarter folders.", + "note": "Fork of kmmiio99o's ServerDrawer. One lookup (useMobileQuestDock) was missing an optional-chaining guard - if that lookup came back empty, the whole onLoad threw and every patch after it in the sequence never got applied, not just that one surface. Fixed, plus every patch call is now wrapped so a single bad lookup only skips its own surface. Folder options (auto-collapse, hide preview icons) are adapted from fres621's BetterFolders - its icon-hiding half patched a \"GuildContainer\" component that no longer exists anywhere in current Discord builds (confirmed against decompiled source), and only applied to the native server rail anyway, which this plugin already replaces - so it's been rebuilt as a feature of the drawer's own folders instead.", "howItWorks": "Hijacks the Quest Dock - the strip Discord normally uses for daily quests, right above the tab bar - and puts a grid of your servers there instead. Tap it to expand, tap a server to jump to it, long-press for the usual context menu (mark as read, notification settings, leave, etc). A + button opens Discord's own create/join-server modal. Optionally hides the left server rail down to a single DMs icon, since your servers now live in the drawer instead.", "features": [ "Tap-to-expand server grid with folders, unread badges, and mention counts", "Long-press a server for its real context menu, not a rebuilt one", "One-tap create/join through Discord's native modal", "Optional: collapse the left server rail to a single DMs icon", - "Toggle unread badges independently" + "Toggle unread badges independently", + "Auto-collapse other open folders when you open a new one", + "Optional plain folder icon instead of the 4-server preview when collapsed" ], "commands": [], "limitations": "Depends on several internal Quest Dock lookups (11 in total) - each is individually guarded, so a future Discord rename degrades one surface at a time instead of breaking the whole plugin. Drawer position (left/right/top) is planned but not in this build yet - it currently only replaces the Quest Dock's native bottom position."