1
0
Fork 1
mirror of https://github.com/Vendicated/Vencord.git synced 2025-01-10 09:56:24 +00:00

resolving conflicts

This commit is contained in:
programminglaboratorys 2024-06-08 12:38:38 +03:00
parent 65970618d8
commit 24202b0b2f
4 changed files with 211 additions and 109 deletions

View file

@ -0,0 +1,61 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import ErrorBoundary from "@components/ErrorBoundary";
import { Channel } from "discord-types/general";
export interface ExpressionPickerButtonProps {
id?: string;
"aria-controls": string;
"aria-selected": boolean;
isActive: boolean;
viewType: string;
children: string | JSX.Element;
autoFocus?: boolean;
[key: string]: any;
}
export interface ExpressionPickerPanelProps {
selectedTab: string;
channel: Channel;
}
export type ExpressionPickerButtonComponent = (props: ExpressionPickerButtonProps) => JSX.Element | null;
export type ExpressionPickerPanelComponent = (props: ExpressionPickerPanelProps) => JSX.Element | null;
export interface ExpressionPickerTabItem {
tab: string,
Component: ExpressionPickerPanelComponent;
autoFocus?: boolean;
}
const ExpressionPickerComponents = new Map<string, ExpressionPickerTabItem>();
export const addExpressionPickerTabButton = (id: string, tab: string, PanelComponent: ExpressionPickerPanelComponent, autoFocus?: boolean) => ExpressionPickerComponents.set(id, { tab: tab, Component: PanelComponent, autoFocus: autoFocus });
export const removeExpressionPickerTabButton = (id: string) => ExpressionPickerComponents.delete(id);
export function* RenderTabButtons(ExpressionPickerButtonComponent: ExpressionPickerButtonComponent, selectedTab: string) {
for (const [id, { tab }] of ExpressionPickerComponents) {
yield (<ErrorBoundary><ExpressionPickerButtonComponent
id={id + "-picker-tab"}
aria-controls={id + "-picker-tab-panel"}
aria-selected={id === selectedTab}
viewType={id}
isActive={id === selectedTab}
>{tab}</ExpressionPickerButtonComponent></ErrorBoundary>);
}
}
export function* TabPanels(selectedTab: string, channel: Channel) {
for (const [id, { Component }] of ExpressionPickerComponents) {
if (id !== selectedTab) { continue; }
const PanelComponent: ExpressionPickerPanelComponent = Component;
yield (<ErrorBoundary><PanelComponent selectedTab={selectedTab} channel={channel} /></ErrorBoundary>);
}
}

View file

@ -14,13 +14,14 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import * as $Badges from "./Badges"; import * as $Badges from "./Badges";
import * as $ChatButtons from "./ChatButtons"; import * as $ChatButtons from "./ChatButtons";
import * as $Commands from "./Commands"; import * as $Commands from "./Commands";
import * as $ContextMenu from "./ContextMenu"; import * as $ContextMenu from "./ContextMenu";
import * as $DataStore from "./DataStore"; import * as $DataStore from "./DataStore";
import * as $ExpressionPickerTabs from "./ExpressionPickerTabs";
import * as $MemberListDecorators from "./MemberListDecorators"; import * as $MemberListDecorators from "./MemberListDecorators";
import * as $MessageAccessories from "./MessageAccessories"; import * as $MessageAccessories from "./MessageAccessories";
import * as $MessageDecorations from "./MessageDecorations"; import * as $MessageDecorations from "./MessageDecorations";
@ -116,3 +117,8 @@ export const ChatButtons = $ChatButtons;
* An API allowing you to update and re-render messages * An API allowing you to update and re-render messages
*/ */
export const MessageUpdater = $MessageUpdater; export const MessageUpdater = $MessageUpdater;
/**
* An API allowing you to add panels to the expression picker
*/
export const ExpressionPickerTabs = $ExpressionPickerTabs;

View file

@ -0,0 +1,30 @@
/*
* Vencord, a Discord client mod
* Copyright (c) 2024 Vendicated and contributors
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { Devs } from "@utils/constants";
import definePlugin from "@utils/types";
export default definePlugin({
name: "ExpressionPickerTabsAPI",
description: "an API to add panels to the expression picker",
authors: [Devs.iamme],
patches: [
{
find: ".EXPRESSION_PICKER_CATEGORIES_A11Y_LABEL",
replacement: [
{
match: /\.jsx\)\((\i),\{id:\i\.E\i,.+?,"aria-selected":(\i)===\i\.\i\.EMOJI.+?,viewType:(\i).+?\}\)/,
replace: "$&,...Vencord.Api.ExpressionPickerTabs.RenderTabButtons($1, $2)"
},
{
match: /null,(\i)===\i\.ExpressionPickerViewType\.EMOJI\?.{0,55}channel:(\i),.+?\):null/,
replace: "$&,...Vencord.Api.ExpressionPickerTabs.TabPanels($1, $2)"
}
]
}
]
});

View file

@ -14,7 +14,7 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
export const WEBPACK_CHUNK = "webpackChunkdiscord_app"; export const WEBPACK_CHUNK = "webpackChunkdiscord_app";
export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; export const REACT_GLOBAL = "Vencord.Webpack.Common.React";
@ -39,27 +39,27 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
Ven: { Ven: {
name: "Vendicated", name: "Vendicated",
id: 343383572805058560n id: 343383572805058560n,
}, },
Arjix: { Arjix: {
name: "ArjixWasTaken", name: "ArjixWasTaken",
id: 674710789138939916n id: 674710789138939916n,
}, },
Cyn: { Cyn: {
name: "Cynosphere", name: "Cynosphere",
id: 150745989836308480n id: 150745989836308480n,
}, },
Trwy: { Trwy: {
name: "trey", name: "trey",
id: 354427199023218689n id: 354427199023218689n,
}, },
Megu: { Megu: {
name: "Megumin", name: "Megumin",
id: 545581357812678656n id: 545581357812678656n,
}, },
botato: { botato: {
name: "botato", name: "botato",
id: 440990343899643943n id: 440990343899643943n,
}, },
fawn: { fawn: {
name: "fawn", name: "fawn",
@ -67,11 +67,11 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
rushii: { rushii: {
name: "rushii", name: "rushii",
id: 295190422244950017n id: 295190422244950017n,
}, },
Glitch: { Glitch: {
name: "Glitchy", name: "Glitchy",
id: 269567451199569920n id: 269567451199569920n,
}, },
Samu: { Samu: {
name: "Samu", name: "Samu",
@ -79,19 +79,19 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
Nyako: { Nyako: {
name: "nyako", name: "nyako",
id: 118437263754395652n id: 118437263754395652n,
}, },
MaiKokain: { MaiKokain: {
name: "Mai", name: "Mai",
id: 722647978577363026n id: 722647978577363026n,
}, },
echo: { echo: {
name: "ECHO", name: "ECHO",
id: 712639419785412668n id: 712639419785412668n,
}, },
katlyn: { katlyn: {
name: "katlyn", name: "katlyn",
id: 250322741406859265n id: 250322741406859265n,
}, },
nea: { nea: {
name: "nea", name: "nea",
@ -99,87 +99,87 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
Nuckyz: { Nuckyz: {
name: "Nuckyz", name: "Nuckyz",
id: 235834946571337729n id: 235834946571337729n,
}, },
D3SOX: { D3SOX: {
name: "D3SOX", name: "D3SOX",
id: 201052085641281538n id: 201052085641281538n,
}, },
Nickyux: { Nickyux: {
name: "Nickyux", name: "Nickyux",
id: 427146305651998721n id: 427146305651998721n,
}, },
mantikafasi: { mantikafasi: {
name: "mantikafasi", name: "mantikafasi",
id: 287555395151593473n id: 287555395151593473n,
}, },
Xinto: { Xinto: {
name: "Xinto", name: "Xinto",
id: 423915768191647755n id: 423915768191647755n,
}, },
JacobTm: { JacobTm: {
name: "Jacob.Tm", name: "Jacob.Tm",
id: 302872992097107991n id: 302872992097107991n,
}, },
DustyAngel47: { DustyAngel47: {
name: "DustyAngel47", name: "DustyAngel47",
id: 714583473804935238n id: 714583473804935238n,
}, },
BanTheNons: { BanTheNons: {
name: "BanTheNons", name: "BanTheNons",
id: 460478012794863637n id: 460478012794863637n,
}, },
BigDuck: { BigDuck: {
name: "BigDuck", name: "BigDuck",
id: 1024588272623681609n id: 1024588272623681609n,
}, },
AverageReactEnjoyer: { AverageReactEnjoyer: {
name: "Average React Enjoyer", name: "Average React Enjoyer",
id: 1004904120056029256n id: 1004904120056029256n,
}, },
adryd: { adryd: {
name: "adryd", name: "adryd",
id: 0n id: 0n,
}, },
Tyman: { Tyman: {
name: "Tyman", name: "Tyman",
id: 487443883127472129n id: 487443883127472129n,
}, },
afn: { afn: {
name: "afn", name: "afn",
id: 420043923822608384n id: 420043923822608384n,
}, },
KraXen72: { KraXen72: {
name: "KraXen72", name: "KraXen72",
id: 379304073515499530n id: 379304073515499530n,
}, },
kemo: { kemo: {
name: "kemo", name: "kemo",
id: 715746190813298788n id: 715746190813298788n,
}, },
dzshn: { dzshn: {
name: "dzshn", name: "dzshn",
id: 310449948011528192n id: 310449948011528192n,
}, },
Ducko: { Ducko: {
name: "Ducko", name: "Ducko",
id: 506482395269169153n id: 506482395269169153n,
}, },
jewdev: { jewdev: {
name: "jewdev", name: "jewdev",
id: 222369866529636353n id: 222369866529636353n,
}, },
Luna: { Luna: {
name: "Luny", name: "Luny",
id: 821472922140803112n id: 821472922140803112n,
}, },
Vap: { Vap: {
name: "Vap0r1ze", name: "Vap0r1ze",
id: 454072114492866560n id: 454072114492866560n,
}, },
KingFish: { KingFish: {
name: "King Fish", name: "King Fish",
id: 499400512559382538n id: 499400512559382538n,
}, },
Commandtechno: { Commandtechno: {
name: "Commandtechno", name: "Commandtechno",
@ -187,7 +187,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
TheSun: { TheSun: {
name: "sunnie", name: "sunnie",
id: 406028027768733696n id: 406028027768733696n,
}, },
axyie: { axyie: {
name: "'ax", name: "'ax",
@ -195,44 +195,44 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
pointy: { pointy: {
name: "pointy", name: "pointy",
id: 99914384989519872n id: 99914384989519872n,
}, },
SammCheese: { SammCheese: {
name: "Samm-Cheese", name: "Samm-Cheese",
id: 372148345894076416n id: 372148345894076416n,
}, },
zt: { zt: {
name: "zt", name: "zt",
id: 289556910426816513n id: 289556910426816513n,
}, },
captain: { captain: {
name: "Captain", name: "Captain",
id: 347366054806159360n id: 347366054806159360n,
}, },
nick: { nick: {
name: "nick", name: "nick",
id: 347884694408265729n, id: 347884694408265729n,
badge: false badge: false,
}, },
whqwert: { whqwert: {
name: "whqwert", name: "whqwert",
id: 586239091520176128n id: 586239091520176128n,
}, },
lewisakura: { lewisakura: {
name: "lewisakura", name: "lewisakura",
id: 96269247411400704n id: 96269247411400704n,
}, },
RuiNtD: { RuiNtD: {
name: "RuiNtD", name: "RuiNtD",
id: 157917665162297344n id: 157917665162297344n,
}, },
hunt: { hunt: {
name: "hunt-g", name: "hunt-g",
id: 222800179697287168n id: 222800179697287168n,
}, },
cloudburst: { cloudburst: {
name: "cloudburst", name: "cloudburst",
id: 892128204150685769n id: 892128204150685769n,
}, },
Aria: { Aria: {
name: "Syncxv", name: "Syncxv",
@ -240,51 +240,51 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
TheKodeToad: { TheKodeToad: {
name: "TheKodeToad", name: "TheKodeToad",
id: 706152404072267788n id: 706152404072267788n,
}, },
LordElias: { LordElias: {
name: "LordElias", name: "LordElias",
id: 319460781567639554n id: 319460781567639554n,
}, },
juby: { juby: {
name: "Juby210", name: "Juby210",
id: 324622488644616195n id: 324622488644616195n,
}, },
Alyxia: { Alyxia: {
name: "Alyxia Sother", name: "Alyxia Sother",
id: 952185386350829688n id: 952185386350829688n,
}, },
Remty: { Remty: {
name: "Remty", name: "Remty",
id: 335055032204656642n id: 335055032204656642n,
}, },
skyevg: { skyevg: {
name: "skyevg", name: "skyevg",
id: 1090310844283363348n id: 1090310844283363348n,
}, },
Dziurwa: { Dziurwa: {
name: "Dziurwa", name: "Dziurwa",
id: 1001086404203389018n id: 1001086404203389018n,
}, },
arHSM: { arHSM: {
name: "arHSM", name: "arHSM",
id: 841509053422632990n id: 841509053422632990n,
}, },
F53: { F53: {
name: "F53", name: "F53",
id: 280411966126948353n id: 280411966126948353n,
}, },
AutumnVN: { AutumnVN: {
name: "AutumnVN", name: "AutumnVN",
id: 393694671383166998n id: 393694671383166998n,
}, },
pylix: { pylix: {
name: "pylix", name: "pylix",
id: 492949202121261067n id: 492949202121261067n,
}, },
Tyler: { Tyler: {
name: "\\\\GGTyler\\\\", name: "\\\\GGTyler\\\\",
id: 143117463788191746n id: 143117463788191746n,
}, },
RyanCaoDev: { RyanCaoDev: {
name: "RyanCaoDev", name: "RyanCaoDev",
@ -292,27 +292,27 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
FieryFlames: { FieryFlames: {
name: "Fiery", name: "Fiery",
id: 890228870559698955n id: 890228870559698955n,
}, },
KannaDev: { KannaDev: {
name: "Kanna", name: "Kanna",
id: 317728561106518019n id: 317728561106518019n,
}, },
carince: { carince: {
name: "carince", name: "carince",
id: 818323528755314698n id: 818323528755314698n,
}, },
PandaNinjas: { PandaNinjas: {
name: "PandaNinjas", name: "PandaNinjas",
id: 455128749071925248n id: 455128749071925248n,
}, },
CatNoir: { CatNoir: {
name: "CatNoir", name: "CatNoir",
id: 260371016348336128n id: 260371016348336128n,
}, },
outfoxxed: { outfoxxed: {
name: "outfoxxed", name: "outfoxxed",
id: 837425748435796060n id: 837425748435796060n,
}, },
UwUDev: { UwUDev: {
name: "UwU", name: "UwU",
@ -320,39 +320,39 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
amia: { amia: {
name: "amia", name: "amia",
id: 142007603549962240n id: 142007603549962240n,
}, },
phil: { phil: {
name: "phil", name: "phil",
id: 305288513941667851n id: 305288513941667851n,
}, },
ImLvna: { ImLvna: {
name: "Luna <3", name: "Luna <3",
id: 799319081723232267n id: 799319081723232267n,
}, },
rad: { rad: {
name: "rad", name: "rad",
id: 610945092504780823n id: 610945092504780823n,
}, },
AndrewDLO: { AndrewDLO: {
name: "Andrew-DLO", name: "Andrew-DLO",
id: 434135504792059917n id: 434135504792059917n,
}, },
HypedDomi: { HypedDomi: {
name: "HypedDomi", name: "HypedDomi",
id: 354191516979429376n id: 354191516979429376n,
}, },
Rini: { Rini: {
name: "Rini", name: "Rini",
id: 1079479184478441643n id: 1079479184478441643n,
}, },
castdrian: { castdrian: {
name: "castdrian", name: "castdrian",
id: 224617799434108928n id: 224617799434108928n,
}, },
Arrow: { Arrow: {
name: "arrow", name: "arrow",
id: 958158495302176778n id: 958158495302176778n,
}, },
bb010g: { bb010g: {
name: "bb010g", name: "bb010g",
@ -372,19 +372,19 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
archeruwu: { archeruwu: {
name: "archer_uwu", name: "archer_uwu",
id: 160068695383736320n id: 160068695383736320n,
}, },
ProffDea: { ProffDea: {
name: "ProffDea", name: "ProffDea",
id: 609329952180928513n id: 609329952180928513n,
}, },
UlyssesZhan: { UlyssesZhan: {
name: "UlyssesZhan", name: "UlyssesZhan",
id: 586808226058862623n id: 586808226058862623n,
}, },
ant0n: { ant0n: {
name: "ant0n", name: "ant0n",
id: 145224646868860928n id: 145224646868860928n,
}, },
Board: { Board: {
name: "BoardTM", name: "BoardTM",
@ -392,11 +392,11 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
philipbry: { philipbry: {
name: "philipbry", name: "philipbry",
id: 554994003318276106n id: 554994003318276106n,
}, },
Korbo: { Korbo: {
name: "Korbo", name: "Korbo",
id: 455856406420258827n id: 455856406420258827n,
}, },
maisymoe: { maisymoe: {
name: "maisy", name: "maisy",
@ -404,11 +404,11 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
Lexi: { Lexi: {
name: "Lexi", name: "Lexi",
id: 506101469787717658n id: 506101469787717658n,
}, },
Mopi: { Mopi: {
name: "Mopi", name: "Mopi",
id: 1022189106614243350n id: 1022189106614243350n,
}, },
Grzesiek11: { Grzesiek11: {
name: "Grzesiek11", name: "Grzesiek11",
@ -436,7 +436,7 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
nin0dev: { nin0dev: {
name: "nin0dev", name: "nin0dev",
id: 886685857560539176n id: 886685857560539176n,
}, },
Elvyra: { Elvyra: {
name: "Elvyra", name: "Elvyra",
@ -444,75 +444,79 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
HappyEnderman: { HappyEnderman: {
name: "Happy enderman", name: "Happy enderman",
id: 1083437693347827764n id: 1083437693347827764n,
}, },
Vishnya: { Vishnya: {
name: "Vishnya", name: "Vishnya",
id: 282541644484575233n id: 282541644484575233n,
}, },
Inbestigator: { Inbestigator: {
name: "Inbestigator", name: "Inbestigator",
id: 761777382041714690n id: 761777382041714690n,
}, },
newwares: { newwares: {
name: "newwares", name: "newwares",
id: 421405303951851520n id: 421405303951851520n,
}, },
JohnyTheCarrot: { JohnyTheCarrot: {
name: "JohnyTheCarrot", name: "JohnyTheCarrot",
id: 132819036282159104n id: 132819036282159104n,
}, },
puv: { puv: {
name: "puv", name: "puv",
id: 469441552251355137n id: 469441552251355137n,
}, },
Kodarru: { Kodarru: {
name: "Kodarru", name: "Kodarru",
id: 785227396218748949n id: 785227396218748949n,
}, },
nakoyasha: { nakoyasha: {
name: "nakoyasha", name: "nakoyasha",
id: 222069018507345921n id: 222069018507345921n,
}, },
Sqaaakoi: { Sqaaakoi: {
name: "Sqaaakoi", name: "Sqaaakoi",
id: 259558259491340288n id: 259558259491340288n,
},
iamme: {
name: "i am me",
id: 984392761929256980n,
}, },
Byron: { Byron: {
name: "byeoon", name: "byeoon",
id: 1167275288036655133n id: 1167275288036655133n,
}, },
Kaitlyn: { Kaitlyn: {
name: "kaitlyn", name: "kaitlyn",
id: 306158896630988801n id: 306158896630988801n,
}, },
PolisanTheEasyNick: { PolisanTheEasyNick: {
name: "Oleh Polisan", name: "Oleh Polisan",
id: 242305263313485825n id: 242305263313485825n,
}, },
HAHALOSAH: { HAHALOSAH: {
name: "HAHALOSAH", name: "HAHALOSAH",
id: 903418691268513883n id: 903418691268513883n,
}, },
GabiRP: { GabiRP: {
name: "GabiRP", name: "GabiRP",
id: 507955112027750401n id: 507955112027750401n,
}, },
ImBanana: { ImBanana: {
name: "Im_Banana", name: "Im_Banana",
id: 635250116688871425n id: 635250116688871425n,
}, },
xocherry: { xocherry: {
name: "xocherry", name: "xocherry",
id: 221288171013406720n id: 221288171013406720n,
}, },
ScattrdBlade: { ScattrdBlade: {
name: "ScattrdBlade", name: "ScattrdBlade",
id: 678007540608532491n id: 678007540608532491n,
}, },
goodbee: { goodbee: {
name: "goodbee", name: "goodbee",
id: 658968552606400512n id: 658968552606400512n,
}, },
Moxxie: { Moxxie: {
name: "Moxxie", name: "Moxxie",
@ -524,19 +528,20 @@ export const Devs = /* #__PURE__*/ Object.freeze({
}, },
nyx: { nyx: {
name: "verticalsync", name: "verticalsync",
id: 328165170536775680n id: 328165170536775680n,
}, },
nekohaxx: { nekohaxx: {
name: "nekohaxx", name: "nekohaxx",
id: 1176270221628153886n id: 1176270221628153886n,
} },
} satisfies Record<string, Dev>); } satisfies Record<string, Dev>);
// iife so #__PURE__ works correctly // iife so #__PURE__ works correctly
export const DevsById = /* #__PURE__*/ (() => export const DevsById = /* #__PURE__*/ (() =>
Object.freeze(Object.fromEntries( Object.freeze(
Object.entries(Devs) Object.fromEntries(
.filter(d => d[1].id !== 0n) Object.entries(Devs)
.map(([_, v]) => [v.id, v] as const) .filter((d) => d[1].id !== 0n)
)) .map(([_, v]) => [v.id, v] as const)
)() as Record<string, Dev>; )
))() as Record<string, Dev>;