mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 09:56:24 +00:00
Merge branch 'dev' into immediate-finds
This commit is contained in:
commit
96054261df
2 changed files with 31 additions and 7 deletions
11
src/plugins/betterFolders/README.md
Normal file
11
src/plugins/betterFolders/README.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# Better Folders
|
||||||
|
|
||||||
|
Better Folders offers a variety of options to improve your folder experience
|
||||||
|
|
||||||
|
Always show the folder icon, regardless of if the folder is open or not
|
||||||
|
|
||||||
|
Only have one folder open at a time
|
||||||
|
|
||||||
|
Open folders in a sidebar:
|
||||||
|
|
||||||
|
![A folder open in a separate sidebar](https://github.com/user-attachments/assets/432d3146-8091-4bae-9c1e-c19046c72947)
|
|
@ -30,9 +30,9 @@ enum FolderIconDisplay {
|
||||||
MoreThanOneFolderExpanded
|
MoreThanOneFolderExpanded
|
||||||
}
|
}
|
||||||
|
|
||||||
const GuildsTree = find(m => m.prototype?.moveNextTo);
|
|
||||||
const SortedGuildStore = findStore("SortedGuildStore");
|
|
||||||
export const ExpandedGuildFolderStore = findStore("ExpandedGuildFolderStore");
|
export const ExpandedGuildFolderStore = findStore("ExpandedGuildFolderStore");
|
||||||
|
const SortedGuildStore = findStore("SortedGuildStore");
|
||||||
|
const GuildsTree = find(m => m.prototype?.moveNextTo);
|
||||||
const FolderUtils = findByProps("move", "toggleGuildFolderExpand");
|
const FolderUtils = findByProps("move", "toggleGuildFolderExpand");
|
||||||
|
|
||||||
let lastGuildId = null as string | null;
|
let lastGuildId = null as string | null;
|
||||||
|
@ -173,13 +173,13 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
predicate: () => !settings.store.keepIcons,
|
predicate: () => !settings.store.keepIcons,
|
||||||
match: /(?<=\.Messages\.SERVER_FOLDER_PLACEHOLDER.+?useTransition\)\()/,
|
match: /(?<=\.Messages\.SERVER_FOLDER_PLACEHOLDER.+?useTransition\)\()/,
|
||||||
replace: "!!arguments[0].isBetterFolders&&"
|
replace: "$self.shouldShowTransition(arguments[0])&&"
|
||||||
},
|
},
|
||||||
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
|
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
|
||||||
{
|
{
|
||||||
predicate: () => !settings.store.keepIcons,
|
predicate: () => !settings.store.keepIcons,
|
||||||
match: /expandedFolderBackground,.+?,(?=\i\(\(\i,\i,\i\)=>{let{key.{0,45}ul)(?<=selected:\i,expanded:(\i),.+?)/,
|
match: /expandedFolderBackground,.+?,(?=\i\(\(\i,\i,\i\)=>{let{key.{0,45}ul)(?<=selected:\i,expanded:(\i),.+?)/,
|
||||||
replace: (m, isExpanded) => `${m}!arguments[0].isBetterFolders&&${isExpanded}?null:`
|
replace: (m, isExpanded) => `${m}$self.shouldRenderContents(arguments[0],${isExpanded})?null:`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
|
// Decide if we should render the expanded folder background if we are rendering the Better Folders sidebar
|
||||||
|
@ -201,7 +201,7 @@ export default definePlugin({
|
||||||
replacement: {
|
replacement: {
|
||||||
// Render the Better Folders sidebar
|
// Render the Better Folders sidebar
|
||||||
match: /(?<=({className:\i\.guilds,themeOverride:\i})\))/,
|
match: /(?<=({className:\i\.guilds,themeOverride:\i})\))/,
|
||||||
replace: ",$self.FolderSideBar($1)"
|
replace: ",$self.FolderSideBar({...$1})"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -306,7 +306,20 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
FolderSideBar: guildsBarProps => <FolderSideBar {...guildsBarProps} />,
|
shouldShowTransition(props: any) {
|
||||||
|
// Pending guilds
|
||||||
|
if (props.folderNode.id === 1) return true;
|
||||||
|
|
||||||
closeFolders
|
return !!props.isBetterFolders;
|
||||||
|
},
|
||||||
|
|
||||||
|
shouldRenderContents(props: any, isExpanded: boolean) {
|
||||||
|
// Pending guilds
|
||||||
|
if (props.folderNode.id === 1) return false;
|
||||||
|
|
||||||
|
return !props.isBetterFolders && isExpanded;
|
||||||
|
},
|
||||||
|
|
||||||
|
FolderSideBar,
|
||||||
|
closeFolders,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue