diff --git a/src/components/BaseText.css b/src/components/BaseText.css index ebaba6455..f86bd1ba7 100644 --- a/src/components/BaseText.css +++ b/src/components/BaseText.css @@ -1,6 +1,8 @@ .vc-text-base { font-family: var(--font-primary); - color: var(--text-default); + line-height: normal; + + /* Discord puts an insane default margin on p tags, so reset that here */ margin: 0; } @@ -24,3 +26,7 @@ .vc-text-tabular-numbers { font-variant-numeric: tabular-nums; } + +.vc-text-defaultColor { + color: var(--text-default); +} \ No newline at end of file diff --git a/src/components/BaseText.tsx b/src/components/BaseText.tsx index 49a81b05c..dcc7512f1 100644 --- a/src/components/BaseText.tsx +++ b/src/components/BaseText.tsx @@ -82,6 +82,7 @@ export type BaseTextProps = ComponentPropsWithoutRe selectable?: boolean; lineClamp?: number; tabularNumbers?: boolean; + defaultColor?: boolean; }; export function BaseText(props: BaseTextProps): ReactNode { @@ -93,6 +94,7 @@ export function BaseText(props: BaseTextProps): Re selectable = false, lineClamp, tabularNumbers = false, + defaultColor = true, children, className, style, @@ -107,6 +109,7 @@ export function BaseText(props: BaseTextProps): Re lineClamp === 1 && textCls("line-clamp-1"), lineClamp != null && lineClamp > 1 && textCls("line-clamp"), tabularNumbers && textCls("tabular-numbers"), + defaultColor && textCls("defaultColor"), className )} style={{ diff --git a/src/equicordplugins/musicControls/index.tsx b/src/equicordplugins/musicControls/index.tsx index dcf547e71..642a67cfb 100644 --- a/src/equicordplugins/musicControls/index.tsx +++ b/src/equicordplugins/musicControls/index.tsx @@ -52,7 +52,7 @@ export default definePlugin({ patches: [ { - find: ".DISPLAY_NAME_STYLES_COACHMARK),", + find: ".DISPLAY_NAME_STYLES_COACHMARK)", replacement: { // react.jsx)(AccountPanel, { ..., showTaglessAccountPanel: blah }) match: /(?<=\i\.jsxs?\)\()(\i),{(?=[^}]*?userTag:\i,occluded:)/, diff --git a/src/plugins/accountPanelServerProfile/index.tsx b/src/plugins/accountPanelServerProfile/index.tsx index 7a06255f2..12f5f5cbb 100644 --- a/src/plugins/accountPanelServerProfile/index.tsx +++ b/src/plugins/accountPanelServerProfile/index.tsx @@ -75,11 +75,11 @@ export default definePlugin({ patches: [ { - find: ".WIDGETS_RTC_UPSELL_COACHMARK)", + find: "handleOpenSettingsContextMenu=", group: true, replacement: [ { - match: /(\.AVATAR,children:.+?renderPopout:\(?(\i).{0,5}=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/, + match: /(\.AVATAR,children:.+?renderPopout:(\i)=>){(.+?)}(?=,position)(?<=currentUser:(\i).+?)/, replace: (_, rest, popoutProps, originalPopout, currentUser) => `${rest}$self.UserProfile({popoutProps:${popoutProps},currentUser:${currentUser},originalRenderPopout:()=>{${originalPopout}}})` }, { diff --git a/src/plugins/anonymiseFileNames/index.tsx b/src/plugins/anonymiseFileNames/index.tsx index 8e1536c40..f136d08a0 100644 --- a/src/plugins/anonymiseFileNames/index.tsx +++ b/src/plugins/anonymiseFileNames/index.tsx @@ -60,7 +60,7 @@ const settings = definePluginSettings({ randomisedLength: { description: "Random characters length", type: OptionType.NUMBER, - default: 10, + default: 7, disabled: () => settings.store.method !== Methods.Random, }, consistent: { @@ -134,7 +134,7 @@ export default definePlugin({ const newFilename = (() => { switch (settings.store.method) { case Methods.Random: - const chars = "ABCDEFabcdef0123456789"; + const chars = "0123456789bdfhjkmnpqrstvwxz"; const returnedName = Array.from( { length: settings.store.randomisedLength }, () => chars[Math.floor(Math.random() * chars.length)] diff --git a/src/plugins/decor/index.tsx b/src/plugins/decor/index.tsx index d32c50a0c..0a5ff0569 100644 --- a/src/plugins/decor/index.tsx +++ b/src/plugins/decor/index.tsx @@ -87,7 +87,7 @@ export default definePlugin({ }, // Current user area, at bottom of channels/dm list { - find: ".DISPLAY_NAME_STYLES_COACHMARK),", + find: ".DISPLAY_NAME_STYLES_COACHMARK)", replacement: [ // Use Decor avatar decoration hook { diff --git a/src/plugins/newGuildSettings/index.tsx b/src/plugins/newGuildSettings/index.tsx index ca00e5bc6..dd7f05a91 100644 --- a/src/plugins/newGuildSettings/index.tsx +++ b/src/plugins/newGuildSettings/index.tsx @@ -26,7 +26,7 @@ import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { Guild } from "@vencord/discord-types"; import { findByCodeLazy, findByPropsLazy, findStoreLazy, mapMangledModuleLazy } from "@webpack"; -import { ChannelStore, Menu } from "@webpack/common"; +import { ChannelStore, Menu, UserStore } from "@webpack/common"; const { updateGuildNotificationSettings } = findByPropsLazy("updateGuildNotificationSettings"); const { toggleShowAllChannels } = mapMangledModuleLazy(".onboardExistingMember(", { @@ -175,5 +175,11 @@ export default definePlugin({ } ], settings, - applyDefaultSettings + applyDefaultSettings, + flux: { + GUILD_JOIN_REQUEST_UPDATE({ guildId, request, status }) { + if (status === "APPROVED" && request.user_id === UserStore.getCurrentUser().id) + applyDefaultSettings(guildId); + } + } }); diff --git a/src/plugins/reviewDB/components/ReviewComponent.tsx b/src/plugins/reviewDB/components/ReviewComponent.tsx index 20bd2e029..a29bd504c 100644 --- a/src/plugins/reviewDB/components/ReviewComponent.tsx +++ b/src/plugins/reviewDB/components/ReviewComponent.tsx @@ -24,7 +24,7 @@ import { canBlockReviewAuthor, canDeleteReview, canReportReview, cl, showToast } import { openUserProfile } from "@utils/discord"; import { classes } from "@utils/misc"; import { findCssClassesLazy } from "@webpack"; -import { Alerts, Parser, Timestamp, useState } from "@webpack/common"; +import { Alerts, IconUtils, Parser, Timestamp, useState } from "@webpack/common"; import { openBlockModal } from "./BlockedUserModal"; import { BlockButton, DeleteButton, ReportButton } from "./MessageButton"; @@ -116,8 +116,9 @@ export default function ReviewComponent({ review, refetch, profileId }: { review e.currentTarget.src = IconUtils.getDefaultAvatarURL(review.sender.discordID)} />
getReviews(discordId, (page - 1) * REVIEWS_PER_PAGE), { + const [reviewData] = useAwaiter(() => getReviews(discordId, { offset: (page - 1) * REVIEWS_PER_PAGE }), { fallbackValue: null, deps: [refetchSignal, signal, page], onSuccess: data => { if (settings.store.hideBlockedUsers) data!.reviews = data!.reviews?.filter(r => !RelationshipStore.isBlocked(r.sender.discordID)); + data!.reviews.reverse(); scrollToTop?.(); onFetchReviews(data!); } diff --git a/src/plugins/reviewDB/index.tsx b/src/plugins/reviewDB/index.tsx index b06468e2a..c3f4f21ac 100644 --- a/src/plugins/reviewDB/index.tsx +++ b/src/plugins/reviewDB/index.tsx @@ -29,7 +29,7 @@ import { useAwaiter } from "@utils/react"; import definePlugin from "@utils/types"; import { Guild, User } from "@vencord/discord-types"; import { findCssClassesLazy } from "@webpack"; -import { Alerts, Clickable, Menu, Parser } from "@webpack/common"; +import { Alerts, Clickable, IconUtils, Menu, Parser } from "@webpack/common"; import { Auth, initAuth, updateAuth } from "./auth"; import { openReviewsModal } from "./components/ReviewModal"; @@ -157,7 +157,7 @@ export default definePlugin({ }, renderProfileComponent: ErrorBoundary.wrap(({ user, isSideBar = false }: { user: User; isSideBar?: boolean; }) => { - const [reviewData] = useAwaiter(() => getReviews(user.id, 0, true), { deps: [user.id], fallbackValue: null }); + const [reviewData] = useAwaiter(() => getReviews(user.id, { limit: 4 }), { deps: [user.id], fallbackValue: null }); // Discord are masters at using a crap ton of html elements and css classes to create a simple ui that could have // been made with less than half of the number of elements, so we have to do this insanity to replicate their ui @@ -166,37 +166,43 @@ export default definePlugin({
  • !reviewData?.hasOptedOut && openReviewsModal(user.id, user.username, ReviewType.User)} >
    User Reviews - {reviewData?.hasOptedOut ? ( - User disabled reviews - ) : !reviewData?.reviewCount ? ( - No reviews yet - ) : !!reviewData?.reviewCount && ( -
    - {reviewData.reviews - .filter(review => review.id !== 0) - .slice(0, 4) - .reverse() - .map((review, idx) => { - const showCount = idx === 3 && reviewData.reviewCount > 4; + {!!reviewData?.reviewCount + ? ( +
    + {reviewData.reviews + .filter(review => review.id !== 0) + .slice(0, 4) + .reverse() + .map((review, idx) => { + const showCount = idx === 3 && reviewData.reviewCount > 4; - return ( -
    - {review.sender.username} - {showCount && ( -
    - +{reviewData.reviewCount - 3} -
    - )} -
    - ); - })} -
    - )} + return ( +
    + {review.sender.username} e.currentTarget.src = IconUtils.getDefaultAvatarURL(review.sender.discordID)} + /> + {showCount && ( +
    + + +{reviewData.reviewCount - 3} + +
    + )} +
    + ); + })} +
    + ) + : {reviewData?.hasOptedOut ? "User opted out" : "No reviews yet"} + }
  • diff --git a/src/plugins/reviewDB/reviewDbApi.ts b/src/plugins/reviewDB/reviewDbApi.ts index 29c1918b4..94c369770 100644 --- a/src/plugins/reviewDB/reviewDbApi.ts +++ b/src/plugins/reviewDB/reviewDbApi.ts @@ -29,10 +29,10 @@ export const REVIEWS_PER_PAGE = 50; export interface UserReviewsData { message: string; - hasNextPage: boolean; - reviewCount: number; reviews: Review[]; updated: boolean; + hasNextPage: boolean; + reviewCount: number; hasOptedOut: boolean; } @@ -48,15 +48,15 @@ async function rdbRequest(path: string, options: RequestInit = {}) { }); } -export async function getReviews(id: string, offset = 0, isProfileComponent = false): Promise { +export async function getReviews(id: string, { limit, offset = 0 }: { limit?: number; offset?: number; } = {}): Promise { let flags = 0; if (!settings.store.showWarning) flags |= WarningFlag; - const params = new URLSearchParams({ - flags: String(flags), - offset: String(offset), - ...(isProfileComponent ? { limit: "4" } : {}) - }); + const params = new URLSearchParams(); + if (flags) params.append("flags", String(flags)); + if (offset) params.append("offset", String(offset)); + if (limit) params.append("limit", String(limit)); + const req = await fetch(`${API_URL}/users/${id}/reviews?${params}`); const res = (req.ok)