Merge pull request #104 from V3L0C1T13S/stable

[Feat] Fix goosemod by making dashboard code cleaner
pull/106/head
dperolio 2 years ago committed by GitHub
commit 6c34a027ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -4,7 +4,7 @@
import { SettingsContextMenu } from '@vizality/components/vizality';
import { getModule, contextMenu } from '@vizality/webpack';
import { forceUpdateElement } from '@vizality/util/react';
import { forceUpdateElement, findInReactTree } from '@vizality/util/react';
import { patch, unpatch } from '@vizality/patcher';
import { Builtin } from '@vizality/entities';
import { Icon } from '@vizality/components';
@ -100,21 +100,19 @@ export default class Dashboard extends Builtin {
const { LinkButton } = getModule('LinkButton');
patch('vz-dashboard-private-channels-list-item', ConnectedPrivateChannelsList, 'default', (_, res) => {
try {
if (!res.props?.children?.props?.children) {
return;
}
const { children: list } = findInReactTree(res, (c) => c.channels);
res.props.children.props.children = [
...res.props.children.props.children.slice(0, 0),
if (!list) return;
list.unshift(
<LinkButton
icon={() => <Icon name='vizality' />}
route='/vizality'
text='Dashboard'
selected={vizality.api.routes.getLocation()?.pathname?.startsWith('/vizality')}
onContextMenu={evt => openContextMenu(evt, () => <SettingsContextMenu />)}
/>,
...res.props.children.props.children.slice(0)
];
/>
);
} catch (err) {
return this.error(this._labels.concat('_injectPrivateTab'), err);
}

Loading…
Cancel
Save