Joona Fixes

This commit is contained in:
thororen1234 2024-07-28 23:49:43 -04:00
parent c975439e9a
commit bdf4025191
4 changed files with 48 additions and 17 deletions

View file

@ -60,6 +60,12 @@ export const settings = definePluginSettings({
description: "Whether the permissions dropdown on user popouts should be open by default", description: "Whether the permissions dropdown on user popouts should be open by default",
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
default: false, default: false,
},
preferButtonOverDropdown: {
description: "Show a button next to the roles instead of dropdown",
type: OptionType.BOOLEAN,
default: false,
restartNeeded: true
} }
}); });
@ -178,10 +184,18 @@ export default definePlugin({
}, },
{ {
find: ".VIEW_ALL_ROLES,", find: ".VIEW_ALL_ROLES,",
replacement: { replacement: [
match: /children:"\+"\.concat\(\i\.length-\i\.length\).{0,20}\}\),/, {
replace: "$&$self.ViewPermissionsButton(arguments[0])," match: /children:"\+"\.concat\(\i\.length-\i\.length\).{0,20}\}\),/,
} replace: "$&$self.ViewPermissionsButton(arguments[0]),",
predicate: () => settings.store.preferButtonOverDropdown
},
{
match: /0!==\i\.length\|\|\i\?\(0,.+?guild:(\i),guildMember:(\i).+?null/,
replace: "[$&,$self.UserPermissions($1,$2)]",
predicate: () => !settings.store.preferButtonOverDropdown
}
]
} }
], ],

View file

@ -85,12 +85,21 @@ export default definePlugin({
replace: "$&,$self.getReviewsComponent($1)" replace: "$&,$self.getReviewsComponent($1)"
} }
}, },
{
find: /inline:!1,profileViewedAnalytics:\i}\),/,
replacement: {
match: /currentUser:\i,guild:\i}\)(?<=user:(\i),bio:null==\i\?.+?)/,
replace: "$&,$self.getReviewsComponent($1)"
},
predicate: () => !settings.store.preferButtonOverDropdown
},
{ {
find: ".BITE_SIZE,user:", find: ".BITE_SIZE,user:",
replacement: { replacement: {
match: /(?<=\.BITE_SIZE,children:\[)\(0,\i\.jsx\)\(\i\.\i,\{user:(\i),/, match: /(?<=\.BITE_SIZE,children:\[)\(0,\i\.jsx\)\(\i\.\i,\{user:(\i),/,
replace: "$self.BiteSizeReviewsButton({user:$1}),$&" replace: "$self.BiteSizeReviewsButton({user:$1}),$&"
} },
predicate: () => settings.store.preferButtonOverDropdown
} }
], ],

View file

@ -54,6 +54,12 @@ export const settings = definePluginSettings({
description: "Hide reviews from blocked users", description: "Hide reviews from blocked users",
default: true, default: true,
}, },
preferButtonOverDropdown: {
description: "Show a button instead of dropdown to view reviews",
type: OptionType.BOOLEAN,
default: false,
restartNeeded: true
},
buttons: { buttons: {
type: OptionType.COMPONENT, type: OptionType.COMPONENT,
description: "ReviewDB buttons", description: "ReviewDB buttons",

View file

@ -20,7 +20,6 @@ import "./styles.css";
import { definePluginSettings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary"; import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { CopyIcon, LinkIcon } from "@components/Icons"; import { CopyIcon, LinkIcon } from "@components/Icons";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { copyWithToast } from "@utils/misc"; import { copyWithToast } from "@utils/misc";
@ -106,13 +105,23 @@ function ConnectionsComponent({ id, theme, simplified }: { id: string, theme: st
return null; return null;
const connectionsContainer = ( const connectionsContainer = (
<Flex style={{ <div style={{
marginTop: !simplified ? "8px" : undefined, marginTop: !simplified ? "8px" : undefined,
gap: getSpacingPx(settings.store.iconSpacing), gap: getSpacingPx(settings.store.iconSpacing),
flexWrap: "wrap" flexWrap: "wrap"
}}> }}>
<Text
tag="h2"
variant="eyebrow"
style={{
color: "var(--header-primary)",
marginBottom: "4px"
}}
>
Connections
</Text>
{connections.map(connection => <CompactConnectionComponent connection={connection} theme={theme} />)} {connections.map(connection => <CompactConnectionComponent connection={connection} theme={theme} />)}
</Flex> </div>
); );
if (simplified) if (simplified)
@ -120,13 +129,6 @@ function ConnectionsComponent({ id, theme, simplified }: { id: string, theme: st
return ( return (
<Section> <Section>
<Text
tag="h2"
variant="eyebrow"
style={{ color: "var(--header-primary)" }}
>
Connections
</Text>
{connectionsContainer} {connectionsContainer}
</Section> </Section>
); );
@ -211,9 +213,9 @@ export default definePlugin({
} }
}, },
{ {
find: /\.bio,hidePersonalInformation:\i,onClose:/, find: /inline:!1,profileViewedAnalytics:\i}\),/,
replacement: { replacement: {
match: /currentUser:\i,guild:\i,onOpenProfile:.+?}\)(?=])(?<=user:(\i),bio:null==(\i)\?.+?)/, match: /currentUser:\i,guild:\i}\)(?<=user:(\i),bio:null==(\i)\?.+?)/,
replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2, simplified: true })" replace: "$&,$self.profilePopoutComponent({ user: $1, displayProfile: $2, simplified: true })"
} }
} }