@ -19,7 +19,7 @@
import { definePluginSettings } from "@api/Settings" ;
import { Devs } from "@utils/constants" ;
import definePlugin , { OptionType } from "@utils/types" ;
import { findByPropsLazy , find StoreLazy } from "@webpack" ;
import { findByPropsLazy , find Lazy, find StoreLazy } from "@webpack" ;
import { FluxDispatcher , i18n , useMemo } from "@webpack/common" ;
import FolderSideBar from "./FolderSideBar" ;
@ -30,7 +30,7 @@ enum FolderIconDisplay {
MoreThanOneFolderExpanded
}
const { GuildsTree } = findByPropsLazy ( "GuildsTree" ) ;
const GuildsTree = findLazy ( m = > m . prototype ? . moveNextTo ) ;
const SortedGuildStore = findStoreLazy ( "SortedGuildStore" ) ;
export const ExpandedGuildFolderStore = findStoreLazy ( "ExpandedGuildFolderStore" ) ;
const FolderUtils = findByPropsLazy ( "move" , "toggleGuildFolderExpand" ) ;
@ -117,7 +117,7 @@ export default definePlugin({
} ,
// If we are rendering the Better Folders sidebar, we filter out guilds that are not in folders and unexpanded folders
{
match : /\[(\i)\]=(\(0,\i\. useStateFromStoresArray \).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
match : /\[(\i)\]=(\(0,\i\. \i \).{0,40}getGuildsTree\(\).+?}\))(?=,)/,
replace : ( _ , originalTreeVar , rest ) = > ` [betterFoldersOriginalTree]= ${ rest } , ${ originalTreeVar } = $ self.getGuildTree(!!arguments[0].isBetterFolders,betterFoldersOriginalTree,arguments[0].betterFoldersExpandedIds) `
} ,
// If we are rendering the Better Folders sidebar, we filter out everything but the servers and folders from the GuildsBar Guild List children
@ -139,12 +139,12 @@ export default definePlugin({
} ,
{
// This is the parent folder component
find : ". MAX_GUILD_FOLDER_NAME_LENGTH, ",
find : ". toggleGuildFolderExpand( ",
predicate : ( ) = > settings . store . sidebar && settings . store . showFolderIcon !== FolderIconDisplay . Always ,
replacement : [
{
// Modify the expanded state to instead return the list of expanded folders
match : /( useStateFromStores \).{0,20}=>)(\i\.\i)\.isFolderExpanded\(\i\)/,
match : /( \i \).{0,20}=>)(\i\.\i)\.isFolderExpanded\(\i\)/,
replace : ( _ , rest , ExpandedGuildFolderStore ) = > ` ${ rest } ${ ExpandedGuildFolderStore } .getExpandedFolders() ` ,
} ,
{
@ -196,7 +196,7 @@ export default definePlugin({
]
} ,
{
find : "APPLICATION_LIBRARY,render ",
find : "APPLICATION_LIBRARY,render : ",
predicate : ( ) = > settings . store . sidebar ,
replacement : {
// Render the Better Folders sidebar