Fix Conflicts + Invite Button

This commit is contained in:
thororen1234 2025-02-07 15:54:20 -05:00
parent 5c04fac366
commit 9b8ab3bf97
6 changed files with 74 additions and 27 deletions

View file

@ -16,7 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { Button } from "@webpack/common";
import { openInviteModal } from "@utils/discord";
import { Button, showToast } from "@webpack/common";
import { ButtonProps } from "@webpack/types";
import { Heart } from "./Heart";
@ -39,3 +40,23 @@ export default function DonateButton({
</Button>
);
}
export function InviteButton({
look = Button.Looks.LINK,
color = Button.Colors.TRANSPARENT,
...props
}: Partial<ButtonProps>) {
return (
<Button
{...props}
look={look}
color={color}
onClick={() => openInviteModal("bFp57wxCkv").catch(() =>
showToast("Invalid or expired invite"),
)}
innerClassName="vc-donate-button"
>
Invite
</Button>
);
}

View file

@ -37,3 +37,4 @@ export function Heart(props: SVGProps<SVGSVGElement>) {
</svg>
);
}

View file

@ -9,7 +9,7 @@ import "./VencordTab.css";
import { openNotificationLogModal } from "@api/Notifications/notificationLog";
import { useSettings } from "@api/Settings";
import { classNameFactory } from "@api/Styles";
import DonateButton from "@components/DonateButton";
import DonateButton, { InviteButton } from "@components/DonateButton";
import { openContributorModal } from "@components/PluginSettings/ContributorModal";
import { openPluginModal } from "@components/PluginSettings/PluginModal";
import { gitRemote } from "@shared/vencordUserAgent";
@ -334,11 +334,16 @@ function EquicordSettings() {
function DonateButtonComponent() {
return (
<DonateButton
look={Button.Looks.FILLED}
color={Button.Colors.TRANSPARENT}
style={{ marginTop: "1em" }}
/>
<Flex>
<DonateButton
look={Button.Looks.FILLED}
color={Button.Colors.TRANSPARENT}
style={{ marginTop: "1em" }} />
<InviteButton
look={Button.Looks.FILLED}
color={Button.Colors.TRANSPARENT}
style={{ marginTop: "1em" }} />
</Flex>
);
}

View file

@ -60,19 +60,19 @@
.vc-special-hyperlink {
margin-top: 1em;
cursor: pointer;
}
.vc-special-hyperlink-text {
color: black;
font-size: 1em;
font-weight: bold;
text-align: center;
transition: text-decoration 0.5s;
cursor: pointer;
}
.vc-special-hyperlink-text {
color: black;
font-size: 1em;
font-weight: bold;
text-align: center;
transition: text-decoration 0.5s;
cursor: pointer;
}
&:hover .vc-special-hyperlink-text {
text-decoration: underline;
}
.vc-special-hyperlink:hover .vc-special-hyperlink-text {
text-decoration: underline;
}
.vc-special-image-container {

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
import { migratePluginSettings } from "@api/Settings";
import { migratePluginSettings, Settings } from "@api/Settings";
import { disableStyle, enableStyle } from "@api/Styles";
import { EquicordDevs } from "@utils/constants";
import definePlugin from "@utils/types";
@ -12,18 +12,25 @@ import { IconUtils, UserStore } from "@webpack/common";
import style from "./style.css?managed";
interface iUSRBG extends Plugin {
userHasBackground(userId: string);
getImageUrl(userId: string): string | null;
}
migratePluginSettings("FullVCPFP", "fullVcPfp");
export default definePlugin({
name: "FullVCPFP",
description: "Makes avatars take up the entire vc tile. Breaks if USRBG Voice Background is enabled.",
authors: [EquicordDevs.mochienya],
patches: [{
find: "\"data-selenium-video-tile\":",
replacement: {
match: /(?<=function\((\i),\i\)\{)/,
replace: "$1.style=$self.getVoiceBackgroundStyles($1);",
patches: [
{
find: "\"data-selenium-video-tile\":",
replacement: {
match: /(?<=function\((\i),\i\)\{)/,
replace: "$1.style=$self.getVoiceBackgroundStyles($1);",
}
}
}],
],
getVoiceBackgroundStyles({ className, participantUserId }: any) {
if (!className.includes("tile_")) return;
@ -32,6 +39,19 @@ export default definePlugin({
const avatarUrl = IconUtils.getUserAvatarURL(user, false, 1024);
if (Settings.plugins.USRBG.enabled && Settings.plugins.USRBG.voiceBackground) {
const USRBG = (Vencord.Plugins.plugins.USRBG as unknown as iUSRBG);
if (USRBG.userHasBackground(participantUserId)) {
return {
backgroundImage: `url(${USRBG.getImageUrl(participantUserId)})`,
backgroundSize: "cover",
backgroundPosition: "center",
backgroundRepeat: "no-repeat",
"--full-res-avatar": `url(${avatarUrl})`
};
}
}
return {
"--full-res-avatar": `url(${avatarUrl})`,
};

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import { definePluginSettings } from "@api/Settings";
import { definePluginSettings, Settings } from "@api/Settings";
import { Link } from "@components/Link";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
@ -63,7 +63,7 @@ export default definePlugin({
},
{
find: "\"data-selenium-video-tile\":",
predicate: () => settings.store.voiceBackground,
predicate: () => !Settings.plugins.FullVCPFP.enabled && settings.store.voiceBackground,
replacement: [
{
match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/,