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/>. * 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 { ButtonProps } from "@webpack/types";
import { Heart } from "./Heart"; import { Heart } from "./Heart";
@ -39,3 +40,23 @@ export default function DonateButton({
</Button> </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> </svg>
); );
} }

View file

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

View file

@ -60,6 +60,7 @@
.vc-special-hyperlink { .vc-special-hyperlink {
margin-top: 1em; margin-top: 1em;
cursor: pointer; cursor: pointer;
}
.vc-special-hyperlink-text { .vc-special-hyperlink-text {
color: black; color: black;
@ -70,10 +71,9 @@
cursor: pointer; cursor: pointer;
} }
&:hover .vc-special-hyperlink-text { .vc-special-hyperlink:hover .vc-special-hyperlink-text {
text-decoration: underline; text-decoration: underline;
} }
}
.vc-special-image-container { .vc-special-image-container {
display: flex; display: flex;

View file

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

View file

@ -16,7 +16,7 @@
* 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 { definePluginSettings } from "@api/Settings"; import { definePluginSettings, Settings } from "@api/Settings";
import { Link } from "@components/Link"; import { Link } from "@components/Link";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types"; import definePlugin, { OptionType } from "@utils/types";
@ -63,7 +63,7 @@ export default definePlugin({
}, },
{ {
find: "\"data-selenium-video-tile\":", find: "\"data-selenium-video-tile\":",
predicate: () => settings.store.voiceBackground, predicate: () => !Settings.plugins.FullVCPFP.enabled && settings.store.voiceBackground,
replacement: [ replacement: [
{ {
match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/, match: /(?<=function\((\i),\i\)\{)(?=let.{20,40},style:)/,