mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-16 18:07:02 -04:00
Fixes For Patches
Co-Authored-By: sadan4 <117494111+sadan4@users.noreply.github.com>
This commit is contained in:
parent
06c3ea5b01
commit
6e2c8e5984
5 changed files with 52 additions and 28 deletions
|
@ -119,7 +119,7 @@ export default definePlugin({
|
|||
predicate: () => settings.store.sidebar,
|
||||
replacement: [
|
||||
// Create the isBetterFolders variable in the GuildsBar component
|
||||
// Needed because we access this from a closure so we can't use arguments[0]
|
||||
// Needed because we access this from a non-arrow closure so we can't use arguments[0]
|
||||
{
|
||||
match: /let{disableAppDownload:\i=\i\.isPlatformEmbedded,isOverlay:.+?(?=}=\i,)/,
|
||||
replace: "$&,isBetterFolders"
|
||||
|
@ -156,6 +156,18 @@ export default definePlugin({
|
|||
match: /(?=\(0,\i\.jsxs?\)[^0]+fullWidth:)/,
|
||||
replace: "!!arguments[0]?.isBetterFolders?null:"
|
||||
},
|
||||
// On the other sidebar version, dms are rendered separately.
|
||||
// We need to filter them out
|
||||
{
|
||||
match: /fullWidth:!0.+?lurkingGuildIds.+?\]/,
|
||||
replace: "$&.filter($self.makeGuildsBarTreeFilter(!!arguments[0]?.isBetterFolders))"
|
||||
},
|
||||
// if you click the (NEW) button on the better folders sidebar
|
||||
// it will end up in some infinite loop
|
||||
{
|
||||
match: /unreadMentionsFixedFooter\].+?\]/,
|
||||
replace: "$&.filter($self.makeNewButtonFilter(!!arguments[0]?.isBetterFolders))"
|
||||
},
|
||||
// Export the isBetterFolders variable to the folders component
|
||||
{
|
||||
match: /switch\(\i\.type\){case \i\.\i\.FOLDER:.+?folderNode:\i,/,
|
||||
|
@ -184,7 +196,7 @@ export default definePlugin({
|
|||
]
|
||||
},
|
||||
{
|
||||
find: ".expandedFolderBackground,",
|
||||
find: ".FOLDER_ITEM_ANIMATION_DURATION),",
|
||||
predicate: () => settings.store.sidebar,
|
||||
replacement: [
|
||||
// We use arguments[0] to access the isBetterFolders variable in this nested folder component (the parent exports all the props so we don't have to patch it)
|
||||
|
@ -204,27 +216,20 @@ export default definePlugin({
|
|||
// If we are rendering the normal GuildsBar sidebar, we avoid rendering guilds from folders that are expanded
|
||||
{
|
||||
predicate: () => !settings.store.keepIcons,
|
||||
match: /expandedFolderBackground,.+?,(?=\i\(\(\i,\i,\i\)=>{let{key.{0,45}ul)(?<=selected:\i,expanded:(\i),.+?)/,
|
||||
match: /folderGroupBackground.*?,(?=\i\(\(\i,\i,\i\)=>{let{key.+?"ul")(?<=selected:\i,expanded:(\i),.+?)/,
|
||||
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
|
||||
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||
match: /\.isExpanded\),.{0,30}children:\[/,
|
||||
match: /\.isExpanded].{0,110}children:\[/,
|
||||
replace: "$&$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)&&"
|
||||
},
|
||||
// Decide if we should render the expanded folder icon if we are rendering the Better Folders sidebar
|
||||
{
|
||||
// Decide if we should render the expanded folder icon if we are rendering the Better Folders sidebar
|
||||
predicate: () => settings.store.showFolderIcon !== FolderIconDisplay.Always,
|
||||
match: /(?<=\.expandedFolderBackground.+?}\),)(?=\i,)/,
|
||||
match: /(?<=\.folderGroupBackground.*?}\),)(?=\i,)/,
|
||||
replace: "!$self.shouldShowFolderIconAndBackground(!!arguments[0]?.isBetterFolders,arguments[0]?.betterFoldersExpandedIds)?null:"
|
||||
},
|
||||
{
|
||||
// Discord adds a slight bottom margin of 4px when it's expanded
|
||||
// Which looks off when there's nothing open in the folder
|
||||
predicate: () => !settings.store.keepIcons,
|
||||
match: /(?=className:.{0,50}folderIcon)/,
|
||||
replace: "style:arguments[0]?.isBetterFolders?{}:{marginBottom:0},"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -340,7 +345,6 @@ export default definePlugin({
|
|||
makeGuildsBarTreeFilter(isBetterFolders: boolean) {
|
||||
return child => {
|
||||
if (!isBetterFolders) return true;
|
||||
|
||||
return !!child?.props?.renderTreeNode;
|
||||
};
|
||||
},
|
||||
|
@ -360,6 +364,14 @@ export default definePlugin({
|
|||
}
|
||||
},
|
||||
|
||||
makeNewButtonFilter(isBetterFolders: boolean) {
|
||||
return child => {
|
||||
if (!isBetterFolders) return true;
|
||||
|
||||
return !child?.props?.barClassName;
|
||||
};
|
||||
},
|
||||
|
||||
shouldShowTransition(props: any) {
|
||||
// Pending guilds
|
||||
if (props?.folderNode?.id === 1) return true;
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import "./styles.css";
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
|
@ -23,21 +25,18 @@ export default definePlugin({
|
|||
name: "PlainFolderIcon",
|
||||
description: "Doesn't show the small guild icons in folders",
|
||||
authors: [Devs.botato],
|
||||
|
||||
folderClassName: "vc-plainFolderIcon-plain",
|
||||
|
||||
patches: [{
|
||||
find: ".expandedFolderIconWrapper",
|
||||
find: ".folderPreviewGuildIconError",
|
||||
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",
|
||||
// Discord always renders both and uses a css transtion to switch bewteen them
|
||||
match: /.folderButtonContent]:(!\i)/,
|
||||
replace: (m, cond) => `${m},[$self.folderClassName]:${cond}`
|
||||
}
|
||||
|
||||
]
|
||||
}]
|
||||
});
|
||||
|
|
12
src/plugins/plainFolderIcon/styles.css
Normal file
12
src/plugins/plainFolderIcon/styles.css
Normal file
|
@ -0,0 +1,12 @@
|
|||
.vc-plainFolderIcon-plain {
|
||||
/* Without this, this are a bit laggier */
|
||||
transition: none !important;
|
||||
|
||||
/* Don't show the mini guild icons */
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.vc-plainFolderIcon-plain svg {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
}
|
|
@ -76,6 +76,7 @@ export default definePlugin({
|
|||
},
|
||||
|
||||
patches: [
|
||||
// In the user popout. eg: when clicking the name in chat
|
||||
{
|
||||
find: ".POPOUT,user:",
|
||||
replacement: {
|
||||
|
@ -90,8 +91,8 @@ export default definePlugin({
|
|||
replace: "$1$self.BiteSizeReviewsButton({user:arguments[0].user}),$2"
|
||||
}
|
||||
},
|
||||
// places like the user profile on the right in dms
|
||||
{
|
||||
// places like the user profile on the right in dms
|
||||
find: 'location:"UserProfileSiebar"',
|
||||
replacement: {
|
||||
match: /(children:\[)([^[]+shouldShowTooltip:)/,
|
||||
|
|
|
@ -357,7 +357,7 @@ export default definePlugin({
|
|||
]
|
||||
},
|
||||
{
|
||||
find: "overflowCountVariant",
|
||||
find: ".SIZE_24,overflowCountVariant:",
|
||||
replacement: [
|
||||
{
|
||||
// Create a variable for the channel prop
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue