diff --git a/src/equicordplugins/friendshipRanks/icons.tsx b/src/equicordplugins/friendshipRanks/icons.tsx deleted file mode 100644 index 46ade68ed..000000000 --- a/src/equicordplugins/friendshipRanks/icons.tsx +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Vencord, a Discord client mod - * Copyright (c) 2024 Vendicated and contributors - * SPDX-License-Identifier: GPL-3.0-or-later - */ - -export function sproutIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} - -export function bloomingIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} - -export function burningIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} - -export function fighterIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} - -export function starIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} - -export function royalIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} - -export function bestiesIcon() { - return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -} diff --git a/src/equicordplugins/friendshipRanks/index.tsx b/src/equicordplugins/friendshipRanks/index.tsx index bdbffd0ea..f980521cb 100644 --- a/src/equicordplugins/friendshipRanks/index.tsx +++ b/src/equicordplugins/friendshipRanks/index.tsx @@ -4,26 +4,28 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import "./styles.css"; + import { BadgeUserArgs, ProfileBadge } from "@api/Badges"; import { Badges } from "@api/index"; import ErrorBoundary from "@components/ErrorBoundary"; import { Flex } from "@components/Flex"; import { Paragraph } from "@components/Paragraph"; import { Devs } from "@utils/constants"; -import { Margins } from "@utils/margins"; +import { classNameFactory } from "@utils/css"; import { ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal"; import definePlugin from "@utils/types"; -import { Button, Forms, RelationshipStore } from "@webpack/common"; - -import { bestiesIcon, bloomingIcon, burningIcon, fighterIcon, royalIcon, sproutIcon, starIcon } from "./icons"; +import { Forms, RelationshipStore } from "@webpack/common"; interface rankInfo { title: string; description: string; requirement: number; - assetSVG: any; + iconSrc: string; } +const cl = classNameFactory("vc-friendship-ranks-"); + function daysSince(dateString: string): number { const date = new Date(dateString); const currentDate = new Date(); @@ -41,43 +43,43 @@ const ranks: rankInfo[] = title: "Sprout", description: "Your friendship is just starting", requirement: 0, - assetSVG: sproutIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7005-8964-c21f69c5af1f" }, { title: "Blooming", description: "Your friendship is getting there! (1 Month)", requirement: 30, - assetSVG: bloomingIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7001-a9ea-9c24268bf34e" }, { title: "Burning", description: "Your friendship has reached terminal velocity (3 Months)", requirement: 90, - assetSVG: burningIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7002-96d6-70c91b2e2979" }, { title: "Fighter", description: "Your friendship is strong (6 Months)", requirement: 182.5, - assetSVG: fighterIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7003-a48c-4208802fa00d" }, { title: "Star", description: "Your friendship has been going on for a WHILE (1 Year)", requirement: 365, - assetSVG: starIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7006-81d6-8cec81991bad" }, { title: "Royal", description: "Your friendship has gone through thick and thin- a whole 2 years!", requirement: 730, - assetSVG: royalIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7004-9f94-a81b66b5db30" }, { title: "Besties", description: "How do you even manage this??? (5 Years)", requirement: 1826.25, - assetSVG: bestiesIcon + iconSrc: "https://images.equicord.org/api/files/raw/019b494c-e995-7000-84e2-2c310a8fc730" } ]; @@ -86,23 +88,19 @@ function openRankModal(rank: rankInfo) { - + + rank icon {rank.title} -
- - +
+ {rank.description}
@@ -112,17 +110,6 @@ function openRankModal(rank: rankInfo) { )); } -function getBadgeComponent(rank) { - // there may be a better button component to do this with - return ( -
- -
- ); -} - function shouldShowBadge(userId: string, requirement: number, index: number) { if (!RelationshipStore.isFriend(userId)) return false; @@ -135,12 +122,12 @@ function shouldShowBadge(userId: string, requirement: number, index: number) { function getBadgesToApply() { const badgesToApply: ProfileBadge[] = ranks.map((rank, index) => { - return ( - { - description: rank.title, - component: () => getBadgeComponent(rank), - shouldShow: (info: BadgeUserArgs) => shouldShowBadge(info.userId, rank.requirement, index), - }); + return ({ + description: rank.title, + iconSrc: rank.iconSrc, + onClick: () => openRankModal(rank), + shouldShow: (info: BadgeUserArgs) => shouldShowBadge(info.userId, rank.requirement, index), + }); }); return badgesToApply; diff --git a/src/equicordplugins/friendshipRanks/styles.css b/src/equicordplugins/friendshipRanks/styles.css new file mode 100644 index 000000000..b331f601e --- /dev/null +++ b/src/equicordplugins/friendshipRanks/styles.css @@ -0,0 +1,19 @@ +.vc-friendship-ranks-flex { + width: 100%; + justify-content: center; + height: 18px; +} + +.vc-friendship-ranks-img { + display: flex; + width: 100%; + text-align: center; + place-content: center center; + margin: 0; + gap: 4px; +} + +.vc-friendship-ranks-text { + padding: 1em; + text-align: center; +} \ No newline at end of file diff --git a/src/plugins/voiceMessages/native.ts b/src/plugins/voiceMessages/native.ts index 0cb6e4469..ea49498f2 100644 --- a/src/plugins/voiceMessages/native.ts +++ b/src/plugins/voiceMessages/native.ts @@ -13,7 +13,7 @@ export async function readRecording(_: any, filePath: string) { const filename = basename(filePath); const userDataDir = normalize(app.getPath("userData") + "/"); - if (filename !== "recording.ogg" || !filePath.startsWith(userDataDir)) return null; + if (!filename.endsWith("recording.ogg") || !filePath.startsWith(userDataDir)) return null; try { const buf = await readFile(filePath);