Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
b142cb1700
1 changed files with 10 additions and 19 deletions
|
|
@ -115,7 +115,7 @@ function VencordPopoutIcon() {
|
|||
);
|
||||
}
|
||||
|
||||
function VencordPopoutButton() {
|
||||
function VencordPopoutButton({ buttonClass }: { buttonClass: string; }) {
|
||||
const buttonRef = useRef(null);
|
||||
const [show, setShow] = useState(false);
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ function VencordPopoutButton() {
|
|||
{(_, { isShown }) => (
|
||||
<HeaderBarIcon
|
||||
ref={buttonRef}
|
||||
className="vc-toolbox-btn"
|
||||
className={`vc-toolbox-btn ${buttonClass}`}
|
||||
onClick={() => setShow(v => !v)}
|
||||
tooltip={isShown ? null : "Equicord Toolbox"}
|
||||
icon={() => VencordPopoutIcon()}
|
||||
|
|
@ -144,17 +144,6 @@ function VencordPopoutButton() {
|
|||
);
|
||||
}
|
||||
|
||||
function ToolboxFragmentWrapper({ children }: { children: ReactNode[]; }) {
|
||||
children.splice(
|
||||
children.length - 1, 0,
|
||||
<ErrorBoundary noop>
|
||||
<VencordPopoutButton />
|
||||
</ErrorBoundary>
|
||||
);
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
migratePluginSettings("EquicordToolbox", "VencordToolbox");
|
||||
export default definePlugin({
|
||||
name: "EquicordToolbox",
|
||||
|
|
@ -163,15 +152,17 @@ export default definePlugin({
|
|||
|
||||
patches: [
|
||||
{
|
||||
find: ".controlButtonWrapper,",
|
||||
find: '"M9 3v18"',
|
||||
replacement: {
|
||||
match: /(?<=function (\i).{0,100}\()\i.Fragment,(?=.+?toolbar:\1\(\))/,
|
||||
replace: "$self.ToolboxFragmentWrapper,"
|
||||
match: /focusSectionProps:"HELP".{0,20},className:(\i\.button)\}\),/,
|
||||
replace: "$& $self.renderVencordPopoutButton($1),"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
ToolboxFragmentWrapper: ErrorBoundary.wrap(ToolboxFragmentWrapper, {
|
||||
fallback: () => <p style={{ color: "red" }}>Failed to render :(</p>
|
||||
})
|
||||
renderVencordPopoutButton: (buttonClass: string) => (
|
||||
<ErrorBoundary noop>
|
||||
<VencordPopoutButton buttonClass={buttonClass} />
|
||||
</ErrorBoundary>
|
||||
)
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue