1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 18:06:22 +00:00

name update, and added ErrorBoundary to RenderTabButtons

This commit is contained in:
programminglaboratorys 2024-05-20 20:15:39 +03:00 committed by GitHub
parent cf5886eac6
commit 2b252c4011
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 9 deletions

View file

@ -45,15 +45,15 @@ 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) { export function* RenderTabButtons(TablistButtonComponent: TablistButtonComponent, selectedTab: string) {
for (const [id, { tab }] of TablistComponents) { for (const [id, { tab }] of TablistComponents) {
yield (<TablistButtonComponent yield (<ErrorBoundary><TablistButtonComponent
id={id + "-picker-tab"} id={id + "-picker-tab"}
aria-controls={id + "-picker-tab-panel"} aria-controls={id + "-picker-tab-panel"}
aria-selected={id === selectedTab} aria-selected={id === selectedTab}
viewType={id} viewType={id}
isActive={id === selectedTab} isActive={id === selectedTab}
>{tab}</TablistButtonComponent>); >{tab}</TablistButtonComponent></ErrorBoundary>);
} }
} }

View file

@ -31,7 +31,7 @@ import * as $Notifications from "./Notifications";
import * as $ServerList from "./ServerList"; import * as $ServerList from "./ServerList";
import * as $Settings from "./Settings"; import * as $Settings from "./Settings";
import * as $Styles from "./Styles"; import * as $Styles from "./Styles";
import * as $Tablist from "./Tablist"; import * as $ExpressionPickerTabs from "./ExpressionPickerTabs";
/** /**
* An API allowing you to listen to Message Clicks or run your own logic * An API allowing you to listen to Message Clicks or run your own logic
@ -115,4 +115,4 @@ export const ChatButtons = $ChatButtons;
/** /**
* An API allowing you to add panels to the expression picker * An API allowing you to add panels to the expression picker
*/ */
export const Tablist = $Tablist; export const ExpressionPickerTabs = $ExpressionPickerTabs;

View file

@ -3,8 +3,8 @@ import { Devs } from "@utils/constants";
export default definePlugin({ export default definePlugin({
name: "TablistApi", name: "ExpressionPickerTabsAPI",
description: "API to add panels to the expression picker", description: "an API to add panels to the expression picker",
authors: [Devs.iamme], authors: [Devs.iamme],
patches: [ patches: [
{ {
@ -12,11 +12,11 @@ export default definePlugin({
replacement: [ replacement: [
{ {
match: /\.jsx\)\((\i),\{id:\i\.E\i,.+?,"aria-selected":(\i)===\i\.\i\.EMOJI.+?,viewType:(\i).+?\}\)/, match: /\.jsx\)\((\i),\{id:\i\.E\i,.+?,"aria-selected":(\i)===\i\.\i\.EMOJI.+?,viewType:(\i).+?\}\)/,
replace: "$&,...Vencord.Api.Tablist.RenderButtons($1, $2)" replace: "$&,...Vencord.Api.ExpressionPickerTabs.RenderTabButtons($1, $2)"
}, },
{ {
match: /null,(\i)===(\i)\.ExpressionPickerViewType\.EMOJI\?.{0,55}channel:(\i),.+?\):null/, match: /null,(\i)===(\i)\.ExpressionPickerViewType\.EMOJI\?.{0,55}channel:(\i),.+?\):null/,
replace: "$&,...Vencord.Api.Tablist.TabPanels($1, $2, $3)" replace: "$&,...Vencord.Api.ExpressionPickerTabs.TabPanels($1, $2, $3)"
} }
] ]
} }