diff --git a/src/plugins/betterFolders/index.tsx b/src/plugins/betterFolders/index.tsx index 2b1defd8..b5049883 100644 --- a/src/plugins/betterFolders/index.tsx +++ b/src/plugins/betterFolders/index.tsx @@ -61,7 +61,7 @@ function filterTreeWithTargetNode(children: any, predicate: (node: any) => boole return true; } - return filterTreeWithTargetNode(children.props.children, predicate); + return filterTreeWithTargetNode(children.props?.children, predicate); } @@ -150,7 +150,7 @@ export default definePlugin({ }, // Export the isBetterFolders and betterFoldersExpandedIds variable to the Guild List component { - match: /0,\i\.jsxs?[^0}]{0,100}guildDiscoveryButton:\i,/g, + match: /,{guildDiscoveryButton:\i,/g, replace: "$&isBetterFolders:arguments[0]?.isBetterFolders,betterFoldersExpandedIds:arguments[0]?.betterFoldersExpandedIds," }, // Export the isBetterFolders variable to the folders component @@ -349,7 +349,12 @@ export default definePlugin({ return true; } - return filterTreeWithTargetNode(child, child => child?.props?.renderTreeNode != null); + try { + return filterTreeWithTargetNode(child, child => child?.props?.renderTreeNode != null); + } catch (e) { + console.error(e); + return true; + } }; }, diff --git a/src/plugins/mutualGroupDMs/index.tsx b/src/plugins/mutualGroupDMs/index.tsx index 42f4f2e3..f06cac0c 100644 --- a/src/plugins/mutualGroupDMs/index.tsx +++ b/src/plugins/mutualGroupDMs/index.tsx @@ -59,22 +59,21 @@ function renderClickableGDMs(mutualDms: Channel[], onClose: () => void) { return mutualDms.map(c => ( { onClose(); SelectedChannelActionCreators.selectPrivateChannel(c.id); }} > -
- - -
-
{getGroupDMName(c)}
-
{c.recipients.length + 1} Members
-
+ + +
+
{getGroupDMName(c)}
+
{c.recipients.length + 1} Members
)); diff --git a/src/plugins/plainFolderIcon/index.ts b/src/plugins/plainFolderIcon/index.ts index bb6876b5..8eb87896 100644 --- a/src/plugins/plainFolderIcon/index.ts +++ b/src/plugins/plainFolderIcon/index.ts @@ -16,28 +16,27 @@ * along with this program. If not, see . */ +import "./style.css"; + import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; export default definePlugin({ name: "PlainFolderIcon", - description: "Doesn't show the small guild icons in folders", + description: "Dont show the small guild icons in folders", authors: [Devs.botato], - patches: [{ - find: ".expandedFolderIconWrapper", - replacement: [ - // there are two elements, the first one is the plain folder icon - // the second is the four guild preview icons - // always show this one (the plain icons) - { - match: /\(\i\|\|\i\)&&(\(.{0,40}\(\i\.animated)/, - replace: "$1", - }, - // and never show this one (the guild preview icons) - { - match: /\(\i\|\|!\i\)&&(\(.{0,40}\(\i\.animated)/, - replace: "false&&$1", - } - ] - }] + + patches: [ + { + find: ".folderPreviewGuildIconError", + replacement: [ + { + // Discord always renders both plain and guild icons folders and uses a css transtion to switch between them + match: /(?<=.folderButtonContent]:(!\i))/, + replace: (_, hasFolderButtonContentClass) => `,"vc-plainFolderIcon-plain":${hasFolderButtonContentClass}` + } + + ] + } + ] }); diff --git a/src/plugins/plainFolderIcon/style.css b/src/plugins/plainFolderIcon/style.css new file mode 100644 index 00000000..70a49078 --- /dev/null +++ b/src/plugins/plainFolderIcon/style.css @@ -0,0 +1,10 @@ +.vc-plainFolderIcon-plain { + /* Without this, they are a bit laggier */ + transition: none !important; + + /* Don't show the mini guild icons */ + transform: translateZ(0); + + /* The new icons are fully transparent. Add a sane default to match the old behavior */ + background-color: color-mix(in oklab, var(--custom-folder-color, var(--bg-brand)) 30%, var(--background-surface-higher) 70%); +}