mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 18:06:22 +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 ErrorBoundary from "@components/ErrorBoundary";
|
||||
//import { Logger } from "@utils/Logger";
|
||||
|
||||
//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 function* RenderButtons(TablistButtonComponent: TablistButtonComponent, selectedTab: string, expressionMate: ExpressionMate) {
|
||||
for (const tab in TablistComponents) {
|
||||
export function* RenderButtons(TablistButtonComponent: TablistButtonComponent, selectedTab: string) {
|
||||
for (const [id, { tab }] of TablistComponents) {
|
||||
yield (<TablistButtonComponent
|
||||
id={tab + "-picker-tab"}
|
||||
aria-controls={tab + "-picker-tab-panel"}
|
||||
aria-selected={tab === selectedTab}
|
||||
viewType={tab}
|
||||
isActive={tab === selectedTab}
|
||||
expressionMate={expressionMate}
|
||||
>{TablistComponents[tab].tab}
|
||||
</TablistButtonComponent>);
|
||||
id={id + "-picker-tab"}
|
||||
aria-controls={id + "-picker-tab-panel"}
|
||||
aria-selected={id === selectedTab}
|
||||
viewType={id}
|
||||
isActive={id === selectedTab}
|
||||
>{tab}</TablistButtonComponent>);
|
||||
}
|
||||
}
|
||||
|
||||
export function* TabPanels(selectedTab: string, expressionMate: ExpressionMate, channel: Channel) {
|
||||
for (const tab in TablistComponents) {
|
||||
if (tab !== selectedTab) { continue; }
|
||||
let PanelComponent: TablistPanelComponent = TablistComponents[tab].Component;
|
||||
yield (<PanelComponent selectedTab={selectedTab} channel={channel} expressionMate={expressionMate} />);
|
||||
for (const [id, { Component }] of TablistComponents) {
|
||||
if (id !== selectedTab) { continue; }
|
||||
let PanelComponent: TablistPanelComponent = Component;
|
||||
yield (<ErrorBoundary><PanelComponent selectedTab={selectedTab} channel={channel} expressionMate={expressionMate} /></ErrorBoundary>);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@ export default definePlugin({
|
|||
find: ".EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL",
|
||||
replacement: [
|
||||
{
|
||||
match: /\.jsx)\((\i),\{id:\i\.\i,.+?,"aria-selected":(\i)===.+?,viewType:(\i).+?\}\)/,//\]
|
||||
replace: "$&,...Vencord.Api.Tablist.RenderButtons($1, $2, $3)"
|
||||
match: /\.jsx\)\((\i),\{id:\i\.E\i,.+?,"aria-selected":(\i)===\i\.\i\.EMOJI.+?,viewType:(\i).+?\}\)/,
|
||||
replace: "$&,...Vencord.Api.Tablist.RenderButtons($1, $2)"
|
||||
},
|
||||
{
|
||||
match: /null,(\i)===(\i)\.ExpressionPickerViewType\.EMOJI\?.{0,55}channel:(\i),.+?\):null/,
|
||||
|
|
Loading…
Reference in a new issue