diff --git a/cspell.json b/cspell.json index ec580088b..a8e37bdf1 100644 --- a/cspell.json +++ b/cspell.json @@ -33,6 +33,7 @@ "installdir", "Jsonifiable", "konami", + "leaderboard", "lezer", "LOCALAPPDATA", "logname", diff --git a/src/renderer/apis/commands.ts b/src/renderer/apis/commands.ts index 1a040dd3c..a6cc8742b 100644 --- a/src/renderer/apis/commands.ts +++ b/src/renderer/apis/commands.ts @@ -205,7 +205,7 @@ export class CommandManager { } /** - * Code to register an slash command + * Code to register a slash command * @param command Slash command to be registered * @returns A callback to unregister the slash command */ diff --git a/src/renderer/modules/common/channels.ts b/src/renderer/modules/common/channels.ts index e365ac26f..57dd370a5 100644 --- a/src/renderer/modules/common/channels.ts +++ b/src/renderer/modules/common/channels.ts @@ -29,6 +29,7 @@ export interface ChannelStore { getChannel(channelId: string): Channel | undefined; getChannelIds(guildId?: string): string[]; getDebugInfo(): DebugInfo; + getDMChannelFromUserId(userId: string): Channel | undefined; getDMFromUserId(userId: string): string | undefined; getDMUserIds(): string[]; getGuildChannelsVersion(guildId: string): number; diff --git a/src/renderer/modules/common/components.ts b/src/renderer/modules/common/components.ts index 6e0bf66e2..8d3484076 100644 --- a/src/renderer/modules/common/components.ts +++ b/src/renderer/modules/common/components.ts @@ -1,5 +1,6 @@ import type { LoaderType } from "@components"; import type { ClickableCompType } from "@components/Clickable"; +import type { NoticeType } from "@components/Notice"; import type { OriginalTextType } from "@components/Text"; import type { ButtonType } from "../components/ButtonItem"; import type { CheckboxType } from "../components/CheckboxItem"; @@ -31,6 +32,8 @@ interface DiscordComponents { FormSwitch: SwitchItemType; FormText: FormTextCompType; FormTextTypes: Record; + HelpMessage: NoticeType; + HelpMessageTypes: NoticeType["HelpMessageTypes"]; Menu: ContextMenuType["ContextMenu"]; MenuCheckboxItem: ContextMenuType["MenuCheckboxItem"]; MenuControlItem: ContextMenuType["MenuControlItem"]; diff --git a/src/renderer/modules/common/toast.ts b/src/renderer/modules/common/toast.ts index 3bb98e049..aff944e49 100644 --- a/src/renderer/modules/common/toast.ts +++ b/src/renderer/modules/common/toast.ts @@ -7,6 +7,10 @@ const Kind = { FAILURE: 2, CUSTOM: 3, CLIP: 4, + LINK: 5, + FORWARD: 6, + BOOKMARK: 7, + CLOCK: 8, } as const; const Position = { diff --git a/src/renderer/modules/common/users.ts b/src/renderer/modules/common/users.ts index 4d8c0b06c..72753624e 100644 --- a/src/renderer/modules/common/users.ts +++ b/src/renderer/modules/common/users.ts @@ -33,6 +33,7 @@ export interface UserStore { } export interface GuildMemberStore { + getCachedSelfMember: (guildId: string) => GuildMember | null; getCommunicationDisabledUserMap: () => Record; getCommunicationDisabledVersion: () => number; getMember: (guildId: string, userId: string) => GuildMember | null; diff --git a/src/renderer/modules/components/ButtonItem.tsx b/src/renderer/modules/components/ButtonItem.tsx index 0f4fd6ba9..1fc80c733 100644 --- a/src/renderer/modules/components/ButtonItem.tsx +++ b/src/renderer/modules/components/ButtonItem.tsx @@ -18,22 +18,22 @@ interface ButtonProps extends React.ComponentPropsWithoutRef<"button"> { submittingFinishedLabel?: string; } -interface Path { +interface Location { pathname?: string; search?: string; + state?: S; hash?: string; + key?: string; } -interface LinkProps extends Omit, "href"> { +interface LinkProps extends React.AnchorHTMLAttributes { + component?: React.ComponentType; + to: string | Location | ((location: Location) => string | Location); replace?: boolean; - state?: unknown; - to: string | Path; - reloadDocument?: boolean; - preventScrollReset?: boolean; - relative?: "route" | "path"; + innerRef?: React.Ref; } -interface ButtonLinkProps extends LinkProps { +interface ButtonLinkProps extends LinkProps { look?: string; color?: string; size?: string; diff --git a/src/renderer/modules/components/Notice.tsx b/src/renderer/modules/components/Notice.tsx index 3e750b934..202f3d43d 100644 --- a/src/renderer/modules/components/Notice.tsx +++ b/src/renderer/modules/components/Notice.tsx @@ -1,36 +1,29 @@ +import components from "@common/components"; import type React from "react"; -import { filters, waitForModule } from "../webpack"; import type { Variant } from "./Text"; -const Types = { +const HelpMessageTypes = { WARNING: 0, INFO: 1, ERROR: 2, POSITIVE: 3, } as const; -interface NoticeProps { +interface HelpMessageProps { children: React.ReactNode; - messageType: (typeof Types)[keyof typeof Types]; + messageType: (typeof HelpMessageTypes)[keyof typeof HelpMessageTypes]; textColor?: string; textVariant?: Variant; className?: string; } -export type NoticeType = React.FC & { - Types: typeof Types; // for backwards compat - HelpMessageTypes: typeof Types; - default: React.FC; +export type NoticeType = React.FC & { + Types: typeof HelpMessageTypes; // for backwards compat + HelpMessageTypes: typeof HelpMessageTypes; }; -const NoticeComp = await waitForModule(filters.bySource("WARNING=0]")); -//const Notice = NoticeComp.default as NoticeType; -// Notice component is a top-level exported function -const Notice = Object.values(NoticeComp).find((v) => typeof v === "function") as NoticeType; -// Help Message Types are a top-level exported object -Notice.HelpMessageTypes = Object.values(NoticeComp).find((v) => "INFO" in v)! as typeof Types; -Notice.Types = Notice.HelpMessageTypes; -//Notice.Types = NoticeComp.HelpMessageTypes; -//Notice.HelpMessageTypes = NoticeComp.HelpMessageTypes; +const { HelpMessage } = components; +HelpMessage.HelpMessageTypes = components.HelpMessageTypes; +HelpMessage.Types = HelpMessage.HelpMessageTypes; -export default Notice; +export default HelpMessage; diff --git a/src/renderer/modules/components/RadioItem.tsx b/src/renderer/modules/components/RadioItem.tsx index 3182e5949..6a853ccaf 100644 --- a/src/renderer/modules/components/RadioItem.tsx +++ b/src/renderer/modules/components/RadioItem.tsx @@ -13,6 +13,8 @@ type RadioOptionType = { tooltipPosition?: "top" | "bottom" | "left" | "right" | "center" | "window_center"; icon?: React.ComponentType; collapsibleContent?: React.ReactNode; + radioItemIconClassName?: string; + radioBarClassName?: string; }; interface RadioProps { diff --git a/src/renderer/modules/components/SwitchItem.tsx b/src/renderer/modules/components/SwitchItem.tsx index 4bcaf79d0..0f9539451 100644 --- a/src/renderer/modules/components/SwitchItem.tsx +++ b/src/renderer/modules/components/SwitchItem.tsx @@ -19,6 +19,7 @@ interface SwitchItemProps { note?: string; tooltipNote?: string; disabled?: boolean; + disabledText?: string; hideBorder?: boolean; style?: React.CSSProperties; className?: string; diff --git a/src/renderer/modules/components/Tooltip.tsx b/src/renderer/modules/components/Tooltip.tsx index e28bc96c5..e59364245 100644 --- a/src/renderer/modules/components/Tooltip.tsx +++ b/src/renderer/modules/components/Tooltip.tsx @@ -22,16 +22,7 @@ interface TooltipEnums { Aligns: typeof Aligns; Positions: typeof Positions; Colors: Record< - | "PRIMARY" - | "NESTED" - | "BLACK" - | "GREY" - | "BRAND" - | "GREEN" - | "YELLOW" - | "RED" - | "CUSTOM" - | "PREMIUM", + "PRIMARY" | "NESTED" | "BLACK" | "GREY" | "BRAND" | "GREEN" | "YELLOW" | "RED" | "PREMIUM", string >; } @@ -44,6 +35,7 @@ interface BaseTooltipProps { spacing?: number; delay?: number; allowOverflow?: boolean; + overflowOnly?: boolean; disableTooltipPointerEvents?: boolean; forceOpen?: boolean; hideOnClick?: boolean; @@ -53,9 +45,11 @@ interface BaseTooltipProps { className?: string; tooltipClassName?: string; tooltipContentClassName?: string; + tooltipPointerClassName?: string; style?: React.CSSProperties; tooltipStyle?: React.CSSProperties; onTooltipShow?: () => void; + onTooltipHide?: () => void; onAnimationRest?: (result: unknown, spring: unknown, item?: unknown) => void; } diff --git a/src/types/coremods/contextMenu.ts b/src/types/coremods/contextMenu.ts index ffaffd22e..745b38d14 100644 --- a/src/types/coremods/contextMenu.ts +++ b/src/types/coremods/contextMenu.ts @@ -28,6 +28,7 @@ export enum ContextMenuTypes { Account = "account", ActivityShelfItemContext = "activity-shelf-item-context", AddQuestions = "add-questions", + AppDetailsMoreMenu = "app-details-more-menu", ApplicationDirectoryProfile = "application-directory-profile", AttachmentLinkContext = "attachment-link-context", /** Right-click mute or deafen buttons */ @@ -36,20 +37,23 @@ export enum ContextMenuTypes { ChannelAttach = "channel-attach", ChannelAutocomplete = "channel-autocomplete", ChannelCallOverflowPopout = "channel-call-overflow-popout", - ChannelNotificationCustomSettingsItems = "ChannelNotificationCustomSettingsItems", - ClipsContext = "clips-context", - ClipsMoreOptions = "clips-more-options", - CommandListSort = "command-list-sort", /** Right-click channel */ ChannelContext = "channel-context", /** Right-click a channel mention */ ChannelMentionContext = "channel-mention-context", ChannelSummariesContextMenu = "channel-summaries-context-menu", + ChannelNotificationCustomSettingsItems = "ChannelNotificationCustomSettingsItems", + ClipsContext = "clips-context", + ClipsMoreOptions = "clips-more-options", + CommandListSort = "command-list-sort", ComponentButton = "component-button", + ContentInventoryContext = "content-inventory-context", CopyId = "copy-id", + Demo = "demo", /** Right-click a role */ DevContext = "dev-context", DevtoolsOverflow = "devtools-overflow", + DiscoveryEntrypointContextMenu = "discovery-entrypoint-context-menu", EditProfilePopout = "edit-profile-popout", ExitOptions = "exit-options", /** Right-click an emoji or sticker in the popout */ @@ -57,11 +61,15 @@ export enum ContextMenuTypes { /** Right-click the favorites server icon */ FavoriteServerContext = "favorite-server-context", FavoritesHeaderPopout = "favorites-header-popout", + ForumTag = "forum-tag", /** Click the triple dots icon for a user in the home screen */ FriendRow = "friend-row", GameContext = "game-context", + GameProfileContext = "game-profile-context", /** Right-click a group chat */ GdmContext = "gdm-context", + GlobalDiscoverySearchFilterOptions = "global-discovery-search-filter-options", + GlobalDiscoveryTabsOverflowMenu = "global-discovery-tabs-overflow-menu", /** Right-click "Browse Channels" */ GuildBrowseChannelsContextMenu = "guild-browse-channels-context-menu", /** Right-click guild icon */ @@ -77,14 +85,17 @@ export enum ContextMenuTypes { /** Right-click a role in the guild settings */ GuildSettingsRoleContext = "guild-settings-role-context", GuildShopContext = "guild-shop-context", + ImageContextCommandPopout = "image-context-commands-popout", ImageContext = "image-context", JoinRequestGuildContext = "join-request-guild-context", LaunchContext = "launch-context", + LeaderboardPopoutContextMenu = "leaderboard-popout-context-menu", ManageBroadcast = "manage-broadcast", ManageIntegration = "manage-integration", ManageMultiAccount = "manage-multi-account", ManageStreams = "manage-streams", MemberApplicationContextMenu = "member-application-context-menu", + MemberApplicationsTabsOverflowMenu = "member-applications-tabs-overflow-menu", MemberListSettingsMenu = "member-list-settings-menu", MemberSafetyFlags = "member-safety-flags", MembersTableJoinMethodMenu = "members-table-join-method-menu", @@ -92,10 +103,12 @@ export enum ContextMenuTypes { MentionsFilter = "mentions-filter", /** Click the triple dots on a message popover */ MessageActions = "message-actions", + MessageReminderCreate = "message-reminder-create", MessageReminderSnooze = "message-reminder-snooze", /** Right-click message */ Message = "message", ModerationRaidContext = "moderation-raid-context", + NonUserBotProfileOverflowMenu = "non-user-bot-profile-overflow-menu", NotificationActions = "notification-actions", NowPlayingMenu = "now-playing-menu", Overlay = "overlay", @@ -110,6 +123,8 @@ export enum ContextMenuTypes { RtcChannel = "rtc-channel", SearchResults = "search-results", SetImageForAction = "set-image-for-action", + SetStatusSubmenuMobileWeb = "set-status-submenu-mobile-web", + SetStatusSubmenu = "set-status-submenu", SignupButtonContext = "signup-button-context", SortAndView = "sort-and-view", SoundButtonContext = "sound-button-context", @@ -121,6 +136,7 @@ export enum ContextMenuTypes { Status = "status", StreamContext = "stream-context", SubscriptionContext = "subscription-context", + SwitchAccountsSubmenu = "switch-accounts-submenu", TestSkus = "test-skus", TestStoreListing = "test-store-listing", TextContext = "text-context", @@ -129,6 +145,8 @@ export enum ContextMenuTypes { ThreadContext = "thread-context", TransferMenu = "transfer-menu", UnknownUserContext = "unknown-user-context", + UserBotProfileAddApp = "user-bot-profile-add-app", + UserBotProfileOverflowMenu = "user-bot-profile-overflow-menu", /** Right-click user */ UserContext = "user-context", UserProfileActions = "user-profile-actions",