mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-11 02:16:23 +00:00
fixing some bugs to adapt with the new TablistComponents data type
This commit is contained in:
parent
955232f4d6
commit
c7244d8b26
2 changed files with 15 additions and 16 deletions
|
@ -1,4 +1,5 @@
|
||||||
import { Channel } from "discord-types/general";
|
import { Channel } from "discord-types/general";
|
||||||
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
//import { Logger } from "@utils/Logger";
|
//import { Logger } from "@utils/Logger";
|
||||||
|
|
||||||
//const logger = new Logger("Tablist"); useless
|
//const logger = new Logger("Tablist"); useless
|
||||||
|
@ -44,24 +45,22 @@ export const addTablistButton = (id: string, tab: string, PanelComponent: Tablis
|
||||||
export const removeTablistButton = (id: string) => TablistComponents.delete(id);
|
export const removeTablistButton = (id: string) => TablistComponents.delete(id);
|
||||||
|
|
||||||
|
|
||||||
export function* RenderButtons(TablistButtonComponent: TablistButtonComponent, selectedTab: string, expressionMate: ExpressionMate) {
|
export function* RenderButtons(TablistButtonComponent: TablistButtonComponent, selectedTab: string) {
|
||||||
for (const tab in TablistComponents) {
|
for (const [id, { tab }] of TablistComponents) {
|
||||||
yield (<TablistButtonComponent
|
yield (<TablistButtonComponent
|
||||||
id={tab + "-picker-tab"}
|
id={id + "-picker-tab"}
|
||||||
aria-controls={tab + "-picker-tab-panel"}
|
aria-controls={id + "-picker-tab-panel"}
|
||||||
aria-selected={tab === selectedTab}
|
aria-selected={id === selectedTab}
|
||||||
viewType={tab}
|
viewType={id}
|
||||||
isActive={tab === selectedTab}
|
isActive={id === selectedTab}
|
||||||
expressionMate={expressionMate}
|
>{tab}</TablistButtonComponent>);
|
||||||
>{TablistComponents[tab].tab}
|
|
||||||
</TablistButtonComponent>);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function* TabPanels(selectedTab: string, expressionMate: ExpressionMate, channel: Channel) {
|
export function* TabPanels(selectedTab: string, expressionMate: ExpressionMate, channel: Channel) {
|
||||||
for (const tab in TablistComponents) {
|
for (const [id, { Component }] of TablistComponents) {
|
||||||
if (tab !== selectedTab) { continue; }
|
if (id !== selectedTab) { continue; }
|
||||||
let PanelComponent: TablistPanelComponent = TablistComponents[tab].Component;
|
let PanelComponent: TablistPanelComponent = Component;
|
||||||
yield (<PanelComponent selectedTab={selectedTab} channel={channel} expressionMate={expressionMate} />);
|
yield (<ErrorBoundary><PanelComponent selectedTab={selectedTab} channel={channel} expressionMate={expressionMate} /></ErrorBoundary>);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ export default definePlugin({
|
||||||
find: ".EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL",
|
find: ".EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /\.jsx)\((\i),\{id:\i\.\i,.+?,"aria-selected":(\i)===.+?,viewType:(\i).+?\}\)/,//\]
|
match: /\.jsx\)\((\i),\{id:\i\.E\i,.+?,"aria-selected":(\i)===\i\.\i\.EMOJI.+?,viewType:(\i).+?\}\)/,
|
||||||
replace: "$&,...Vencord.Api.Tablist.RenderButtons($1, $2, $3)"
|
replace: "$&,...Vencord.Api.Tablist.RenderButtons($1, $2)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /null,(\i)===(\i)\.ExpressionPickerViewType\.EMOJI\?.{0,55}channel:(\i),.+?\):null/,
|
match: /null,(\i)===(\i)\.ExpressionPickerViewType\.EMOJI\?.{0,55}channel:(\i),.+?\):null/,
|
||||||
|
|
Loading…
Reference in a new issue