)
}
+ actionBarInput={
+ hasLinks && (
+
+ {website && (
+
+ )}
+ {githubName && (
+
+ )}
+
+ )
+ }
>
- {!!plugins.length && (
-
- {plugins.map(p =>
-
showToast("Restart to apply changes!")}
- />
- )}
-
- )}
-
- {hasLinks && (
-
- {website && (
-
- )}
- {githubName && (
-
- )}
-
- )}
+
+ {!!plugins.length && (
+
+ {plugins.map(p =>
+
showToast("Restart to apply changes!")}
+ />
+ )}
+
+ )}
+
);
}
diff --git a/src/equicordplugins/baseDecoder/index.tsx b/src/equicordplugins/baseDecoder/index.tsx
index 9ecb51a9e..0c6466e84 100644
--- a/src/equicordplugins/baseDecoder/index.tsx
+++ b/src/equicordplugins/baseDecoder/index.tsx
@@ -17,16 +17,13 @@
*/
import { definePluginSettings } from "@api/Settings";
-import { BaseText } from "@components/BaseText";
import { CodeBlock } from "@components/CodeBlock";
import ErrorBoundary from "@components/ErrorBoundary";
-import { Flex } from "@components/Flex";
import { Heading } from "@components/Heading";
import { EquicordDevs } from "@utils/constants";
import { copyWithToast } from "@utils/discord";
-import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
-import { Button, ChannelStore } from "@webpack/common";
+import { ChannelStore, Modal, openModal } from "@webpack/common";
function DecodeIcon() {
return (
@@ -64,32 +61,26 @@ function decodeBase64Strings(base64Strings) {
}
function openDecodedBase64Modal(decodedContent) {
- const key = openModal(props => (
+ openModal(props => (
-
-
- Decoded Base64 Content
- closeModal(key)} />
-
-
-
- Decoded Content
- {decodedContent.map((content, index) => (
-
- ))}
-
-
-
-
- {decodedContent.map((content, index) => (
- copyWithToast(content, "Decoded content copied to clipboard!")}>
- Copy Decoded Content {index + 1}
-
- ))}
-
-
-
-
+
({
+ text: `Copy Decoded Content ${index + 1}`,
+ variant: "primary",
+ onClick: () => copyWithToast(content, "Decoded content copied to clipboard!")
+ }))}
+ >
+
+ Decoded Content
+ {decodedContent.map((content, index) => (
+
+ ))}
+
+
+
));
}
diff --git a/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx b/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx
index b671049b8..16c46575e 100644
--- a/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx
+++ b/src/equicordplugins/channelTabs/components/BookmarkContainer.tsx
@@ -10,9 +10,8 @@ import { CircleQuestionIcon, DiscoveryIcon, EnvelopeIcon, FriendsIcon, NitroIcon
import { classNameFactory } from "@utils/css";
import { getGuildAcronym, getIntlMessage } from "@utils/discord";
import { classes } from "@utils/misc";
-import { closeModal, openModal } from "@utils/modal";
import { findComponentByCodeLazy } from "@webpack";
-import { Avatar, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, Menu, React, ReadStateStore, ReadStateUtils, SelectedChannelStore, SelectedGuildStore, TextInput, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore, useState } from "@webpack/common";
+import { Avatar, ChannelStore, closeModal, ContextMenuApi, FluxDispatcher, GuildStore, Menu, openModal,React, ReadStateStore, ReadStateUtils, SelectedChannelStore, SelectedGuildStore, TextInput, Tooltip, useDrag, useDrop, useEffect, useRef, UserStore, useState } from "@webpack/common";
import { NotificationDot } from "./ChannelTab";
import { BookmarkContextMenu, EditModal } from "./ContextMenus";
diff --git a/src/equicordplugins/channelTabs/components/ContextMenus.tsx b/src/equicordplugins/channelTabs/components/ContextMenus.tsx
index 9a1072016..6efab55d0 100644
--- a/src/equicordplugins/channelTabs/components/ContextMenus.tsx
+++ b/src/equicordplugins/channelTabs/components/ContextMenus.tsx
@@ -11,8 +11,8 @@ import { bookmarkFolderColors, bookmarkPlaceholderName, closeOtherTabs, closeTab
import { Bookmark, BookmarkFolder, Bookmarks, ChannelTabsProps, UseBookmarkMethods } from "@equicordplugins/channelTabs/util/types";
import { getIntlMessage } from "@utils/discord";
import { Margins } from "@utils/margins";
-import { closeModal, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
-import { Button, ChannelStore, ColorPicker, FluxDispatcher, Menu, ReadStateStore, ReadStateUtils, Select, TextInput, useMemo, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Button, ChannelStore, closeModal, ColorPicker, FluxDispatcher, Menu, Modal, openModal, ReadStateStore, ReadStateUtils, Select, TextInput, useMemo, useState } from "@webpack/common";
const legacyFolderColors: Record
= {
"var(--channeltabs-red)": bookmarkFolderColors.Red,
@@ -115,7 +115,7 @@ function FolderChipPreview({ name, color, iconName }: { name: string; color: str
}
function FolderIconPickerModal({ modalProps, modalKey, name, color, iconName, onSelect, onColorChange }: {
- modalProps: ModalProps,
+ modalProps: RenderModalProps,
modalKey: string,
name: string,
color: string,
@@ -133,73 +133,72 @@ function FolderIconPickerModal({ modalProps, modalKey, name, color, iconName, on
}, [iconNames, search]);
return (
-
-
- Choose Folder Icon
-
-
- Preview
-
- Icon Color
-
- {
- const nextColor = intToColor(value);
- setLocalColor(nextColor);
- onColorChange(nextColor);
- }}
- showEyeDropper={false}
- />
-
- Search
- Choose Folder Icon}
+ actions={[
+ {
+ text: "Close",
+ variant: "secondary",
+ onClick: () => closeModal(modalKey)
+ }
+ ]}
+ >
+ Preview
+
+ Icon Color
+
+
{
+ const nextColor = intToColor(value);
+ setLocalColor(nextColor);
+ onColorChange(nextColor);
+ }}
+ showEyeDropper={false}
/>
-
- {filteredIconNames.map(name => (
- {
- onSelect(name);
- closeModal(modalKey);
- }}
- style={{
- alignItems: "center",
- background: name === iconName ? "var(--background-modifier-hover)" : "var(--background-secondary)",
- border: "1px solid var(--border-subtle)",
- borderRadius: 8,
- cursor: "pointer",
- display: "flex",
- height: 52,
- justifyContent: "center",
- padding: 0
- }}
- title={name}
- type="button"
- >
-
-
- ))}
-
-
-
- closeModal(modalKey)}
- >Close
-
-
+
+ Search
+
+
+ {filteredIconNames.map(name => (
+ {
+ onSelect(name);
+ closeModal(modalKey);
+ }}
+ style={{
+ alignItems: "center",
+ background: name === iconName ? "var(--background-modifier-hover)" : "var(--background-secondary)",
+ border: "1px solid var(--border-subtle)",
+ borderRadius: 8,
+ cursor: "pointer",
+ display: "flex",
+ height: 52,
+ justifyContent: "center",
+ padding: 0
+ }}
+ title={name}
+ type="button"
+ >
+
+
+ ))}
+
+
);
}
@@ -263,7 +262,7 @@ function FolderAppearanceFields({
}
export function EditModal({ modalProps, modalKey, bookmark, onSave }: {
- modalProps: ModalProps,
+ modalProps: RenderModalProps,
modalKey: string,
bookmark: Bookmark | BookmarkFolder,
onSave: (name: string, color: string, iconName?: string) => void;
@@ -274,46 +273,47 @@ export function EditModal({ modalProps, modalKey, bookmark, onSave }: {
const placeholder = bookmarkPlaceholderName(bookmark);
return (
-
-
- Edit Bookmark
-
-
- {isBookmarkFolder(bookmark)
- ? Edit Bookmark}
+ actions={[
+ {
+ text: "Save",
+ variant: "primary",
+ onClick: () => onSave(name || placeholder, color, iconName)
+ },
+ {
+ text: "Cancel",
+ variant: "secondary",
+ onClick: () => closeModal(modalKey)
+ }
+ ]}
+ >
+ {isBookmarkFolder(bookmark)
+ ?
+ : <>
+ Bookmark Name
+
- : <>
- Bookmark Name
-
- >}
-
-
- onSave(name || placeholder, color, iconName)}
- >Save
- closeModal(modalKey)}
- >Cancel
-
-
+ >}
+
);
}
function AddToFolderModal({ modalProps, modalKey, bookmarks, onSave }: {
- modalProps: any,
+ modalProps: RenderModalProps,
modalKey: string,
bookmarks: Bookmarks,
onSave: (folderIndex: number, folderName: string, folderColor: string, iconName?: string) => void;
@@ -324,78 +324,79 @@ function AddToFolderModal({ modalProps, modalKey, bookmarks, onSave }: {
const [iconName, setIconName] = useState();
return (
-
-
- Add Bookmark to Folder
-
-
- Select a folder
- isBookmarkFolder(bookmark))
- .map(([index, bookmark]) => ({
- label: bookmark.name,
- value: parseInt(index, 10)
- })),
- {
- label: "Create one",
- value: -1,
- default: true
- }]}
- isSelected={v => v === folderIndex}
- select={setIndex}
- serialize={String}
- />
- {folderIndex === -1 && }
-
-
- onSave(folderIndex, folderName, folderColor, iconName)}
- >Save
- closeModal(modalKey)}
- >Cancel
-
-
+ Add Bookmark to Folder}
+ actions={[
+ {
+ text: "Save",
+ variant: "primary",
+ onClick: () => onSave(folderIndex, folderName, folderColor, iconName)
+ },
+ {
+ text: "Cancel",
+ variant: "secondary",
+ onClick: () => closeModal(modalKey)
+ }
+ ]}
+ >
+ Select a folder
+ isBookmarkFolder(bookmark))
+ .map(([index, bookmark]) => ({
+ label: bookmark.name,
+ value: parseInt(index, 10)
+ })),
+ {
+ label: "Create one",
+ value: -1,
+ default: true
+ }]}
+ isSelected={v => v === folderIndex}
+ select={setIndex}
+ serialize={String}
+ />
+ {folderIndex === -1 && }
+
);
}
-function DeleteFolderConfirmationModal({ modalProps, modalKey, onConfirm }) {
+function DeleteFolderConfirmationModal({ modalProps, modalKey, onConfirm }: {
+ modalProps: RenderModalProps,
+ modalKey: string,
+ onConfirm: () => void;
+}) {
return (
-
-
- Are you sure?
-
-
-
- Deleting a bookmark folder will also delete all bookmarks within it.
-
-
-
-
- Delete
-
- closeModal(modalKey)}
- >
- Cancel
-
-
-
+ Are you sure?}
+ actions={[
+ {
+ text: "Delete",
+ variant: "critical-primary",
+ onClick: onConfirm
+ },
+ {
+ text: "Cancel",
+ variant: "secondary",
+ onClick: () => closeModal(modalKey)
+ }
+ ]}
+ >
+
+ Deleting a bookmark folder will also delete all bookmarks within it.
+
+
);
}
diff --git a/src/equicordplugins/commandPalette/CommandPicker.tsx b/src/equicordplugins/commandPalette/CommandPicker.tsx
index 9ff4db0b6..746e6eeec 100644
--- a/src/equicordplugins/commandPalette/CommandPicker.tsx
+++ b/src/equicordplugins/commandPalette/CommandPicker.tsx
@@ -7,8 +7,8 @@
import { CogWheel } from "@components/Icons";
import { classNameFactory } from "@utils/css";
import { classes } from "@utils/misc";
-import { type ModalProps,ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { TextInput, useCallback, useEffect, useMemo, useRef, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal,openModal, TextInput, useCallback, useEffect, useMemo, useRef, useState } from "@webpack/common";
import {
type CommandEntry, getCategoryGroupLabel, getCategoryWeight, getCommandSearchText, getRecentRank, getRegistryVersion, listCommands, subscribeRegistry
@@ -56,7 +56,7 @@ export function openCommandPicker(props: CommandPickerProps) {
));
}
-function CommandPickerModal({ modalProps, commands: providedCommands, allowMultiple = false, initialQuery = "", initialSelectedIds = [], includeHiddenInSearch = false, emptyStateText = "No commands found", filter: filterPredicate, onSelect, onComplete, onClose }: CommandPickerProps & { modalProps: ModalProps; }) {
+function CommandPickerModal({ modalProps, commands: providedCommands, allowMultiple = false, initialQuery = "", initialSelectedIds = [], includeHiddenInSearch = false, emptyStateText = "No commands found", filter: filterPredicate, onSelect, onComplete, onClose }: CommandPickerProps & { modalProps: RenderModalProps; }) {
const [query, setQuery] = useState(initialQuery);
const [registryVersion, setRegistryVersion] = useState(() => getRegistryVersion());
const [selectedIndex, setSelectedIndex] = useState(-1);
@@ -321,8 +321,8 @@ function CommandPickerModal({ modalProps, commands: providedCommands, allowMulti
};
return (
-
-
+
+
-
+
);
}
diff --git a/src/equicordplugins/commandPalette/ui.tsx b/src/equicordplugins/commandPalette/ui.tsx
index 1ddf1233e..7f1ad3f32 100644
--- a/src/equicordplugins/commandPalette/ui.tsx
+++ b/src/equicordplugins/commandPalette/ui.tsx
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { closeModal, openModal } from "@utils/modal";
+import { closeModal, openModal } from "@webpack/common";
import { CommandPaletteModal } from "./ui/CommandPaletteModal";
diff --git a/src/equicordplugins/commandPalette/ui/CommandPaletteModal.tsx b/src/equicordplugins/commandPalette/ui/CommandPaletteModal.tsx
index d531a8c18..e6d442f6d 100644
--- a/src/equicordplugins/commandPalette/ui/CommandPaletteModal.tsx
+++ b/src/equicordplugins/commandPalette/ui/CommandPaletteModal.tsx
@@ -11,8 +11,8 @@ import { classNameFactory, classNameToSelector } from "@utils/css";
import { copyWithToast } from "@utils/discord";
import { Logger } from "@utils/Logger";
import { classes } from "@utils/misc";
-import { type ModalProps, ModalRoot, ModalSize } from "@utils/modal";
-import { TextInput, Toasts, useEffect, useMemo, useRef, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal,TextInput, Toasts, useEffect, useMemo, useRef, useState } from "@webpack/common";
import type { KeyboardEvent as ReactKeyboardEvent } from "react";
import { buildQueryResolution } from "../actions/executors";
@@ -282,7 +282,7 @@ function createInitialPageState(ref: PalettePageRef): PalettePageValuesState {
};
}
-export function CommandPaletteModal({ modalProps, instanceKey }: { modalProps: ModalProps; instanceKey: number; }) {
+export function CommandPaletteModal({ modalProps, instanceKey }: { modalProps: RenderModalProps; instanceKey: number; }) {
const {
compactStartEnabled = true,
closeAfterExecute = true
@@ -1469,12 +1469,12 @@ export function CommandPaletteModal({ modalProps, instanceKey }: { modalProps: M
}, [activePage, activePageFieldKey, activePageSpec, activePageState, activePageSuggestions]);
return (
-
-
+
{!isPageOpen && (
)}
-
+
);
}
diff --git a/src/equicordplugins/customFolderIcons/components.tsx b/src/equicordplugins/customFolderIcons/components.tsx
index b5feb52a7..1509e2288 100644
--- a/src/equicordplugins/customFolderIcons/components.tsx
+++ b/src/equicordplugins/customFolderIcons/components.tsx
@@ -4,8 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { closeModal, ModalContent, ModalHeader, ModalRoot, openModalLazy } from "@utils/modal";
-import { Button, Menu, Slider, TextInput, useState } from "@webpack/common";
+import { Button, closeModal, Menu, Modal,openModalLazy, Slider, TextInput, useState } from "@webpack/common";
import { folderIconsData, settings } from "./settings";
import { folderProp, int2rgba, setFolderData } from "./util";
@@ -95,17 +94,12 @@ export function makeContextItem(a: folderProp) {
action={() => {
openModalLazy(async () => {
return props => (
-
-
-
- Set a New Icon.
-
-
-
-
-
+
+
You might have to hover the folder after setting in order for it to refresh.
-
+
);
},
{
diff --git a/src/equicordplugins/customUserColors/SetColorModal.tsx b/src/equicordplugins/customUserColors/SetColorModal.tsx
index ba51afa70..c57ce4b63 100644
--- a/src/equicordplugins/customUserColors/SetColorModal.tsx
+++ b/src/equicordplugins/customUserColors/SetColorModal.tsx
@@ -5,17 +5,17 @@
*/
import { set } from "@api/DataStore";
-import { HeadingPrimary, HeadingSecondary } from "@components/Heading";
+import { HeadingSecondary } from "@components/Heading";
import { classNameFactory } from "@utils/css";
import { Margins } from "@utils/margins";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
-import { Button, ColorPicker, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { ColorPicker, Modal, React, useState } from "@webpack/common";
import { colors, DATASTORE_KEY } from "./index";
const cl = classNameFactory("vc-customColors-");
-export function SetColorModal({ id, modalProps }: { id: string, modalProps: ModalProps; }) {
+export function SetColorModal({ id, modalProps }: { id: string, modalProps: RenderModalProps; }) {
const initialColor = parseInt(colors[id], 16) || 372735;
// color picker default to current color set for user (if null it's 0x05afff :3 )
@@ -26,7 +26,7 @@ export function SetColorModal({ id, modalProps }: { id: string, modalProps: Moda
setColorPickerColor(color);
}
- function handleKey(e: KeyboardEvent) {
+ function handleKey(e: React.KeyboardEvent) {
if (e.key === "Enter")
saveUserColor();
}
@@ -44,14 +44,24 @@ export function SetColorModal({ id, modalProps }: { id: string, modalProps: Moda
}
return (
-
-
-
- Custom Color
-
-
-
-
+
+
Pick a Color
@@ -62,22 +72,7 @@ export function SetColorModal({ id, modalProps }: { id: string, modalProps: Moda
showEyeDropper={false}
/>
-
-
-
-
- Delete Entry
-
-
- Save
-
-
-
+
+
);
}
diff --git a/src/equicordplugins/customUserColors/index.tsx b/src/equicordplugins/customUserColors/index.tsx
index 55f92cf3f..92cc03da8 100644
--- a/src/equicordplugins/customUserColors/index.tsx
+++ b/src/equicordplugins/customUserColors/index.tsx
@@ -10,11 +10,10 @@ import { NavContextMenuPatchCallback } from "@api/ContextMenu";
import { get } from "@api/DataStore";
import { definePluginSettings, Settings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
-import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
import { Channel, User } from "@vencord/discord-types";
import { extractAndLoadChunksLazy } from "@webpack";
-import { ChannelStore, Menu, SelectedChannelStore } from "@webpack/common";
+import { ChannelStore, Menu, openModal,SelectedChannelStore } from "@webpack/common";
import { SetColorModal } from "./SetColorModal";
diff --git a/src/equicordplugins/findReply/ReplyNavigator.tsx b/src/equicordplugins/findReply/ReplyNavigator.tsx
index 1c656d1ce..c5aa6b158 100644
--- a/src/equicordplugins/findReply/ReplyNavigator.tsx
+++ b/src/equicordplugins/findReply/ReplyNavigator.tsx
@@ -8,10 +8,11 @@ import "./styles.css";
import ErrorBoundary from "@components/ErrorBoundary";
import { Paginator, requirePaginator } from "@plugins/reviewDB/components/ReviewModal";
-import { ModalCloseButton } from "@utils/modal";
import { Message } from "@vencord/discord-types";
-import { findCssClassesLazy } from "@webpack";
+import { findComponentByCodeLazy, findCssClassesLazy } from "@webpack";
import { React, useRef, useState } from "@webpack/common";
+
+const CloseButton = findComponentByCodeLazy("CLOSE_BUTTON_LABEL");
import { MutableRefObject } from "react";
import { jumper } from "./index";
@@ -53,7 +54,7 @@ export default function ReplyNavigator({ replies }: { replies: Message[]; }) {
totalCount={replies.length}
onPageChange={processPageChange}
/>
- setVisible(false)} />
+ setVisible(false)} />
);
diff --git a/src/equicordplugins/friendshipRanks/index.tsx b/src/equicordplugins/friendshipRanks/index.tsx
index c33b57b9e..5b777f009 100644
--- a/src/equicordplugins/friendshipRanks/index.tsx
+++ b/src/equicordplugins/friendshipRanks/index.tsx
@@ -13,9 +13,9 @@ import { Flex } from "@components/Flex";
import { Paragraph } from "@components/Paragraph";
import { Devs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
-import { ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin from "@utils/types";
-import { Forms, RelationshipStore } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Forms, Modal,openModal, RelationshipStore } from "@webpack/common";
interface rankInfo {
title: string;
@@ -84,10 +84,12 @@ const ranks: rankInfo[] =
];
function openRankModal(rank: rankInfo) {
- openModal(props => (
+ openModal((props: RenderModalProps) => (
-
-
+
-
-
-
-
- {rank.description}
-
-
-
-
+ }
+ >
+
+
+ {rank.description}
+
+
+
));
}
diff --git a/src/equicordplugins/ghosted/GhostedUsersModal.tsx b/src/equicordplugins/ghosted/GhostedUsersModal.tsx
index eb85658b5..ade418e6a 100644
--- a/src/equicordplugins/ghosted/GhostedUsersModal.tsx
+++ b/src/equicordplugins/ghosted/GhostedUsersModal.tsx
@@ -5,10 +5,9 @@
*/
import { classNameFactory } from "@utils/css";
-import { ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize } from "@utils/modal";
-import { Channel } from "@vencord/discord-types";
+import { Channel, RenderModalProps } from "@vencord/discord-types";
import { findByPropsLazy, findComponentByCodeLazy } from "@webpack";
-import { Avatar, Button, ChannelStore, MessageStore, React, Text, UserStore } from "@webpack/common";
+import { Avatar, Button, ChannelStore, MessageStore, Modal,React, Text, UserStore } from "@webpack/common";
const cl = classNameFactory("vc-boo-");
@@ -37,9 +36,8 @@ function GroupDmsIcon({ channel }: { channel: Channel; }) {
}
interface GhostedUsersModalProps {
- modalProps: any;
+ modalProps: RenderModalProps;
ghostedChannels: string[];
- onClose: () => void;
onClearGhost: (channelId: string) => void;
}
@@ -57,14 +55,14 @@ export function getChannelDisplayName(channelId: string): string {
return user?.username || "Unknown User";
}
-export function GhostedUsersModal({ modalProps, ghostedChannels: initialChannels, onClose, onClearGhost }: GhostedUsersModalProps) {
+export function GhostedUsersModal({ modalProps, ghostedChannels: initialChannels, onClearGhost }: GhostedUsersModalProps) {
const [ghostedChannels, setGhostedChannels] = React.useState(initialChannels);
const handleChannelClick = (channelId: string) => {
const channel = ChannelStore.getChannel(channelId);
if (channel) {
SelectedChannelActionCreators.selectPrivateChannel(channelId);
- onClose();
+ modalProps.onClose();
}
};
@@ -83,77 +81,67 @@ export function GhostedUsersModal({ modalProps, ghostedChannels: initialChannels
};
return (
-
-
-
- Ghosted Users ({ghostedChannels.length})
-
- {ghostedChannels.length > 0 && (
-
- Clear All
-
- )}
-
-
-
-
- {ghostedChannels.length === 0 ? (
-
No ghosts here!
- ) : (
- ghostedChannels.map(channelId => {
- const channel = ChannelStore.getChannel(channelId);
- if (!channel) return null;
+
0 ? [
+ {
+ text: "Clear All",
+ variant: "primary",
+ onClick: handleClearAll
+ }
+ ] : []}
+ >
+
+ {ghostedChannels.length === 0 ? (
+
No ghosts here!
+ ) : (
+ ghostedChannels.map(channelId => {
+ const channel = ChannelStore.getChannel(channelId);
+ if (!channel) return null;
- const lastMessage = MessageStore.getMessages(channelId)?.last();
- const lastMessageDate = lastMessage?.timestamp ? formatMessageDate(lastMessage.timestamp) : "";
+ const lastMessage = MessageStore.getMessages(channelId)?.last();
+ const lastMessageDate = lastMessage?.timestamp ? formatMessageDate(lastMessage.timestamp) : "";
- const displayName = getChannelDisplayName(channel.id);
- const userId = channel?.recipients?.[0] ?? "";
- return (
-
handleChannelClick(channelId)}
- className={cl("ghosted-entry")}
- >
- {channel.isGroupDM() ?
-
:
}
-
-
- {displayName}
+ const displayName = getChannelDisplayName(channel.id);
+ const userId = channel?.recipients?.[0] ?? "";
+ return (
+ handleChannelClick(channelId)}
+ className={cl("ghosted-entry")}
+ >
+ {channel.isGroupDM() ?
+
:
}
+
+
+ {displayName}
+
+ {lastMessageDate && (
+
+ {lastMessageDate}
- {lastMessageDate && (
-
- {lastMessageDate}
-
- )}
-
-
handleClearClick(e, channelId)}
- >
- Clear
-
+ )}
- );
- })
- )}
-
-
-
+
handleClearClick(e, channelId)}
+ >
+ Clear
+
+
+ );
+ })
+ )}
+
+
);
}
diff --git a/src/equicordplugins/ghosted/index.tsx b/src/equicordplugins/ghosted/index.tsx
index ca2b504d9..092316212 100644
--- a/src/equicordplugins/ghosted/index.tsx
+++ b/src/equicordplugins/ghosted/index.tsx
@@ -12,10 +12,9 @@ import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs, EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
-import { closeModal, openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
import { Channel } from "@vencord/discord-types";
-import { Menu, Tooltip, useEffect, useState } from "@webpack/common";
+import { Menu, openModal,Tooltip, useEffect, useState } from "@webpack/common";
import { Boo, clearChannelFromGhost, getBooCount, getGhostedChannels, onBooCountChange } from "./Boo";
import { getChannelDisplayName, GhostedUsersModal } from "./GhostedUsersModal";
@@ -85,12 +84,11 @@ function BooIndicator() {
const handleClick = () => {
const ghostedChannels = getGhostedChannels();
- const modalKey = openModal(modalProps => (
+ openModal(modalProps => (
closeModal(modalKey)}
onClearGhost={clearChannelFromGhost}
/>
diff --git a/src/equicordplugins/gifCollections/components/modals.tsx b/src/equicordplugins/gifCollections/components/modals.tsx
index 3e36e52b6..7647544ff 100644
--- a/src/equicordplugins/gifCollections/components/modals.tsx
+++ b/src/equicordplugins/gifCollections/components/modals.tsx
@@ -8,8 +8,8 @@ import { Flex } from "@components/Flex";
import { Heading } from "@components/Heading";
import { Paragraph } from "@components/Paragraph";
import { classes } from "@utils/misc";
-import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { Button, FluxDispatcher, TextInput, useCallback, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Button, FluxDispatcher, Modal, openModal, TextInput, useCallback, useState } from "@webpack/common";
import { settings } from "../settings";
import { Collection, Gif } from "../types";
@@ -49,124 +49,116 @@ export function openRenameCollectionModal(name: string) {
openModal(props =>
);
}
-function InfoModal({ props, title, rows }: { props: ModalProps; title: string; rows: { label: string; value: string; }[]; }) {
+function InfoModal({ props, title, rows }: { props: RenderModalProps; title: string; rows: { label: string; value: string; }[]; }) {
return (
-
-
- {title}
-
-
-
- {rows.map(row => (
-
- {row.label}
- {row.value}
-
+
+
+ {rows.map(row => (
+
+ {row.label}
+ {row.value}
+
+ ))}
+
+
+ );
+}
+
+function MoveToCollectionModal({ props, gifId }: { props: RenderModalProps; gifId: string; }) {
+ return (
+
+ Select a collection to move the item to
+
+ {cache_collections
+ .filter(col => col.name !== getItemCollectionNameFromId(gifId))
+ .map(col => (
+ {
+ const fromCollection = getItemCollectionNameFromId(gifId);
+ if (!fromCollection) return;
+ await moveGifToCollection(gifId, fromCollection, col.name);
+ FluxDispatcher.dispatch({ type: "GIF_PICKER_QUERY", query: "" });
+ FluxDispatcher.dispatch({ type: "GIF_PICKER_QUERY", query: fromCollection });
+ props.onClose();
+ }}
+ >
+ {stripPrefix(col.name)}
+
))}
-
-
-
- Close
-
-
+
+
);
}
-function MoveToCollectionModal({ props, gifId }: { props: ModalProps; gifId: string; }) {
- return (
-
-
- Move To Collection
-
-
- Select a collection to move the item to
-
- {cache_collections
- .filter(col => col.name !== getItemCollectionNameFromId(gifId))
- .map(col => (
- {
- const fromCollection = getItemCollectionNameFromId(gifId);
- if (!fromCollection) return;
- await moveGifToCollection(gifId, fromCollection, col.name);
- FluxDispatcher.dispatch({ type: "GIF_PICKER_QUERY", query: "" });
- FluxDispatcher.dispatch({ type: "GIF_PICKER_QUERY", query: fromCollection });
- props.onClose();
- }}
- >
- {stripPrefix(col.name)}
-
- ))}
-
-
-
- Close
-
-
- );
-}
-
-function CreateCollectionModal({ props, gif }: { props: ModalProps; gif: Gif; }) {
+function CreateCollectionModal({ props, gif }: { props: RenderModalProps; gif: Gif; }) {
const [name, setName] = useState("");
- const onSubmit = useCallback((e: React.FormEvent) => {
- e.preventDefault();
+ const onSubmit = useCallback((e?: React.FormEvent) => {
+ e?.preventDefault();
if (!name.length) return;
createCollection(name, [gif]);
props.onClose();
}, [name, gif, props]);
return (
-
+
-
+
);
}
-function RenameCollectionModal({ props, name }: { props: ModalProps; name: string; }) {
+function RenameCollectionModal({ props, name }: { props: RenderModalProps; name: string; }) {
const prefix = settings.store.collectionPrefix;
const strippedName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
const [newName, setNewName] = useState(strippedName);
const tooLong = newName.length >= 25;
- const onSubmit = useCallback(async (e: React.FormEvent) => {
- e.preventDefault();
+ const onSubmit = useCallback(async (e?: React.FormEvent) => {
+ e?.preventDefault();
if (!newName.length || tooLong) return;
await renameCollection(name, newName);
props.onClose();
}, [newName, name, tooLong, props]);
return (
-
+
-
+
);
}
diff --git a/src/equicordplugins/githubRepos/components/ProfilePopoutComponent.tsx b/src/equicordplugins/githubRepos/components/ProfilePopoutComponent.tsx
index 617ac8d3d..88591a36d 100644
--- a/src/equicordplugins/githubRepos/components/ProfilePopoutComponent.tsx
+++ b/src/equicordplugins/githubRepos/components/ProfilePopoutComponent.tsx
@@ -9,9 +9,8 @@ import { Span } from "@components/Span";
import { fetchReposByUserId, fetchReposByUsername, fetchUserInfo, GitHubUserInfo } from "@equicordplugins/githubRepos/githubApi";
import { GitHubRepo } from "@equicordplugins/githubRepos/types";
import { classes } from "@utils/misc";
-import { openModal } from "@utils/modal";
import { findCssClassesLazy } from "@webpack";
-import { Clickable, React, useEffect, UserProfileStore, useState } from "@webpack/common";
+import { Clickable, openModal,React, useEffect, UserProfileStore, useState } from "@webpack/common";
import { ReposModal } from "./ReposModal";
diff --git a/src/equicordplugins/githubRepos/components/ProfileTabComponent.tsx b/src/equicordplugins/githubRepos/components/ProfileTabComponent.tsx
index 3008f94a0..8b79bbcdd 100644
--- a/src/equicordplugins/githubRepos/components/ProfileTabComponent.tsx
+++ b/src/equicordplugins/githubRepos/components/ProfileTabComponent.tsx
@@ -7,8 +7,7 @@
import { BaseText } from "@components/BaseText";
import { fetchReposByUserId, fetchReposByUsername, fetchUserInfo, GitHubUserInfo } from "@equicordplugins/githubRepos/githubApi";
import { GitHubRepo } from "@equicordplugins/githubRepos/types";
-import { openModal } from "@utils/modal";
-import { React, useEffect, UserProfileStore, useState } from "@webpack/common";
+import { openModal,React, useEffect, UserProfileStore, useState } from "@webpack/common";
import { cl, settings } from "..";
import { RepoCard } from "./RepoCard";
diff --git a/src/equicordplugins/githubRepos/components/ReposModal.tsx b/src/equicordplugins/githubRepos/components/ReposModal.tsx
index 36bcc0902..885c9a643 100644
--- a/src/equicordplugins/githubRepos/components/ReposModal.tsx
+++ b/src/equicordplugins/githubRepos/components/ReposModal.tsx
@@ -4,12 +4,10 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { Button } from "@components/Button";
-import { HeadingPrimary } from "@components/Heading";
import { getLanguageColor } from "@equicordplugins/githubRepos/colors";
import { GitHubRepo } from "@equicordplugins/githubRepos/types";
-import { ModalContent, ModalFooter, ModalHeader, ModalRoot } from "@utils/modal";
-import { React } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal, React } from "@webpack/common";
import { cl } from "..";
import { Star } from "./Star";
@@ -20,7 +18,7 @@ interface ReposModalProps {
rootProps: any;
}
-export function ReposModal({ repos, username, rootProps }: ReposModalProps) {
+export function ReposModal({ repos, username, rootProps }: ReposModalProps & { rootProps: RenderModalProps; }) {
const renderTableHeader = () => (
@@ -63,44 +61,38 @@ export function ReposModal({ repos, username, rootProps }: ReposModalProps) {
);
return (
-
-
-
- {username}'s GitHub Repositories
-
-
-
-
-
-
-
-
-
-
-
- {renderTableHeader()}
-
- {repos.map(renderTableRow)}
-
-
-
-
-
- window.open(`https://github.com/${username}?tab=repositories`, "_blank")}
- >
- View on GitHub
-
-
- Close
-
-
-
+ window.open(`https://github.com/${username}?tab=repositories`, "_blank")
+ },
+ {
+ text: "Close",
+ variant: "secondary",
+ onClick: rootProps.onClose
+ }
+ ]}
+ >
+
+
+
+
+
+
+
+
+ {renderTableHeader()}
+
+ {repos.map(renderTableRow)}
+
+
+
+
);
}
diff --git a/src/equicordplugins/globalBadges/badgeModal.tsx b/src/equicordplugins/globalBadges/badgeModal.tsx
index e2c501b41..98a91ebec 100644
--- a/src/equicordplugins/globalBadges/badgeModal.tsx
+++ b/src/equicordplugins/globalBadges/badgeModal.tsx
@@ -4,14 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { Button } from "@components/Button";
import ErrorBoundary from "@components/ErrorBoundary";
import { HeadingTertiary } from "@components/Heading";
import { Paragraph } from "@components/Paragraph";
import { openInviteModal } from "@utils/discord";
-import { ModalContent, ModalFooter, ModalHeader, ModalRoot, openModal } from "@utils/modal";
-import { User } from "@vencord/discord-types";
-import { React, Tooltip } from "@webpack/common";
+import { RenderModalProps, User } from "@vencord/discord-types";
+import { Modal, openModal, React, Tooltip } from "@webpack/common";
import { cl, GlobalBadges, INVITE_LINK } from "./utils";
@@ -37,20 +35,32 @@ export function openBadgeModal(user: User) {
));
- openModal(modalprops => (
-
-
-
+ openModal((modalprops: RenderModalProps) => (
+
-
+
{user.username}
-
-
+
+ }
+ actions={[
+ {
+ text: "Join GlobalBadges Server",
+ variant: "link",
+ onClick: () => openInviteModal(INVITE_LINK)
+ }
+ ]}
+ >
+
+
{badgeDataElements.length ? (
<>
@@ -66,16 +76,8 @@ export function openBadgeModal(user: User) {
No global badges.
)}
-
-
- openInviteModal(INVITE_LINK)}
- >
- Join GlobalBadges Server
-
-
+
-
+
));
}
diff --git a/src/equicordplugins/hideServers/components/HiddenServersMenu.tsx b/src/equicordplugins/hideServers/components/HiddenServersMenu.tsx
index cdf840d10..863a6b848 100644
--- a/src/equicordplugins/hideServers/components/HiddenServersMenu.tsx
+++ b/src/equicordplugins/hideServers/components/HiddenServersMenu.tsx
@@ -10,40 +10,21 @@ import { HiddenServersStore } from "@equicordplugins/hideServers/HiddenServersSt
import { classNameFactory } from "@utils/css";
import { getGuildAcronym } from "@utils/discord";
import { classes } from "@utils/misc";
-import {
- closeModal,
- ModalCloseButton,
- ModalContent,
- ModalHeader,
- ModalProps,
- ModalRoot,
- ModalSize,
- openModal,
-} from "@utils/modal";
-import { Guild } from "@vencord/discord-types";
+import { Guild, RenderModalProps } from "@vencord/discord-types";
import { findCssClassesLazy } from "@webpack";
-import { Button, IconUtils, useStateFromStores } from "@webpack/common";
+import { Button, closeModal, IconUtils, Modal,openModal, useStateFromStores } from "@webpack/common";
import { SortedGuildStore } from "..";
const cl = classNameFactory("vc-hideservers-");
const IconClasses = findCssClassesLazy("icon", "acronym", "childWrapper");
-function HiddenServersModal({ modalProps, close }: { modalProps: ModalProps; close(): void; }) {
+function HiddenServersModal({ modalProps, close }: { modalProps: RenderModalProps; close(): void; }) {
const guilds = useStateFromStores([HiddenServersStore], () => HiddenServersStore.hiddenGuildsDetail());
return (
-
-
-
- Hidden Servers
-
-
-
-
-
-
-
-
+
+
+
);
}
diff --git a/src/equicordplugins/iconViewer/components/Modals.tsx b/src/equicordplugins/iconViewer/components/Modals.tsx
index 67cc8e8fb..7dfa433fb 100644
--- a/src/equicordplugins/iconViewer/components/Modals.tsx
+++ b/src/equicordplugins/iconViewer/components/Modals.tsx
@@ -5,7 +5,6 @@
*/
import { BaseText } from "@components/BaseText";
-import { Button } from "@components/Button";
import { CodeBlock } from "@components/CodeBlock";
import { Flex } from "@components/Flex";
import { HeadingSecondary } from "@components/Heading";
@@ -13,18 +12,8 @@ import { Paragraph } from "@components/Paragraph";
import { TooltipContainer } from "@components/TooltipContainer";
import { copyWithToast, getIntlMessage } from "@utils/discord";
import { Logger } from "@utils/Logger";
-import {
- CloseButton,
- ModalContent,
- ModalFooter,
- ModalHeader,
- ModalProps,
- ModalRoot,
- ModalSize,
- openModal
-} from "@utils/modal";
import { saveFile } from "@utils/web";
-import { Icon } from "@vencord/discord-types";
+import { Icon, RenderModalProps } from "@vencord/discord-types";
import { findComponentByCodeLazy } from "@webpack";
import {
Clickable,
@@ -32,6 +21,8 @@ import {
createRoot,
FluxDispatcher,
Menu,
+ Modal,
+ openModal,
ReactDOM,
useCallback,
useEffect,
@@ -226,7 +217,7 @@ function OtherContextMenu({ iconName, Icon, color }: { iconName: string; Icon: I
);
}
-function IconModal({ iconName, Icon, onClose, transitionState }: { iconName: string; Icon: Icon; } & ModalProps) {
+function IconModal({ iconName, Icon, onClose, transitionState }: { iconName: string; Icon: Icon; } & RenderModalProps) {
const [color, setColor] = useColorNavigation(209);
const colorData = cssColors[color];
const colorKeys = useMemo(() => getCssColorKeys(), []);
@@ -247,62 +238,59 @@ function IconModal({ iconName, Icon, onClose, transitionState }: { iconName: str
});
}, [colorKeys.length, setColor]);
- const openOtherMenu = (e: React.MouseEvent) => {
- ContextMenuApi.openContextMenu(e, () => (
+ const openOtherMenu = (e?: React.MouseEvent) => {
+ if (e) ContextMenuApi.openContextMenu(e, () => (
));
};
return (
-
-
-
-
{iconName}
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
- {iconSizes.map(size => (
-
-
-
- ))}
-
-
-
- {colorData?.name}
-
-
+
+
+ {iconSizes.map(size => (
+
+
+
+ ))}
+
+
+ {colorData?.name}
+
+
-
- Usage
- Click to copy
-
- {/* for some reason i cant make this shit codeblock full width, FF 15 */}
- copyWithToast(findCode, "Copied!")}>
-
-
-
-
-
- Actions
-
-
-
+
+
+ Usage
+ Click to copy
+
+ {/* for some reason i cant make this shit codeblock full width, FF 15 */}
+ copyWithToast(findCode, "Copied!")}>
+
+
+
);
}
diff --git a/src/equicordplugins/inRole/RoleMembersModal.tsx b/src/equicordplugins/inRole/RoleMembersModal.tsx
index 6483b105b..c628f985d 100644
--- a/src/equicordplugins/inRole/RoleMembersModal.tsx
+++ b/src/equicordplugins/inRole/RoleMembersModal.tsx
@@ -7,38 +7,35 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Paragraph } from "@components/Paragraph";
import { classNameFactory } from "@utils/css";
-import { ModalCloseButton, ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { GuildMember } from "@vencord/discord-types";
-import { Parser } from "@webpack/common";
+import { GuildMember, RenderModalProps } from "@vencord/discord-types";
+import { Modal,openModal, Parser, React } from "@webpack/common";
const cl = classNameFactory("vc-inrole-");
export function showInRoleModal(members: GuildMember[], roleId: string, channelId: string) {
- openModal(props =>
- <>
-
-
-
- Members of role {
- Parser.parse(`<@&${roleId}>`, true, { channelId, viewingChannelId: channelId })
- } ({members.length})
-
-
-
-
- {
- members.length !== 0 ? members.map(member =>
- <>
-
- {Parser.parse(`<@${member.userId}>`, true, { channelId, viewingChannelId: channelId })}
-
- >
- ) :
Looks like no online cached members with that role were found. Try scrolling down on your member list to cache more users!
- }
-
-
-
-
- >
+ openModal((props: RenderModalProps) =>
+
+
+ Members of role {Parser.parse(`<@&${roleId}>`, true, { channelId, viewingChannelId: channelId })} ({members.length})
+
+ }
+ >
+
+ {
+ members.length !== 0 ? members.map(member =>
+
+
+ {Parser.parse(`<@${member.userId}>`, true, { channelId, viewingChannelId: channelId })}
+
+
+ ) :
Looks like no online cached members with that role were found. Try scrolling down on your member list to cache more users!
+ }
+
+
+
);
}
diff --git a/src/equicordplugins/invisibleChat.desktop/components/DecryptionModal.tsx b/src/equicordplugins/invisibleChat.desktop/components/DecryptionModal.tsx
index b4946e28f..542d88230 100644
--- a/src/equicordplugins/invisibleChat.desktop/components/DecryptionModal.tsx
+++ b/src/equicordplugins/invisibleChat.desktop/components/DecryptionModal.tsx
@@ -16,59 +16,49 @@
* along with this program. If not, see
.
*/
-import { Heading, HeadingTertiary } from "@components/Heading";
-import {
- ModalContent,
- ModalFooter,
- ModalHeader,
- ModalRoot,
- openModal,
-} from "@utils/modal";
-import { Button, React, TextInput } from "@webpack/common";
+import { Heading } from "@components/Heading";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal, openModal, React, TextInput } from "@webpack/common";
import { buildEmbed, decrypt } from "../index";
-export function DecModal(props: any) {
+export function DecModal(props: RenderModalProps & { message: any; }) {
const encryptedMessage: string = props?.message?.content;
const [password, setPassword] = React.useState("password");
+ const onDecrypt = () => {
+ const toSend = decrypt(encryptedMessage, password, true);
+ if (!toSend || !props?.message) return;
+ buildEmbed(props?.message, toSend);
+ props.onClose();
+ };
+
return (
-
-
- Decrypt Message
-
-
-
- Message with Encryption
-
- Password
-
-
-
-
- {
- const toSend = decrypt(encryptedMessage, password, true);
- if (!toSend || !props?.message) return;
- buildEmbed(props?.message, toSend);
- props.onClose();
- }}>
- Decrypt
-
-
- Cancel
-
-
-
+
+ Message with Encryption
+
+ Password
+
+
);
}
diff --git a/src/equicordplugins/invisibleChat.desktop/components/EncryptionModal.tsx b/src/equicordplugins/invisibleChat.desktop/components/EncryptionModal.tsx
index 04a225d5c..f27f11f82 100644
--- a/src/equicordplugins/invisibleChat.desktop/components/EncryptionModal.tsx
+++ b/src/equicordplugins/invisibleChat.desktop/components/EncryptionModal.tsx
@@ -17,21 +17,14 @@
*/
import { FormSwitch } from "@components/FormSwitch";
-import { Heading, HeadingTertiary } from "@components/Heading";
+import { Heading } from "@components/Heading";
import { insertTextIntoChatInputBox } from "@utils/discord";
-import {
- ModalContent,
- ModalFooter,
- ModalHeader,
- ModalProps,
- ModalRoot,
- openModal,
-} from "@utils/modal";
-import { Button, React, TextInput } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal, openModal, React, TextInput } from "@webpack/common";
import { encrypt } from "../index";
-function EncModal(props: ModalProps) {
+function EncModal(props: RenderModalProps) {
const [secret, setSecret] = React.useState("");
const [cover, setCover] = React.useState("");
const [password, setPassword] = React.useState("password");
@@ -39,72 +32,65 @@ function EncModal(props: ModalProps) {
const isValid = secret && (noCover || (cover && cover.trim().split(" ").length > 1));
+ const onSend = () => {
+ if (!isValid) return;
+ const encrypted = encrypt(secret, password, noCover ? "d d" : cover);
+ const toSend = noCover ? encrypted.replaceAll("d", "") : encrypted;
+ if (!toSend) return;
+
+ insertTextIntoChatInputBox(toSend);
+
+ props.onClose();
+ };
+
return (
-
-
- Encrypt Message
-
-
-
- Secret
- {
- setSecret(e);
- }}
- />
- Cover (2 or more Words!!)
- {
- setCover(e);
- }}
- />
- Password
- {
- setPassword(e);
- }}
- />
- {
- setNoCover(e);
- }}
- />
-
-
-
- {
- if (!isValid) return;
- const encrypted = encrypt(secret, password, noCover ? "d d" : cover);
- const toSend = noCover ? encrypted.replaceAll("d", "") : encrypted;
- if (!toSend) return;
-
- insertTextIntoChatInputBox(toSend);
-
- props.onClose();
- }}
- >
- Send
-
- {
- props.onClose();
- }}
- >
- Cancel
-
-
-
+
+ Secret
+ {
+ setSecret(e);
+ }}
+ />
+ Cover (2 or more Words!!)
+ {
+ setCover(e);
+ }}
+ />
+ Password
+ {
+ setPassword(e);
+ }}
+ />
+ {
+ setNoCover(e);
+ }}
+ />
+
);
}
diff --git a/src/equicordplugins/keyboardNavigation/components/CommandPalette.tsx b/src/equicordplugins/keyboardNavigation/components/CommandPalette.tsx
index d860aeace..5ea75ed67 100644
--- a/src/equicordplugins/keyboardNavigation/components/CommandPalette.tsx
+++ b/src/equicordplugins/keyboardNavigation/components/CommandPalette.tsx
@@ -9,14 +9,14 @@ import "./style.css";
import { actions } from "@equicordplugins/keyboardNavigation/commands";
import { classNameFactory } from "@utils/css";
import { Logger } from "@utils/Logger";
-import { closeAllModals, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { React, TextInput, useEffect, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { closeAllModals, Modal,openModal, React, TextInput, useEffect, useState } from "@webpack/common";
import { settings } from "..";
const logger = new Logger("CommandPalette", "#e5c890");
-export function CommandPalette({ modalProps }) {
+export function CommandPalette({ modalProps }: { modalProps: RenderModalProps; }) {
const cl = classNameFactory("vc-command-palette-");
const [focusedIndex, setFocusedIndex] = useState
(null);
const [startIndex, setStartIndex] = useState(0);
@@ -100,8 +100,8 @@ export function CommandPalette({ modalProps }) {
}, [queryEh]);
return (
-
-
+
+
setQuery(e)}
@@ -123,7 +123,7 @@ export function CommandPalette({ modalProps }) {
))}
-
+
);
}
diff --git a/src/equicordplugins/keyboardNavigation/components/MultipleChoice.tsx b/src/equicordplugins/keyboardNavigation/components/MultipleChoice.tsx
index 2929f1a94..b8a0a48fa 100644
--- a/src/equicordplugins/keyboardNavigation/components/MultipleChoice.tsx
+++ b/src/equicordplugins/keyboardNavigation/components/MultipleChoice.tsx
@@ -8,13 +8,13 @@ import "./style.css";
import { ButtonAction } from "@equicordplugins/keyboardNavigation/commands";
import { classNameFactory } from "@utils/css";
-import { closeAllModals, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { React, TextInput, useEffect, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { closeAllModals, Modal,openModal, React, TextInput, useEffect, useState } from "@webpack/common";
import { settings } from "..";
interface MultipleChoiceProps {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
onSelect: (selectedValue: any) => void;
choices: ButtonAction[];
}
@@ -99,9 +99,8 @@ export function MultipleChoice({ modalProps, onSelect, choices }: MultipleChoice
}, [queryEh]);
return (
- // @ts-ignore
-
-
+
+
setQuery(e)}
@@ -123,7 +122,7 @@ export function MultipleChoice({ modalProps, onSelect, choices }: MultipleChoice
))}
-
+
);
}
diff --git a/src/equicordplugins/keyboardNavigation/components/TextInput.tsx b/src/equicordplugins/keyboardNavigation/components/TextInput.tsx
index a070137ac..3198ce4b6 100644
--- a/src/equicordplugins/keyboardNavigation/components/TextInput.tsx
+++ b/src/equicordplugins/keyboardNavigation/components/TextInput.tsx
@@ -6,11 +6,11 @@
import "./style.css";
-import { closeAllModals, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { React, TextInput, useEffect, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { closeAllModals, Modal,openModal, React, TextInput, useEffect, useState } from "@webpack/common";
interface SimpleTextInputProps {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
onSelect: (inputValue: string) => void;
placeholder?: string;
info?: string;
@@ -35,16 +35,17 @@ export function SimpleTextInput({ modalProps, onSelect, placeholder, info }: Sim
}, []);
return (
- // @ts-ignore
-
- setInputValue(e as unknown as string)}
- style={{ width: "30vw", borderRadius: "5px" }}
- placeholder={placeholder ?? "Type and press Enter"}
- />
- {info && {info}
}
-
+
+
+
setInputValue(e as unknown as string)}
+ style={{ width: "30vw", borderRadius: "5px" }}
+ placeholder={placeholder ?? "Type and press Enter"}
+ />
+ {info && {info}
}
+
+
);
}
diff --git a/src/equicordplugins/keyboardNavigation/index.tsx b/src/equicordplugins/keyboardNavigation/index.tsx
index 852edafa6..2f10bee4f 100644
--- a/src/equicordplugins/keyboardNavigation/index.tsx
+++ b/src/equicordplugins/keyboardNavigation/index.tsx
@@ -7,9 +7,8 @@
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
-import { closeAllModals } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
-import { SettingsRouter, useState } from "@webpack/common";
+import { closeAllModals,SettingsRouter, useState } from "@webpack/common";
import { registerAction } from "./commands";
import { openCommandPalette } from "./components/CommandPalette";
diff --git a/src/equicordplugins/loginWithQR/ui/modals/QrModal.tsx b/src/equicordplugins/loginWithQR/ui/modals/QrModal.tsx
index 302640d56..f6da905fa 100644
--- a/src/equicordplugins/loginWithQR/ui/modals/QrModal.tsx
+++ b/src/equicordplugins/loginWithQR/ui/modals/QrModal.tsx
@@ -9,9 +9,6 @@ import { QrCodeIcon } from "@components/Icons";
import { wrapTab } from "@components/settings";
import loginWithQR from "@equicordplugins/loginWithQR";
import { images } from "@equicordplugins/loginWithQR/images";
-import {
- ModalProps,
-} from "@utils/modal";
import { findByPropsLazy } from "@webpack";
import {
RestAPI,
@@ -135,7 +132,7 @@ const handleProcessImage = (file: File, modalPropsRef: QrModalPropsRef) => {
reader.readAsDataURL(file);
};
-function QrModal(props: ModalProps) {
+function QrModal() {
const [state, setState] = useState(LoginStateType.Idle);
const [preview, setPreview] = useState(null);
const error = useRef(null);
diff --git a/src/equicordplugins/loginWithQR/ui/modals/VerifyModal.tsx b/src/equicordplugins/loginWithQR/ui/modals/VerifyModal.tsx
index f988367a5..5c239be74 100644
--- a/src/equicordplugins/loginWithQR/ui/modals/VerifyModal.tsx
+++ b/src/equicordplugins/loginWithQR/ui/modals/VerifyModal.tsx
@@ -8,21 +8,15 @@ import { BaseText } from "@components/BaseText";
import { Button, TextButton } from "@components/Button";
import { images } from "@equicordplugins/loginWithQR/images";
import { getIntlMessage } from "@utils/discord";
-import {
- ModalContent,
- ModalFooter,
- ModalProps,
- ModalRoot,
- ModalSize,
- openModal,
-} from "@utils/modal";
+import { RenderModalProps } from "@vencord/discord-types";
import { findByPropsLazy } from "@webpack";
import {
+ Modal,
+ openModal,
RestAPI,
useEffect,
useRef,
- useState,
-} from "@webpack/common";
+ useState } from "@webpack/common";
import { cl } from "..";
@@ -41,7 +35,7 @@ function VerifyModal({
}: {
token: string | null;
onAbort: () => void;
-} & ModalProps) {
+} & RenderModalProps) {
const [state, setState] = useState(
!token ? VerifyState.NotFound : VerifyState.Verifying
);
@@ -112,8 +106,8 @@ function VerifyModal({
}, [state]);
return (
-
-
+
+
{state === VerifyState.LoggedIn ? (
<>
>
)}
-
-
+
+
{state === VerifyState.LoggedIn ? (
{getIntlMessage("QR_CODE_LOGIN_FINISH_BUTTON")}
@@ -218,8 +212,8 @@ function VerifyModal({
: getIntlMessage("CANCEL")}
)}
-
-
+
+
);
}
diff --git a/src/equicordplugins/messageLoggerEnhanced/components/LogsModal.tsx b/src/equicordplugins/messageLoggerEnhanced/components/LogsModal.tsx
index 3fa47d67b..20a961ca8 100644
--- a/src/equicordplugins/messageLoggerEnhanced/components/LogsModal.tsx
+++ b/src/equicordplugins/messageLoggerEnhanced/components/LogsModal.tsx
@@ -8,13 +8,11 @@ import { BaseText } from "@components/BaseText";
import { Button } from "@components/Button";
import { Flex } from "@components/Flex";
import { InfoIcon } from "@components/Icons";
-import { Link } from "@components/Link";
import { copyWithToast, openUserProfile } from "@utils/discord";
-import { closeAllModals, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { LazyComponent } from "@utils/react";
-import { type User } from "@vencord/discord-types";
+import { RenderModalProps, type User } from "@vencord/discord-types";
import { find, findByCode, findByCodeLazy } from "@webpack";
-import { Alerts, ChannelStore, ContextMenuApi, FluxDispatcher, GuildStore, Menu, NavigationRouter, React, TabBar, TextInput, Tooltip, useMemo, useRef, useState } from "@webpack/common";
+import { Alerts, ChannelStore, closeAllModals, ContextMenuApi, FluxDispatcher, GuildStore, Menu, Modal, NavigationRouter, openModal, React, TabBar, TextInput, Tooltip, useMemo, useRef, useState } from "@webpack/common";
import { DBMessageRecord, deleteMessageIDB, deleteMessagesBulkIDB } from "../db";
import { cl, clearLogs, settings } from "../index";
@@ -62,7 +60,7 @@ export enum LogTabs {
}
interface Props {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
initalQuery?: string;
}
@@ -76,46 +74,96 @@ export function LogsModal({ modalProps, initalQuery }: Props) {
const { messages, total, statusTotal, pending, reset } = useMessages(queryEh, currentTab, sortNewest, numDisplayedMessages);
return (
-
-
- setQuery(e)} style={{ width: "100%" }} placeholder="Filter Messages" />
- {
- setCurrentTab(e);
- setNumDisplayedMessages(settings.store.messagesToDisplayAtOnceInLogs);
+
+ setQuery(e)} style={{ width: "100%" }} placeholder="Filter Messages" />
+ {
+ setCurrentTab(e);
+ setNumDisplayedMessages(settings.store.messagesToDisplayAtOnceInLogs);
+ contentRef.current?.firstElementChild?.scrollTo(0, 0);
+ }}
+ >
+
+ Deleted
+
+
+ Edited
+
+
+ Ghost Pinged
+
+
+
+ }
+ actions={[
+ {
+ text: "Clear All Logs",
+ variant: "dangerPrimary",
+ onClick: () => Alerts.show({
+ title: "Clear Logs",
+ body: "Are you sure you want to clear all the logs",
+ confirmText: "Clear",
+ // @ts-expect-error not typed
+ confirmVariant: "critical-primary",
+ cancelText: "Cancel",
+ onConfirm: async () => {
+ await clearLogs();
+ reset();
+ }
+ })
+ },
+ {
+ text: "Clear Visible Logs",
+ variant: "dangerSecondary",
+ disabled: messages?.length === 0,
+ onClick: () => Alerts.show({
+ title: "Clear Logs",
+ body: `Are you sure you want to clear ${messages.length} logs`,
+ confirmText: "Clear",
+ // @ts-expect-error not typed
+ confirmVariant: "critical-primary",
+ cancelText: "Cancel",
+ onConfirm: async () => {
+ await deleteMessagesBulkIDB(messages.map(e => e.message_id));
+ reset();
+ }
+ })
+ },
+ {
+ text: `Sort ${sortNewest ? "Oldest First" : "Newest First"}`,
+ variant: "secondary",
+ onClick: () => {
+ setSortNewest(e => {
+ const val = !e;
+ settings.store.sortNewest = val;
+ return val;
+ });
contentRef.current?.firstElementChild?.scrollTo(0, 0);
- }}
- >
-
- Deleted
-
-
- Edited
-
-
- Ghost Pinged
-
-
-
-
+ }
+ }
+ ]}
+ >
+
{
modalProps.transitionState === 1 &&
-
+
{messages != null && total === 0 && (
setNumDisplayedMessages(e => e + settings.store.messagesToDisplayAtOnceInLogs)}
/>
)}
-
+
}
-
- Alerts.show({
- title: "Clear Logs",
- body: "Are you sure you want to clear all the logs",
- confirmText: "Clear",
- // @ts-expect-error not typed
- confirmVariant: "critical-primary",
- cancelText: "Cancel",
- onConfirm: async () => {
- await clearLogs();
- reset();
- }
-
- })}
- >
- Clear All Logs
-
- Alerts.show({
- title: "Clear Logs",
- body: `Are you sure you want to clear ${messages.length} logs`,
- confirmText: "Clear",
- // @ts-expect-error not typed
- confirmVariant: "critical-primary",
- cancelText: "Cancel",
- onConfirm: async () => {
- await deleteMessagesBulkIDB(messages.map(e => e.message_id));
- reset();
- }
- })}
- >
- Clear Visible Logs
-
- {
- setSortNewest(e => {
- const val = !e;
- settings.store.sortNewest = val;
- return val;
- });
- contentRef.current?.firstElementChild?.scrollTo(0, 0);
- }}
- >
- Sort {sortNewest ? "Oldest First" : "Newest First"}
-
-
-
+
);
}
diff --git a/src/equicordplugins/moreStickers/components/picker.tsx b/src/equicordplugins/moreStickers/components/picker.tsx
index 6c652a3c8..c8e373584 100644
--- a/src/equicordplugins/moreStickers/components/picker.tsx
+++ b/src/equicordplugins/moreStickers/components/picker.tsx
@@ -4,13 +4,11 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { HeadingPrimary } from "@components/Heading";
import { PickerContent, PickerContentHeader, PickerContentRow, PickerContentRowGrid, PickerHeaderProps, SidebarProps, Sticker, StickerCategoryType, StickerPack } from "@equicordplugins/moreStickers/types";
import { sendSticker } from "@equicordplugins/moreStickers/upload";
import { clPicker, FFmpegStateContext } from "@equicordplugins/moreStickers/utils";
import { debounce } from "@shared/debounce";
-import { ModalContent, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { React, TextInput } from "@webpack/common";
+import { Modal,openModal, React, TextInput } from "@webpack/common";
import { JSX } from "react";
import { CategoryImage, CategoryScroller, CategoryWrapper, StickerCategory } from "./categories";
@@ -72,14 +70,9 @@ export const PickerSidebar = ({ packMetas, onPackSelect }: SidebarProps) => {
onClick={() => {
openModal(modalProps => {
return (
-
-
- Stickers+
-
-
-
-
-
+
+
+
);
});
}}
diff --git a/src/equicordplugins/musicControls/spotify/lyrics/components/lyrics.tsx b/src/equicordplugins/musicControls/spotify/lyrics/components/lyrics.tsx
index c4b15fa64..d028ded7f 100644
--- a/src/equicordplugins/musicControls/spotify/lyrics/components/lyrics.tsx
+++ b/src/equicordplugins/musicControls/spotify/lyrics/components/lyrics.tsx
@@ -9,8 +9,7 @@ import { TooltipContainer } from "@components/TooltipContainer";
import { settings } from "@equicordplugins/musicControls/settings";
import { SpotifyLrcStore } from "@equicordplugins/musicControls/spotify/lyrics/providers/store";
import { SpotifyStore } from "@equicordplugins/musicControls/spotify/SpotifyStore";
-import { openModal } from "@utils/modal";
-import { ContextMenuApi, React, useEffect, useState, useStateFromStores } from "@webpack/common";
+import { ContextMenuApi, openModal,React, useEffect, useState, useStateFromStores } from "@webpack/common";
import { LyricsContextMenu } from "./ctxMenu";
import { LyricsModal } from "./modal";
diff --git a/src/equicordplugins/musicControls/spotify/lyrics/components/modal.tsx b/src/equicordplugins/musicControls/spotify/lyrics/components/modal.tsx
index 71141e9a8..ef39de086 100644
--- a/src/equicordplugins/musicControls/spotify/lyrics/components/modal.tsx
+++ b/src/equicordplugins/musicControls/spotify/lyrics/components/modal.tsx
@@ -7,8 +7,8 @@
import { BaseText } from "@components/BaseText";
import { SpotifyStore, Track } from "@equicordplugins/musicControls/spotify/SpotifyStore";
import { openImageModal } from "@utils/discord";
-import { ModalContent, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
-import { React } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal,React } from "@webpack/common";
import { cl, NoteSvg, scrollClasses, useLyrics } from "./util";
@@ -18,72 +18,63 @@ const formatTime = (time: number) => {
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
};
-function ModalHeaderContent({ track }: { track: Track | null; }) {
+function getTitleNode(track: Track | null) {
if (!track) {
- return (
-
- No track playing
-
- );
+ return
No track playing ;
}
return (
-
-
- {track?.album?.image?.url && (
-
openImageModal({
- url: track.album.image.url,
- width: track.album.image.width,
- height: track.album.image.height,
- })}
- />
- )}
-
- {track.name}
- by {track.artists.map(a => a.name).join(", ")}
- on {track.album.name}
-
+
+ {track?.album?.image?.url && (
+
openImageModal({
+ url: track.album.image.url,
+ width: track.album.image.width,
+ height: track.album.image.height,
+ })}
+ />
+ )}
+
+ {track.name}
+ by {track.artists.map(a => a.name).join(", ")}
+ on {track.album.name}
-
+
);
}
const modalCurrentLine = cl("modal-line-current");
const modalLine = cl("modal-line");
-export function LyricsModal({ props }: { props: ModalProps; }) {
+export function LyricsModal({ props }: { props: RenderModalProps; }) {
const { track, lyricsInfo, currLrcIndex } = useLyrics({ scroll: false });
const currentLyrics = lyricsInfo?.lyricsVersions[lyricsInfo.useLyric];
return (
-
-
-
-
- {currentLyrics ? (
- currentLyrics.map((line, i) => (
-
- SpotifyStore.seek(line.time * 1000)}>
- {formatTime(line.time)}
-
- {line.text || NoteSvg()}
-
- ))
- ) : (
-
- No lyrics available :(
+
+
+ {currentLyrics ? (
+ currentLyrics.map((line, i) => (
+
+ SpotifyStore.seek(line.time * 1000)}>
+ {formatTime(line.time)}
+
+ {line.text || NoteSvg()}
- )}
-
-
-
+ ))
+ ) : (
+
+ No lyrics available :(
+
+ )}
+
+
);
}
diff --git a/src/equicordplugins/musicControls/tidal/lyrics/components/lyrics.tsx b/src/equicordplugins/musicControls/tidal/lyrics/components/lyrics.tsx
index 702393a4f..772d4c427 100644
--- a/src/equicordplugins/musicControls/tidal/lyrics/components/lyrics.tsx
+++ b/src/equicordplugins/musicControls/tidal/lyrics/components/lyrics.tsx
@@ -9,8 +9,7 @@ import { TooltipContainer } from "@components/TooltipContainer";
import { settings } from "@equicordplugins/musicControls/settings";
import { TidalLrcStore } from "@equicordplugins/musicControls/tidal/lyrics/providers/store";
import { TidalStore } from "@equicordplugins/musicControls/tidal/TidalStore";
-import { openModal } from "@utils/modal";
-import { ContextMenuApi, useEffect, useState, useStateFromStores } from "@webpack/common";
+import { ContextMenuApi, openModal,useEffect, useState, useStateFromStores } from "@webpack/common";
import { LyricsContextMenu } from "./ctxMenu";
import { LyricsModal } from "./modal";
diff --git a/src/equicordplugins/musicControls/tidal/lyrics/components/modal.tsx b/src/equicordplugins/musicControls/tidal/lyrics/components/modal.tsx
index c5337e5c4..8aa6a6aa2 100644
--- a/src/equicordplugins/musicControls/tidal/lyrics/components/modal.tsx
+++ b/src/equicordplugins/musicControls/tidal/lyrics/components/modal.tsx
@@ -6,7 +6,8 @@
import { BaseText } from "@components/BaseText";
import { TidalStore, Track } from "@equicordplugins/musicControls/tidal/TidalStore";
-import { ModalContent, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal,React } from "@webpack/common";
import { cl, NoteSvg, scrollClasses, useLyrics } from "./util";
@@ -16,58 +17,54 @@ const formatTime = (time: number) => {
return `${minutes}:${seconds.toString().padStart(2, "0")}`;
};
-function ModalHeaderContent({ track }: { track: Track; }) {
+function getTitleNode(track: Track | null) {
+ if (!track) return null;
return (
-
-
- {track?.imageSrc && (
-
- )}
-
- {track.name}
- by {track.artist}
- {track.album && on {track.album} }
-
+
+ {track?.imageSrc && (
+
+ )}
+
+ {track.name}
+ by {track.artist}
+ {track.album && on {track.album} }
-
+
);
}
-export function LyricsModal({ rootProps }: { rootProps: ModalProps; }) {
+export function LyricsModal({ rootProps }: { rootProps: RenderModalProps; }) {
const { track, lyrics, currLrcIndex } = useLyrics({ scroll: false });
const currentLyrics = lyrics || null;
const position = track ? TidalStore.mPosition : 0;
return (
-
- {track && }
-
-
- {currentLyrics ? (
- currentLyrics.map((line, i) => (
-
+
+ {currentLyrics ? (
+ currentLyrics.map((line, i) => (
+
+ TidalStore.seek(line.time * 1000)}
>
- TidalStore.seek(line.time * 1000)}
- >
- {formatTime(line.time)}
-
- {line.text || NoteSvg(cl("modal-note"))}
-
- ))
- ) : (
- No lyrics available :(
- )}
-
-
-
+ {formatTime(line.time)}
+
+ {line.text || NoteSvg(cl("modal-note"))}
+
+ ))
+ ) : (
+
No lyrics available :(
+ )}
+
+
);
}
diff --git a/src/equicordplugins/newPluginsManager/NewPluginsModal.tsx b/src/equicordplugins/newPluginsManager/NewPluginsModal.tsx
index 22f683a06..5be532abb 100644
--- a/src/equicordplugins/newPluginsManager/NewPluginsModal.tsx
+++ b/src/equicordplugins/newPluginsManager/NewPluginsModal.tsx
@@ -10,15 +10,14 @@ import { Settings, useSettings } from "@api/Settings";
import { BaseText } from "@components/BaseText";
import { Button } from "@components/Button";
import ErrorBoundary from "@components/ErrorBoundary";
-import { Flex } from "@components/Flex";
import { PluginDependencyList } from "@components/settings/tabs/plugins";
import { PluginCard } from "@components/settings/tabs/plugins/PluginCard";
import { ChangeList } from "@utils/ChangeList";
import { classNameFactory } from "@utils/css";
-import { CloseButton, closeModal, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { useForceUpdater } from "@utils/react";
+import { RenderModalProps } from "@vencord/discord-types";
import { findComponentByCodeLazy } from "@webpack";
-import { Tooltip, useMemo } from "@webpack/common";
+import { closeModal, Modal,openModal, Tooltip, useMemo } from "@webpack/common";
import { ReactNode } from "react";
import Plugins from "~plugins";
@@ -32,7 +31,7 @@ const Checkbox = findComponentByCodeLazy('"data-toggleable-component":"checkbox'
let hasSeen = false;
interface ModalComponentProps {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
newPlugins: Set;
newSettings: KnownPluginSettingsMap;
}
@@ -121,8 +120,10 @@ function NewPluginsModal({ modalProps, newPlugins, newSettings }: ModalComponent
};
return (
-
-
+
New Plugins and Settings ({totalCount})
@@ -131,53 +132,46 @@ function NewPluginsModal({ modalProps, newPlugins, newSettings }: ModalComponent
New plugins have been added since your last visit. Enable any you'd like or continue to dismiss.
-
-
-
-
+ }
+ >
+
+ {pluginCards}
+ {requiredPluginCards}
+
-
-
- {pluginCards}
- {requiredPluginCards}
-
-
+
+
+ The following plugins require a restart:
+
+ {changes.map(p => {p} )}
+
+ >
+ }
+ shouldShow={changes.hasChanges}
+ >
+ {tooltipProps => (
+
+ {changes.hasChanges ? "Restart" : "Continue"}
+
+ )}
+
-
-
-
- The following plugins require a restart:
-
- {changes.map(p => {p} )}
-
- >
- }
- shouldShow={changes.hasChanges}
- >
- {tooltipProps => (
-
- {changes.hasChanges ? "Restart" : "Continue"}
-
- )}
-
-
- {
- Settings.plugins.NewPluginsManager.enabled = !settings?.plugins?.NewPluginsManager?.enabled;
- }}
- >
- Don't show this again
-
-
-
-
+
{
+ Settings.plugins.NewPluginsManager.enabled = !settings?.plugins?.NewPluginsManager?.enabled;
+ }}
+ >
+ Don't show this again
+
+
+
);
}
diff --git a/src/equicordplugins/profileSets/components/confirmModal.tsx b/src/equicordplugins/profileSets/components/confirmModal.tsx
index 76da537d0..2d507b138 100644
--- a/src/equicordplugins/profileSets/components/confirmModal.tsx
+++ b/src/equicordplugins/profileSets/components/confirmModal.tsx
@@ -4,11 +4,11 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { Button } from "@components/Button";
-import { Heading } from "@components/Heading";
import { Paragraph } from "@components/Paragraph";
-import { ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
-interface ConfirmModalProps extends ModalProps {
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal, React } from "@webpack/common";
+
+interface ConfirmModalProps extends RenderModalProps {
title: string;
message: string;
confirmText: string;
@@ -17,7 +17,7 @@ interface ConfirmModalProps extends ModalProps {
onCancel: () => void;
}
-interface ImportProfilesModalProps extends ModalProps {
+interface ImportProfilesModalProps extends RenderModalProps {
title: string;
message: string;
onOverride: () => void;
@@ -25,57 +25,65 @@ interface ImportProfilesModalProps extends ModalProps {
onCancel: () => void;
}
-export function ConfirmModal({ title, message, confirmText, cancelText, onConfirm, onCancel, onClose, transitionState }: ConfirmModalProps) {
+export function ConfirmModal({ title, message, confirmText, cancelText, onConfirm, onCancel, ...props }: ConfirmModalProps) {
const closeAfter = (action: () => void) => () => {
action();
- onClose();
+ props.onClose();
};
return (
-
-
- {title}
-
-
- {message}
-
-
-
- {confirmText}
-
-
- {cancelText}
-
-
-
+
+ {message}
+
);
}
-export function ImportProfilesModal({ title, message, onOverride, onMerge, onCancel, onClose, transitionState }: ImportProfilesModalProps) {
+export function ImportProfilesModal({ title, message, onOverride, onMerge, onCancel, ...props }: ImportProfilesModalProps) {
const closeAfter = (action: () => void) => () => {
action();
- onClose();
+ props.onClose();
};
return (
-
-
- {title}
-
-
- {message}
-
-
-
- Override
-
-
- Merge
-
-
- Cancel
-
-
-
+
+ {message}
+
);
}
diff --git a/src/equicordplugins/profileSets/components/presetManager.tsx b/src/equicordplugins/profileSets/components/presetManager.tsx
index 74f2c5bc8..7207a7525 100644
--- a/src/equicordplugins/profileSets/components/presetManager.tsx
+++ b/src/equicordplugins/profileSets/components/presetManager.tsx
@@ -7,8 +7,7 @@
import { Button } from "@components/Button";
import { Heading } from "@components/Heading";
import { classes } from "@utils/misc";
-import { openModal } from "@utils/modal";
-import { React, SelectedGuildStore, TextInput, useStateFromStores } from "@webpack/common";
+import { openModal,React, SelectedGuildStore, TextInput, useStateFromStores } from "@webpack/common";
import { cl, settings } from "../index";
import { exportPresets, ImportDecision, importPresets, savePreset } from "../utils/actions";
diff --git a/src/equicordplugins/questify/components/settingsModal.tsx b/src/equicordplugins/questify/components/settingsModal.tsx
index 4b741c9d3..2a8019a25 100644
--- a/src/equicordplugins/questify/components/settingsModal.tsx
+++ b/src/equicordplugins/questify/components/settingsModal.tsx
@@ -5,8 +5,8 @@
*/
import PluginModal from "@components/settings/tabs/plugins/PluginModal";
-import { openModal } from "@utils/modal";
import type { Plugin } from "@utils/types";
+import { openModal } from "@webpack/common";
import { promptToRestartIfDirty } from "../settings/restartTracking";
import { setSettingsModalOpen } from "../state";
diff --git a/src/equicordplugins/quoter/index.tsx b/src/equicordplugins/quoter/index.tsx
index d41104617..6868ababf 100644
--- a/src/equicordplugins/quoter/index.tsx
+++ b/src/equicordplugins/quoter/index.tsx
@@ -5,14 +5,12 @@
*/
import { definePluginSettings } from "@api/Settings";
-import { BaseText } from "@components/BaseText";
import { FormSwitch } from "@components/FormSwitch";
import { Devs, EquicordDevs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord";
-import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
-import { Message } from "@vencord/discord-types";
-import { Button, IconUtils, Menu, TextInput, UploadHandler, useEffect, useState } from "@webpack/common";
+import { Message, RenderModalProps } from "@vencord/discord-types";
+import { IconUtils, Menu, Modal, openModal, TextInput, UploadHandler, useEffect, useState } from "@webpack/common";
import { QuoteIcon } from "./components/QuoteIcon";
import { QuoteFont } from "./types";
@@ -89,7 +87,7 @@ export default definePlugin({
}
});
-function QuoteModal({ message, ...props }: ModalProps & { message: Message; }) {
+function QuoteModal({ message, ...props }: RenderModalProps & { message: Message; }) {
const [gray, setGray] = useState(settings.store.grayscale);
const [showWatermark, setShowWatermark] = useState(settings.store.showWatermark);
const [saveAsGif, setSaveAsGif] = useState(settings.store.saveAsGif);
@@ -166,49 +164,48 @@ function QuoteModal({ message, ...props }: ModalProps & { message: Message; }) {
};
return (
-
-
-
- Catch Them In 4K.
-
-
-
-
-
+
+
-
-
-
- {showWatermark && (
-
-
-
- )}
-
-
-
- Export
-
-
- Send
-
+
+
+
+ {showWatermark && (
+
+
-
-
+ )}
+
);
}
diff --git a/src/equicordplugins/recentDMSwitcher/index.tsx b/src/equicordplugins/recentDMSwitcher/index.tsx
index 48e5977fa..44bf24a8f 100644
--- a/src/equicordplugins/recentDMSwitcher/index.tsx
+++ b/src/equicordplugins/recentDMSwitcher/index.tsx
@@ -10,9 +10,8 @@ import * as DataStore from "@api/DataStore";
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs, IS_MAC } from "@utils/constants";
import { classNameFactory } from "@utils/css";
-import { closeModal, openModal } from "@utils/modal";
import definePlugin, { makeRange, OptionType } from "@utils/types";
-import { Button, ChannelRouter, ChannelStore, IconUtils, React, RelationshipStore, SelectedChannelStore, Toasts, UserStore } from "@webpack/common";
+import { Button, ChannelRouter, ChannelStore, closeModal, IconUtils, openModal,React, RelationshipStore, SelectedChannelStore, Toasts, UserStore } from "@webpack/common";
const STORAGE_KEY = "RDMSwitch_history";
diff --git a/src/equicordplugins/remix/RemixModal.tsx b/src/equicordplugins/remix/RemixModal.tsx
index c77414f47..1ad9912cc 100644
--- a/src/equicordplugins/remix/RemixModal.tsx
+++ b/src/equicordplugins/remix/RemixModal.tsx
@@ -4,9 +4,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { BaseText } from "@components/BaseText";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal";
-import { Button } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal, React } from "@webpack/common";
import { sendRemix } from ".";
import { brushCanvas, canvas, cropCanvas, ctx, exportImg, shapeCanvas } from "./editor/components/Canvas";
@@ -15,7 +14,7 @@ import { resetBounds } from "./editor/tools/crop";
import { SendIcon } from "./icons/SendIcon";
type Props = {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
close: () => void;
url?: string;
};
@@ -38,18 +37,28 @@ async function closeModal(closeFunc: () => void, save?: boolean) {
export default function RemixModal({ modalProps, close, url }: Props) {
return (
-
-
- Remix
- closeModal(close)} />
-
-
-
-
-
- closeModal(close, true)} className="vc-remix-send"> Send
- closeModal(close)} color={Button.Colors.RED}>Close
-
-
+
+ Send
+
+ ) as any,
+ variant: "primary",
+ onClick: () => closeModal(close, true)
+ },
+ {
+ text: "Close",
+ variant: "dangerPrimary",
+ onClick: () => closeModal(close)
+ }
+ ]}
+ >
+
+
);
}
diff --git a/src/equicordplugins/remix/index.tsx b/src/equicordplugins/remix/index.tsx
index a03d89d09..23d1042c1 100644
--- a/src/equicordplugins/remix/index.tsx
+++ b/src/equicordplugins/remix/index.tsx
@@ -8,10 +8,9 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co
import { disableStyle, enableStyle } from "@api/Styles";
import { PaintbrushIcon } from "@components/Icons";
import { EquicordDevs } from "@utils/constants";
-import { closeModal, openModal } from "@utils/modal";
import definePlugin from "@utils/types";
import { extractAndLoadChunksLazy } from "@webpack";
-import { ChannelStore, DraftType, FluxDispatcher, Menu, PendingReplyStore, SelectedChannelStore, UploadHandler } from "@webpack/common";
+import { ChannelStore, closeModal, DraftType, FluxDispatcher, Menu, openModal,PendingReplyStore, SelectedChannelStore, UploadHandler } from "@webpack/common";
import RemixModal from "./RemixModal";
import css from "./styles.css?managed";
diff --git a/src/equicordplugins/scheduledMessages/components/ScheduleTimeModal.tsx b/src/equicordplugins/scheduledMessages/components/ScheduleTimeModal.tsx
index 95f4348af..d9126e8bf 100644
--- a/src/equicordplugins/scheduledMessages/components/ScheduleTimeModal.tsx
+++ b/src/equicordplugins/scheduledMessages/components/ScheduleTimeModal.tsx
@@ -8,9 +8,9 @@ import { Button } from "@components/Button";
import ErrorBoundary from "@components/ErrorBoundary";
import { Heading } from "@components/Heading";
import { classNameFactory } from "@utils/css";
-import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
+import { RenderModalProps } from "@vencord/discord-types";
import { findByPropsLazy } from "@webpack";
-import { ChannelStore, DraftType, showToast, TextInput, Toasts, UploadManager, useState } from "@webpack/common";
+import { ChannelStore, closeModal, DraftType, Modal, openModal, showToast, TextInput, Toasts, UploadManager, useState } from "@webpack/common";
import { ScheduledAttachment } from "../types";
import { addScheduledMessage, getChannelDisplayInfo } from "../utils";
@@ -23,7 +23,7 @@ function ScheduleTimeModalInner({ channelId, content, attachments, rootProps, cl
channelId: string;
content: string;
attachments?: ScheduledAttachment[];
- rootProps: ModalProps;
+ rootProps: RenderModalProps;
close: () => void;
}) {
const [scheduleType, setScheduleType] = useState<"delay" | "time">("delay");
@@ -69,74 +69,78 @@ function ScheduleTimeModalInner({ channelId, content, attachments, rootProps, cl
};
return (
-
-
- Schedule Message
-
-
+
+
+ {avatar &&
}
+
+ Scheduling for: {isDM ? name : `#${name}`}
+
+
-
-
- {avatar &&
}
-
- Scheduling for: {isDM ? name : `#${name}`}
-
+
Schedule Type
+
+ setScheduleType("delay")}
+ >
+ Delay
+
+ setScheduleType("time")}
+ >
+ Specific Time
+
+
+
+ {scheduleType === "delay" ? (
+ <>
+
Delay (minutes)
+
+ >
+ ) : (
+ <>
+
Date & Time
+
setScheduledDateTime(e.target.value)}
+ min={new Date().toISOString().slice(0, 16)}
+ />
+ >
+ )}
+
+ {error && (
+
+
+ {error}
-
-
Schedule Type
-
- setScheduleType("delay")}
- >
- Delay
-
- setScheduleType("time")}
- >
- Specific Time
-
-
-
- {scheduleType === "delay" ? (
- <>
-
Delay (minutes)
-
- >
- ) : (
- <>
-
Date & Time
-
setScheduledDateTime(e.target.value)}
- min={new Date().toISOString().slice(0, 16)}
- />
- >
- )}
-
- {error && (
-
-
- {error}
-
- )}
-
-
-
- Schedule
- Cancel
-
-
+ )}
+
);
}
diff --git a/src/equicordplugins/scheduledMessages/components/ViewScheduledModal.tsx b/src/equicordplugins/scheduledMessages/components/ViewScheduledModal.tsx
index 1c41e9dbe..0fb99f605 100644
--- a/src/equicordplugins/scheduledMessages/components/ViewScheduledModal.tsx
+++ b/src/equicordplugins/scheduledMessages/components/ViewScheduledModal.tsx
@@ -6,10 +6,9 @@
import { Button } from "@components/Button";
import ErrorBoundary from "@components/ErrorBoundary";
-import { Heading } from "@components/Heading";
import { classNameFactory } from "@utils/css";
-import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
-import { ChannelStore, showToast, Toasts, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { ChannelStore, closeModal, Modal, openModal, showToast, Toasts, useState } from "@webpack/common";
import { clearAllScheduledMessages, getChannelDisplayInfo, getScheduledMessages, removeScheduledMessage } from "../utils";
import { CalendarIcon, TimerIcon } from "./Icons";
@@ -17,7 +16,7 @@ import { CalendarIcon, TimerIcon } from "./Icons";
const cl = classNameFactory("vc-scheduled-msg-");
interface ViewScheduledModalProps {
- rootProps: ModalProps;
+ rootProps: RenderModalProps;
close: () => void;
}
@@ -36,69 +35,74 @@ function ViewScheduledModalInner({ rootProps, close }: ViewScheduledModalProps)
showToast("All scheduled messages cleared", Toasts.Type.SUCCESS);
};
+ const actions = [
+ {
+ text: "Close",
+ variant: "secondary",
+ onClick: close
+ }
+ ];
+
+ if (messages.length > 0) {
+ actions.unshift({
+ text: "Clear All",
+ variant: "dangerPrimary",
+ onClick: handleClearAll
+ });
+ }
+
return (
-
-
- Scheduled Messages
- {messages.length > 0 && (
-
- Clear All
-
- )}
-
-
+
+ {!messages.length ? (
+
+
+ No scheduled messages
+
+ ) : (
+
+ {messages.map(msg => {
+ const { name, avatar } = getChannelDisplayInfo(msg.channelId);
+ const channel = ChannelStore.getChannel(msg.channelId);
+ if (!channel) return null;
-
- {!messages.length ? (
-
-
- No scheduled messages
-
- ) : (
-
- {messages.map(msg => {
- const { name, avatar } = getChannelDisplayInfo(msg.channelId);
- const channel = ChannelStore.getChannel(msg.channelId);
- if (!channel) return null;
+ const isDM = channel.isPrivate();
+ const displayContent = msg.content.length > 200
+ ? msg.content.slice(0, 200) + "..."
+ : msg.content;
- const isDM = channel.isPrivate();
- const displayContent = msg.content.length > 200
- ? msg.content.slice(0, 200) + "..."
- : msg.content;
-
- return (
-
-
-
- {avatar &&
}
-
- {isDM ? name : `#${name}`}
-
-
-
-
- {new Date(msg.scheduledTime).toLocaleString()}
-
-
{displayContent}
+ return (
+
+
+
+ {avatar &&
}
+
+ {isDM ? name : `#${name}`}
+
-
handleDelete(msg.id)}
- >
- Delete
-
+
+
+ {new Date(msg.scheduledTime).toLocaleString()}
+
+
{displayContent}
- );
- })}
-
- )}
-
-
-
- Close
-
-
+
handleDelete(msg.id)}
+ >
+ Delete
+
+
+ );
+ })}
+
+ )}
+
);
}
diff --git a/src/equicordplugins/sekaiStickers/Components/Picker.tsx b/src/equicordplugins/sekaiStickers/Components/Picker.tsx
index 4a50e703d..1be2c7239 100644
--- a/src/equicordplugins/sekaiStickers/Components/Picker.tsx
+++ b/src/equicordplugins/sekaiStickers/Components/Picker.tsx
@@ -4,13 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { BaseText } from "@components/BaseText";
import { Flex } from "@components/Flex";
import { characters } from "@equicordplugins/sekaiStickers/characters.json";
-import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize } from "@utils/modal";
-import { React, ScrollerThin, TextInput } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal,React, ScrollerThin, TextInput } from "@webpack/common";
-export default function CharSelectModal({ modalProps, setCharacter }: { modalProps: ModalProps; setCharacter?: any; }) {
+export default function CharSelectModal({ modalProps, setCharacter }: { modalProps: RenderModalProps; setCharacter?: any; }) {
const [search, setSearch] = React.useState
("");
const memoedSearchChar = React.useMemo(() => {
@@ -30,22 +29,15 @@ export default function CharSelectModal({ modalProps, setCharacter }: { modalPro
});
}, [search, characters]);
return (
-
-
- Select character menu
-
-
-
-
- setSearch(e)} />
-
-
- {memoedSearchChar}
-
-
-
-
-
-
+
+
+ setSearch(e)} />
+
+
+ {memoedSearchChar}
+
+
+
+
);
}
diff --git a/src/equicordplugins/sekaiStickers/Components/SekaiStickersModal.tsx b/src/equicordplugins/sekaiStickers/Components/SekaiStickersModal.tsx
index 3b75dcbb9..da0465f84 100644
--- a/src/equicordplugins/sekaiStickers/Components/SekaiStickersModal.tsx
+++ b/src/equicordplugins/sekaiStickers/Components/SekaiStickersModal.tsx
@@ -4,18 +4,17 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { BaseText } from "@components/BaseText";
import { Flex } from "@components/Flex";
import { FormSwitch } from "@components/FormSwitch";
import { Heading } from "@components/Heading";
import { characters } from "@equicordplugins/sekaiStickers/characters.json";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { Button, ChannelStore, React, SelectedChannelStore, Slider, TextArea, UploadHandler } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { ChannelStore, Modal, openModal, React, SelectedChannelStore, Slider, TextArea, UploadHandler } from "@webpack/common";
import Canvas from "./Canvas";
import CharSelectModal from "./Picker";
-export default function SekaiStickersModal({ modalProps, settings }: { modalProps: ModalProps; settings: any; }) {
+export default function SekaiStickersModal({ modalProps, settings }: { modalProps: RenderModalProps; settings: any; }) {
const [text, setText] = React.useState("奏でーかわいい");
const [character, setChracter] = React.useState(49);
const [fontSize, setFontSize] = React.useState(characters[character].defaultText.s);
@@ -97,45 +96,51 @@ export default function SekaiStickersModal({ modalProps, settings }: { modalProp
}
};
return (
-
-
- Sekai Stickers
-
-
-
-
-
-
- Text Y Pos
- { va = Math.round(va); setPosition({ x: position.x, y: curve ? 256 + fontSize * 3 - va : 256 - va }); }} initialValue={curve ? 256 - position.y + fontSize * 3 : 256 - position.y} orientation={"vertical"} onValueRender={va => String(Math.round(va))} />
- Text XZ Pos
- { va = Math.round(va); setPosition({ y: position.y, x: va }); }} initialValue={position.x} orientation={"horizontal"} onValueRender={(v: number) => String(Math.round(v))} />
-
-
- Text
-
- Rotation
- setRotate(val)} initialValue={rotate} keyboardStep={0.2} orientation={"horizontal"} onValueRender={(v: number) => String(v.toFixed(2))} />
- Font Size
- setFontSize(Math.round(val))} maxValue={100} initialValue={fontSize} keyboardStep={1} orientation={"horizontal"} onValueRender={(v: number) => String(Math.round(v))} />
- Spacing
- setSpaceSize(e)} onValueRender={e => String(Math.round(e))} />
- setCurve(val)} />
- openModal(props => )}>Switch Character
-
-
-
-
-
- {
+ {
+ openModal(props => );
+ }
+ },
+ {
+ text: "Upload as Attachment",
+ variant: "primary",
+ onClick: () => {
if (settings.store.AutoCloseModal) modalProps.onClose();
canvast.toBlob(blob => {
const file = new File([blob as Blob], `${characters[character].character}-sekai_cards.png`, { type: "image/png" });
UploadHandler.promptToUpload([file], ChannelStore.getChannel(SelectedChannelStore.getChannelId()), 0);
});
- }}>Upload as Attachment
-
-
-
+ }
+ }
+ ]}
+ >
+
+
+
+ Text Y Pos
+ { va = Math.round(va); setPosition({ x: position.x, y: curve ? 256 + fontSize * 3 - va : 256 - va }); }} initialValue={curve ? 256 - position.y + fontSize * 3 : 256 - position.y} orientation={"vertical"} onValueRender={va => String(Math.round(va))} />
+ Text XZ Pos
+ { va = Math.round(va); setPosition({ y: position.y, x: va }); }} initialValue={position.x} orientation={"horizontal"} onValueRender={(v: number) => String(Math.round(v))} />
+
+
+ Text
+
+ Rotation
+ setRotate(val)} initialValue={rotate} keyboardStep={0.2} orientation={"horizontal"} onValueRender={(v: number) => String(v.toFixed(2))} />
+ Font Size
+ setFontSize(Math.round(val))} maxValue={100} initialValue={fontSize} keyboardStep={1} orientation={"horizontal"} onValueRender={(v: number) => String(Math.round(v))} />
+ Spacing
+ setSpaceSize(e)} onValueRender={e => String(Math.round(e))} />
+ setCurve(val)} />
+
+
+
);
}
diff --git a/src/equicordplugins/sekaiStickers/index.tsx b/src/equicordplugins/sekaiStickers/index.tsx
index aa6188e1a..965114fde 100644
--- a/src/equicordplugins/sekaiStickers/index.tsx
+++ b/src/equicordplugins/sekaiStickers/index.tsx
@@ -7,8 +7,8 @@
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
import { definePluginSettings } from "@api/Settings";
import { Devs } from "@utils/constants";
-import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
+import { openModal } from "@webpack/common";
import SekaiStickersModal from "./Components/SekaiStickersModal";
import { kanadeSvg } from "./kanade.svg";
diff --git a/src/equicordplugins/soggy/index.tsx b/src/equicordplugins/soggy/index.tsx
index 099e94792..c47670d55 100644
--- a/src/equicordplugins/soggy/index.tsx
+++ b/src/equicordplugins/soggy/index.tsx
@@ -8,9 +8,9 @@ import { AudioPlayerInterface, createAudioPlayer } from "@api/AudioPlayer";
import { HeaderBarButton } from "@api/HeaderBar";
import { definePluginSettings } from "@api/Settings";
import { EquicordDevs } from "@utils/constants";
-import { ModalProps, ModalRoot, openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
-import { React } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal,openModal, React } from "@webpack/common";
let boopSound: AudioPlayerInterface;
let song: AudioPlayerInterface;
@@ -26,7 +26,7 @@ function assignBoop(url: string, volume: number) {
boopSound.load();
}
-function SoggyModal(props: ModalProps) {
+function SoggyModal(props: RenderModalProps) {
if (settings.store.songVolume !== 0) {
React.useEffect(() => {
song?.loop();
@@ -54,14 +54,13 @@ function SoggyModal(props: ModalProps) {
};
return (
-
+
-
+
);
}
diff --git a/src/equicordplugins/songSpotlight.desktop/lib/oauth2.tsx b/src/equicordplugins/songSpotlight.desktop/lib/oauth2.tsx
index 7bf8e2847..2cee55f1f 100644
--- a/src/equicordplugins/songSpotlight.desktop/lib/oauth2.tsx
+++ b/src/equicordplugins/songSpotlight.desktop/lib/oauth2.tsx
@@ -4,9 +4,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { openModal } from "@utils/modal";
import { ApplicationIntegrationType } from "@vencord/discord-types/enums";
-import { OAuth2AuthorizeModal, showToast, Toasts } from "@webpack/common";
+import { OAuth2AuthorizeModal, openModal,showToast, Toasts } from "@webpack/common";
import { apiConstants, authFetch, getData } from "./api";
import { useAuthorizationStore } from "./stores/AuthorizationStore";
diff --git a/src/equicordplugins/songSpotlight.desktop/ui/settings/AddSong.tsx b/src/equicordplugins/songSpotlight.desktop/ui/settings/AddSong.tsx
index 9b0767daa..7085a5fb5 100644
--- a/src/equicordplugins/songSpotlight.desktop/ui/settings/AddSong.tsx
+++ b/src/equicordplugins/songSpotlight.desktop/ui/settings/AddSong.tsx
@@ -5,7 +5,6 @@
*/
import { BaseText } from "@components/BaseText";
-import { Button } from "@components/Button";
import ErrorBoundary from "@components/ErrorBoundary";
import { Flex } from "@components/Flex";
import { PlusIcon } from "@components/Icons";
@@ -13,11 +12,11 @@ import { cl, logger } from "@equicordplugins/songSpotlight.desktop/lib/utils";
import { Native } from "@equicordplugins/songSpotlight.desktop/service";
import { parsers } from "@song-spotlight/api/handlers";
import { Song } from "@song-spotlight/api/structs";
-import { closeModal, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
-import { Clickable, TextInput, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Clickable, closeModal, Modal, openModal, TextInput, useState } from "@webpack/common";
interface AddSongModalProps {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
close(): void;
onAdd(song: Song): string | undefined;
}
@@ -29,64 +28,60 @@ function AddSongModal({ modalProps, close, onAdd }: AddSongModalProps) {
return (
-
-
- Add a new song
-
-
-
-
- Song Spotlight supports these services: {parsers.map(x => x.label).join(", ")}
-
- {
- setURL(value);
- try {
- if (value) new URL(value);
- setError(undefined);
- } catch {
- setError("Invalid URL");
+ {
+ setPending(true);
+ try {
+ const parsed = await Native.parseLink(url);
+ if (!parsed) {
+ setError("Invalid link");
+ return setPending(false);
}
- }}
- />
-
-
-
-
- {
- setPending(true);
- try {
- const parsed = await Native.parseLink(url);
- if (!parsed) {
- setError("Invalid link");
- return setPending(false);
- }
- const result = onAdd(parsed);
- if (result) {
- setError(result);
- return setPending(false);
- }
-
- close();
- } catch (error) {
- logger.error("parseLink error", error);
-
- setError("Failed to parse link");
- setPending(false);
+ const result = onAdd(parsed);
+ if (result) {
+ setError(result);
+ return setPending(false);
}
- }}
- disabled={!url || !!error || pending}
- >
- Add song
-
-
-
-
+
+ close();
+ } catch (error) {
+ logger.error("parseLink error", error);
+
+ setError("Failed to parse link");
+ setPending(false);
+ }
+ }
+ }
+ ]}
+ >
+
+
+ Song Spotlight supports these services: {parsers.map(x => x.label).join(", ")}
+
+ {
+ setURL(value);
+ try {
+ if (value) new URL(value);
+ setError(undefined);
+ } catch {
+ setError("Invalid URL");
+ }
+ }}
+ />
+
+
);
}
diff --git a/src/equicordplugins/songSpotlight.desktop/ui/settings/index.tsx b/src/equicordplugins/songSpotlight.desktop/ui/settings/index.tsx
index 7a36d6f73..9f88f7f9c 100644
--- a/src/equicordplugins/songSpotlight.desktop/ui/settings/index.tsx
+++ b/src/equicordplugins/songSpotlight.desktop/ui/settings/index.tsx
@@ -20,8 +20,8 @@ import { UserData, UserDataSchema } from "@song-spotlight/api/structs";
import { sid } from "@song-spotlight/api/util";
import { readClipboard } from "@utils/clipboard";
import { copyWithToast } from "@utils/discord";
-import { ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { Alerts, Parser, showToast, Toasts, useCallback, useEffect, useMemo, useRef, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Alerts, Modal,openModal, Parser, showToast, Toasts, useCallback, useEffect, useMemo, useRef, useState } from "@webpack/common";
interface ImportButtonProps {
overwrite: boolean;
@@ -210,19 +210,14 @@ export default function Settings({ templateData }: SettingsProps) {
);
}
-export function SettingsModal({ modalProps, ...props }: SettingsProps & { modalProps: ModalProps; }) {
+export function SettingsModal({ modalProps, ...props }: SettingsProps & { modalProps: RenderModalProps; }) {
return (
-
-
- Song Spotlight
-
-
-
-
-
-
-
+
+
+
+
+
);
}
diff --git a/src/equicordplugins/statusPresets/index.tsx b/src/equicordplugins/statusPresets/index.tsx
index 225492694..fd5fd04a0 100644
--- a/src/equicordplugins/statusPresets/index.tsx
+++ b/src/equicordplugins/statusPresets/index.tsx
@@ -23,11 +23,10 @@ import { getUserSettingLazy } from "@api/UserSettings";
import ErrorBoundary from "@components/ErrorBoundary";
import { EquicordDevs } from "@utils/constants";
import { proxyLazy } from "@utils/lazy";
-import { openModalLazy } from "@utils/modal";
import { useForceUpdater } from "@utils/react";
import definePlugin, { OptionType, StartAt } from "@utils/types";
import { extractAndLoadChunksLazy, findComponentByCodeLazy, findModuleId, wreq } from "@webpack";
-import { Menu, OverridePremiumTypeStore, Toasts } from "@webpack/common";
+import { Menu, openModalLazy,OverridePremiumTypeStore, Toasts } from "@webpack/common";
interface Emoji {
animated: boolean;
diff --git a/src/equicordplugins/streaks/stores/AuthorizationStore.tsx b/src/equicordplugins/streaks/stores/AuthorizationStore.tsx
index 4057435fd..970f3b064 100644
--- a/src/equicordplugins/streaks/stores/AuthorizationStore.tsx
+++ b/src/equicordplugins/streaks/stores/AuthorizationStore.tsx
@@ -7,8 +7,7 @@
import * as DataStore from "@api/DataStore";
import { proxyLazy } from "@utils/lazy";
import { Logger } from "@utils/Logger";
-import { openModal } from "@utils/modal";
-import { OAuth2AuthorizeModal, showToast, Toasts, UserStore, zustandCreate, zustandPersist } from "@webpack/common";
+import { OAuth2AuthorizeModal, openModal,showToast, Toasts, UserStore, zustandCreate, zustandPersist } from "@webpack/common";
import { AUTHORIZE_URL, CLIENT_ID } from "../constants";
import { useStreaksStore } from "./StreaksStore";
diff --git a/src/equicordplugins/themeLibrary/components/ThemeCard.tsx b/src/equicordplugins/themeLibrary/components/ThemeCard.tsx
index 218c14de5..a2b6fc4e3 100644
--- a/src/equicordplugins/themeLibrary/components/ThemeCard.tsx
+++ b/src/equicordplugins/themeLibrary/components/ThemeCard.tsx
@@ -8,14 +8,13 @@ import { generateId } from "@api/Commands";
import { Settings } from "@api/Settings";
import { Button } from "@components/Button";
import { Card } from "@components/Card";
-import { HeadingPrimary, HeadingTertiary } from "@components/Heading";
+import { HeadingPrimary } from "@components/Heading";
import { Paragraph } from "@components/Paragraph";
import type { Theme, ThemeLikeProps } from "@equicordplugins/themeLibrary/types";
import { proxyLazy } from "@utils/lazy";
import { Margins } from "@utils/margins";
-import { ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import { User } from "@vencord/discord-types";
-import { FluxDispatcher, Parser, React, UserStore, UserUtils } from "@webpack/common";
+import { FluxDispatcher, Modal, openModal, Parser, React, UserStore, UserUtils } from "@webpack/common";
import { Constructor } from "type-fest";
import { LikesComponent } from "./LikesComponent";
@@ -65,36 +64,32 @@ export const ThemeCard: React.FC = ({ theme, themeLinks, likedTh
if (requiresThemeAttributes && !Settings.plugins.ThemeAttributes.enabled) {
openModal(modalProps => (
-
-
- Hold on!
-
-
-
- This theme requires the ThemeAttributes plugin to work properly!
- Do you want to enable it?
-
-
-
- {
+ {
Settings.plugins.ThemeAttributes.enabled = true;
modalProps.onClose();
handleAddRemoveTheme();
- }}
- >
- Enable Plugin
-
- modalProps.onClose()}
- >
- Cancel
-
-
-
+ }
+ },
+ {
+ text: "Cancel",
+ variant: "secondary",
+ onClick: () => modalProps.onClose()
+ }
+ ]}
+ >
+
+ This theme requires the ThemeAttributes plugin to work properly!
+ Do you want to enable it?
+
+
));
} else {
handleAddRemoveTheme();
diff --git a/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx b/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx
index 02212e0cb..5eef5a4d3 100644
--- a/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx
+++ b/src/equicordplugins/themeLibrary/components/ThemeInfoModal.tsx
@@ -5,19 +5,17 @@
*/
import { CodeBlock } from "@components/CodeBlock";
-import { Heading, HeadingTertiary } from "@components/Heading";
+import { Heading } from "@components/Heading";
import { Heart } from "@components/Heart";
import { Paragraph } from "@components/Paragraph";
import { Theme, ThemeInfoModalProps } from "@equicordplugins/themeLibrary/types";
-import { ClockIcon, DownloadIcon, WarningIcon } from "@equicordplugins/themeLibrary/utils/Icons";
+import { ClockIcon, WarningIcon } from "@equicordplugins/themeLibrary/utils/Icons";
import { copyToClipboard } from "@utils/clipboard";
import { openInviteModal } from "@utils/discord";
import { Margins } from "@utils/margins";
-import { classes } from "@utils/misc";
-import { ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
import type { PluginNative } from "@utils/types";
import { findComponentByCodeLazy } from "@webpack";
-import { Button, Parser, React, showToast, Toasts } from "@webpack/common";
+import { Button, Modal, openModal, Parser, React, showToast, Toasts } from "@webpack/common";
import { logger } from "./ThemeTab";
@@ -48,212 +46,192 @@ export const ThemeInfoModal: React.FC = ({ author, theme, .
const lastUpdated = Math.floor(new Date(last_updated ?? 0).getTime() / 1000);
return (
-
-
- {type} Details
-
-
- {authors.length > 1 ? "Authors" : "Author"}
-
-
-
-
-
- {authors.map(author => author.username).join(", ")}
-
-
- {version && (
- <>
-
Version
-
- {version}
-
- >
- )}
-
Likes
-
- {likes === 0 ? `Nobody liked this ${type} yet.` : `${likes} users liked this ${type}!`}
-
- {donate && (
- <>
-
Donate
-
- You can support the author by donating below!
-
-
- VencordNative.native.openExternal(donate)}>
-
- Donate
-
-
- >
- )}
- {(guild || invite) && (
- <>
-
Support Server
- {guild && (
-
- {guild.name}
-
- )}
-
- {
- e.preventDefault();
- const useInvite = guild ? guild.invite_link?.split("discord.gg/")[1] : invite;
- useInvite != null && openInviteModal(useInvite).catch(() => showToast("Invalid or expired invite!", Toasts.Type.FAILURE));
- }}
- >
- Join Discord Server
-
-
- >
- )}
-
Source
-
- openModal(modalProps => (
-
-
- Theme Source
-
-
-
-
-
-
-
- modalProps.onClose()}
- >
- Close
-
- {
- copyToClipboard(themeContent);
- showToast("Copied to Clipboard", Toasts.Type.SUCCESS);
- }}>Copy to Clipboard
-
-
- ))}
- >
- View Theme Source
-
-
- {tags && (
- <>
-
Tags
-
- {tags.map(tag => (
-
- {tag}
-
- ))}
-
- >
- )}
- {requiresThemeAttributes && (
-
- This theme requires the ThemeAttributes plugin!
-
- )}
- {last_updated && (
-
- This theme was last updated {Parser.parse("")} ({Parser.parse("")})
-
- )}
-
-
-
-
- props.onClose()}
- >
- Close
-
- {
+ props.onClose()
+ },
+ {
+ text: "Download",
+ variant: "positive",
+ disabled: !theme.content || theme.id === "preview",
+ onClick: async () => {
const themesDir = await VencordNative.themes.getThemesDir();
const exists = await Native.themeExists(themesDir, theme);
- // using another function so we get the proper file path instead of just guessing
- // which slash to use (im looking at you windows)
const validThemesDir = await Native.getThemesDir(themesDir, theme);
- // check if theme exists, and ask if they want to overwrite
if (exists) {
openModal(modalProps => (
-
-
- Conflict!
-
-
-
-
-
A theme with the same name already exist in your themes directory! Do you want to overwrite it?
-
-
- {validThemesDir}
-
-
-
-
-
-
- {
+ {
await downloadTheme(themesDir, theme);
modalProps.onClose();
- }}
- >
- Overwrite
-
- modalProps.onClose()}
- >
- Keep my file
-
-
-
+ }
+ },
+ {
+ text: "Keep my file",
+ variant: "positive",
+ onClick: () => modalProps.onClose()
+ }
+ ]}
+ >
+
+
+
A theme with the same name already exists in your themes directory! Do you want to overwrite it?
+
+
+ {validThemesDir}
+
+
+
+
+
));
} else {
await downloadTheme(themesDir, theme);
}
- }}
- >
+ }
+ }
+ ]}
+ >
+ {authors.length > 1 ? "Authors" : "Author"}
+
+
- Download
+
+
+ {authors.map(author => author.username).join(", ")}
+
-
-
-
+ {version && (
+ <>
+
Version
+
+ {version}
+
+ >
+ )}
+
Likes
+
+ {likes === 0 ? `Nobody liked this ${type} yet.` : `${likes} users liked this ${type}!`}
+
+ {donate && (
+ <>
+
Donate
+
+ You can support the author by donating below!
+
+
+ VencordNative.native.openExternal(donate)}>
+
+ Donate
+
+
+ >
+ )}
+ {(guild || invite) && (
+ <>
+
Support Server
+ {guild && (
+
+ {guild.name}
+
+ )}
+
+ {
+ e.preventDefault();
+ const useInvite = guild ? guild.invite_link?.split("discord.gg/")[1] : invite;
+ useInvite != null && openInviteModal(useInvite).catch(() => showToast("Invalid or expired invite!", Toasts.Type.FAILURE));
+ }}
+ >
+ Join Discord Server
+
+
+ >
+ )}
+
Source
+
+ openModal(modalProps => (
+ modalProps.onClose()
+ },
+ {
+ text: "Copy to Clipboard",
+ variant: "primary",
+ onClick: () => {
+ copyToClipboard(themeContent);
+ showToast("Copied to Clipboard", Toasts.Type.SUCCESS);
+ }
+ }
+ ]}
+ >
+
+
+
+
+ ))}
+ >
+ View Theme Source
+
+
+ {tags && (
+ <>
+
Tags
+
+ {tags.map(tag => (
+
+ {tag}
+
+ ))}
+
+ >
+ )}
+ {requiresThemeAttributes && (
+
+ This theme requires the ThemeAttributes plugin!
+
+ )}
+ {last_updated && (
+
+ This theme was last updated {Parser.parse("")} ({Parser.parse("")})
+
+ )}
+
+
+
);
};
diff --git a/src/equicordplugins/themeLibrary/types.ts b/src/equicordplugins/themeLibrary/types.ts
index 85edf8fc1..80760fa26 100644
--- a/src/equicordplugins/themeLibrary/types.ts
+++ b/src/equicordplugins/themeLibrary/types.ts
@@ -4,8 +4,7 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { ModalProps } from "@utils/modal";
-import { User } from "@vencord/discord-types";
+import { RenderModalProps, User } from "@vencord/discord-types";
type Author = {
github_name?: string;
@@ -35,7 +34,7 @@ export interface Theme {
requiresThemeAttributes?: boolean;
}
-export interface ThemeInfoModalProps extends ModalProps {
+export interface ThemeInfoModalProps extends RenderModalProps {
author: User | User[];
theme: Theme;
}
diff --git a/src/equicordplugins/themeLibrary/utils/auth.tsx b/src/equicordplugins/themeLibrary/utils/auth.tsx
index 9aba2d576..a39d1c358 100644
--- a/src/equicordplugins/themeLibrary/utils/auth.tsx
+++ b/src/equicordplugins/themeLibrary/utils/auth.tsx
@@ -7,8 +7,7 @@
import * as DataStore from "@api/DataStore";
import { showNotification } from "@api/Notifications";
import { logger, themeRequest } from "@equicordplugins/themeLibrary/components/ThemeTab";
-import { openModal } from "@utils/modal";
-import { OAuth2AuthorizeModal, Toasts, UserStore } from "@webpack/common";
+import { OAuth2AuthorizeModal, openModal,Toasts, UserStore } from "@webpack/common";
export async function authorizeUser(triggerModal: boolean = true) {
const isAuthorized = await getAuthorization();
diff --git a/src/equicordplugins/timezones/TimezoneModal.tsx b/src/equicordplugins/timezones/TimezoneModal.tsx
index e6c7116ff..7aa21096e 100644
--- a/src/equicordplugins/timezones/TimezoneModal.tsx
+++ b/src/equicordplugins/timezones/TimezoneModal.tsx
@@ -5,11 +5,11 @@
*/
import * as DataStore from "@api/DataStore";
-import { HeadingPrimary, HeadingSecondary } from "@components/Heading";
+import { HeadingSecondary } from "@components/Heading";
import { classNameFactory } from "@utils/css";
import { Margins } from "@utils/margins";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
-import { Button, SearchableSelect, useEffect, useMemo, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { Modal, SearchableSelect, useEffect, useMemo, useState } from "@webpack/common";
import { DATASTORE_KEY, getSystemTimezone, resolveUserTimezone, settings, timezones } from ".";
import { setTimezone, setUserDatabaseTimezone } from "./database";
@@ -21,7 +21,7 @@ export async function setUserTimezone(userId: string, timezone: string | null) {
const cl = classNameFactory("vc-timezone-");
-export function SetTimezoneModal({ userId, modalProps, database }: { userId: string, modalProps: ModalProps; database?: boolean; }) {
+export function SetTimezoneModal({ userId, modalProps, database }: { userId: string, modalProps: RenderModalProps; database?: boolean; }) {
const [currentValue, setCurrentValue] = useState(null);
useEffect(() => {
@@ -39,63 +39,59 @@ export function SetTimezoneModal({ userId, modalProps, database }: { userId: str
});
}, []);
+ const actions = [
+ {
+ text: "Save",
+ variant: "primary",
+ disabled: currentValue === null,
+ onClick: async () => {
+ if (database) {
+ const success = await setTimezone(currentValue!);
+ if (success) {
+ await setUserDatabaseTimezone(userId, currentValue);
+ }
+ } else {
+ await setUserTimezone(userId, currentValue);
+ }
+
+ modalProps.onClose();
+ }
+ }
+ ];
+
+ if (!database) {
+ actions.unshift({
+ text: "Delete Timezone",
+ variant: "dangerPrimary",
+ disabled: false,
+ onClick: async () => {
+ await setUserTimezone(userId, null);
+ modalProps.onClose();
+ }
+ });
+ }
+
return (
-
-
-
- Timezones
-
-
-
+
+
+
+ Select Timezone
+
-
-
-
- Select Timezone
-
-
- o.value === currentValue)?.value}
- placeholder={"Select a Timezone"}
- maxVisibleItems={5}
- closeOnSelect={true}
- onChange={v => setCurrentValue(v)}
- />
-
-
-
-
- {!database && (
- {
- await setUserTimezone(userId, null);
- modalProps.onClose();
- }}
- >
- Delete Timezone
-
- )}
- {
- if (database) {
- const success = await setTimezone(currentValue!);
- if (success) {
- await setUserDatabaseTimezone(userId, currentValue);
- }
- } else {
- await setUserTimezone(userId, currentValue);
- }
-
- modalProps.onClose();
- }}
- >
- Save
-
-
-
+ o.value === currentValue)?.value}
+ placeholder={"Select a Timezone"}
+ maxVisibleItems={5}
+ closeOnSelect={true}
+ onChange={v => setCurrentValue(v)}
+ />
+
+
);
}
diff --git a/src/equicordplugins/timezones/index.tsx b/src/equicordplugins/timezones/index.tsx
index d0a500991..02c287c7f 100644
--- a/src/equicordplugins/timezones/index.tsx
+++ b/src/equicordplugins/timezones/index.tsx
@@ -11,11 +11,10 @@ import * as DataStore from "@api/DataStore";
import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs, EquicordDevs } from "@utils/constants";
-import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
import { Message, User } from "@vencord/discord-types";
import { findByPropsLazy, findCssClassesLazy } from "@webpack";
-import { Button, Menu, showToast, Toasts, Tooltip, useEffect, UserStore, useState } from "@webpack/common";
+import { Button, Menu, openModal,showToast, Toasts, Tooltip, useEffect, UserStore, useState } from "@webpack/common";
import { deleteTimezone, getTimezone, loadDatabaseTimezones, setUserDatabaseTimezone } from "./database";
import { SetTimezoneModal } from "./TimezoneModal";
diff --git a/src/equicordplugins/userpfp/AvatarModal.tsx b/src/equicordplugins/userpfp/AvatarModal.tsx
index bd730895f..6e28e0544 100644
--- a/src/equicordplugins/userpfp/AvatarModal.tsx
+++ b/src/equicordplugins/userpfp/AvatarModal.tsx
@@ -5,13 +5,11 @@
*/
import { set } from "@api/DataStore";
-import { Button } from "@components/Button";
-import { Flex } from "@components/Flex";
import { Heading } from "@components/Heading";
import { Margins } from "@components/margins";
import { classNameFactory } from "@utils/css";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot } from "@utils/modal";
-import { IconUtils, React, TextInput, Toasts, UserStore, useState } from "@webpack/common";
+import { RenderModalProps } from "@vencord/discord-types";
+import { IconUtils, Modal, React, TextInput, Toasts, UserStore, useState } from "@webpack/common";
import { data, KEY_DATASTORE } from ".";
@@ -26,7 +24,7 @@ function fileToDataUrl(file: File): Promise {
});
}
-export function SetAvatarModal({ userId, modalProps }: { userId: string; modalProps: ModalProps; }) {
+export function SetAvatarModal({ userId, modalProps }: { userId: string; modalProps: RenderModalProps; }) {
const { avatars } = data;
const user = UserStore.getUser(userId);
const originalAvatar = IconUtils.getUserAvatarURL(user, true, 128) || "";
@@ -36,7 +34,7 @@ export function SetAvatarModal({ userId, modalProps }: { userId: string; modalPr
const [isDragging, setIsDragging] = useState(false);
const fileInputRef = React.useRef(null);
- function handleKey(e: KeyboardEvent) {
+ function handleKey(e: React.KeyboardEvent) {
if (e.key === "Enter") saveUserAvatar();
}
@@ -78,15 +76,30 @@ export function SetAvatarModal({ userId, modalProps }: { userId: string; modalPr
modalProps.onClose();
}
+ const actions = [
+ {
+ text: "Save",
+ variant: "primary",
+ onClick: saveUserAvatar
+ }
+ ];
+
+ if (avatars[userId]) {
+ actions.unshift({
+ text: "Delete",
+ variant: "dangerPrimary",
+ onClick: deleteUserAvatar
+ });
+ }
+
return (
-
-
- Custom Avatar
-
-
-
-
-
+
+
{/* Preview */}
@@ -141,17 +154,7 @@ export function SetAvatarModal({ userId, modalProps }: { userId: string; modalPr
}}
/>
-
-
-
-
-
- {avatars[userId] && (
- Delete
- )}
- Save
-
-
-
+
+
);
}
diff --git a/src/equicordplugins/userpfp/index.tsx b/src/equicordplugins/userpfp/index.tsx
index bcef0105c..65117dfad 100644
--- a/src/equicordplugins/userpfp/index.tsx
+++ b/src/equicordplugins/userpfp/index.tsx
@@ -17,11 +17,10 @@ import { Notice } from "@components/Notice";
import { Devs, EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import { openInviteModal } from "@utils/discord";
-import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
import { User } from "@vencord/discord-types";
import { extractAndLoadChunksLazy } from "@webpack";
-import { IconUtils, Menu, UserStore } from "@webpack/common";
+import { IconUtils, Menu, openModal,UserStore } from "@webpack/common";
import { SetAvatarModal } from "./AvatarModal";
diff --git a/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx b/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx
index 0bc5a1c53..dff15dda8 100644
--- a/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx
+++ b/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx
@@ -19,9 +19,8 @@ import {
wrapTab,
} from "@components/settings/tabs/BaseTab";
import { classes, isObjectEmpty } from "@utils/misc";
-import { closeAllModals } from "@utils/modal";
import { relaunch } from "@utils/native";
-import { Alerts, NavigationRouter, Toasts, useEffect, useState } from "@webpack/common";
+import { Alerts, closeAllModals,NavigationRouter, Toasts, useEffect, useState } from "@webpack/common";
import userpluginInstaller, { Native } from "..";
import {
diff --git a/src/equicordplugins/vcNarratorCustom/index.tsx b/src/equicordplugins/vcNarratorCustom/index.tsx
index fac57eced..e838dcc35 100644
--- a/src/equicordplugins/vcNarratorCustom/index.tsx
+++ b/src/equicordplugins/vcNarratorCustom/index.tsx
@@ -11,31 +11,22 @@ import { definePluginSettings } from "@api/Settings";
import { Button } from "@components/Button";
import { Divider } from "@components/Divider";
import ErrorBoundary from "@components/ErrorBoundary";
-import { HeadingPrimary, HeadingSecondary } from "@components/Heading";
+import { HeadingSecondary } from "@components/Heading";
import { Devs, EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import { Margins } from "@utils/margins";
-import {
- ModalCloseButton,
- ModalContent,
- ModalFooter,
- ModalHeader,
- ModalProps,
- ModalRoot,
- ModalSize,
- openModal,
-} from "@utils/modal";
import { wordsToTitle } from "@utils/text";
import definePlugin, { OptionType } from "@utils/types";
-import type { User } from "@vencord/discord-types";
+import { RenderModalProps, type User } from "@vencord/discord-types";
import { ChannelType } from "@vencord/discord-types/enums";
import {
- Button as DiscordButton,
ChannelStore,
Forms,
GuildMemberStore,
IconUtils,
Menu,
+ Modal,
+ openModal,
React,
SearchableSelect,
SelectedChannelStore,
@@ -686,7 +677,7 @@ interface UserContextProps {
user: User;
}
-function VoiceSelectModal({ modalProps, user }: { modalProps: ModalProps; user: User; }) {
+function VoiceSelectModal({ modalProps, user }: { modalProps: RenderModalProps; user: User; }) {
const DEFAULT_VALUE = "__default__";
const options = useMemo(() => {
@@ -741,80 +732,72 @@ function VoiceSelectModal({ modalProps, user }: { modalProps: ModalProps; user:
};
return (
-
-
- VC Narrator Voice
-
-
+ {
+ if (currentValue === DEFAULT_VALUE) {
+ settings.store.userVoiceMap = removeUserVoiceFromMap(settings.store.userVoiceMap, user.id);
+ } else {
+ settings.store.userVoiceMap = upsertUserVoiceMap(settings.store.userVoiceMap, user.id, currentValue);
+ }
+ modalProps.onClose();
+ }
+ }
+ ]}
+ >
+
+ Select voice for {user.username}
+ o.value === currentValue)?.value}
+ placeholder="Select a voice"
+ maxVisibleItems={6}
+ closeOnSelect={true}
+ onChange={v => setCurrentValue(v as any)}
+ />
-
-
- Select voice for {user.username}
- o.value === currentValue)?.value}
- placeholder="Select a voice"
- maxVisibleItems={6}
- closeOnSelect={true}
- onChange={v => setCurrentValue(v as any)}
- />
-
-
- Preview how this voice sounds with their name:
-
-
- previewVoice(clean(displayName, settings.store.latinOnly) || "Someone")}
- >
- {busy ? "Playing..." : `"${clean(displayName, settings.store.latinOnly) || "Someone"}"`}
-
- previewVoice(`${clean(displayName, settings.store.latinOnly) || "Someone"} joined`)}
- >
- Joined
-
- previewVoice(`${clean(displayName, settings.store.latinOnly) || "Someone"} left`)}
- >
- Left
-
-
-
-
-
-
-
-
+ Preview how this voice sounds with their name:
+
+
+ previewVoice(clean(displayName, settings.store.latinOnly) || "Someone")}
>
- Cancel
-
- {
- if (currentValue === DEFAULT_VALUE) {
- settings.store.userVoiceMap = removeUserVoiceFromMap(settings.store.userVoiceMap, user.id);
- } else {
- settings.store.userVoiceMap = upsertUserVoiceMap(settings.store.userVoiceMap, user.id, currentValue);
- }
- modalProps.onClose();
- }}
+ {busy ? "Playing..." : `"${clean(displayName, settings.store.latinOnly) || "Someone"}"`}
+
+ previewVoice(`${clean(displayName, settings.store.latinOnly) || "Someone"} joined`)}
>
- Save
-
+ Joined
+
+ previewVoice(`${clean(displayName, settings.store.latinOnly) || "Someone"} left`)}
+ >
+ Left
+
-
-
+
+
);
}
diff --git a/src/equicordplugins/viewRawVariant/index.tsx b/src/equicordplugins/viewRawVariant/index.tsx
index 97730526b..77e93b2cf 100644
--- a/src/equicordplugins/viewRawVariant/index.tsx
+++ b/src/equicordplugins/viewRawVariant/index.tsx
@@ -5,7 +5,6 @@
*/
import { NavContextMenuPatchCallback } from "@api/ContextMenu";
-import { BaseText } from "@components/BaseText";
import { CodeBlock } from "@components/CodeBlock";
import { Divider } from "@components/Divider";
import ErrorBoundary from "@components/ErrorBoundary";
@@ -13,18 +12,9 @@ import { Heading } from "@components/Heading";
import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord";
import { Margins } from "@utils/margins";
-import {
- closeModal,
- ModalCloseButton,
- ModalContent,
- ModalHeader,
- ModalRoot,
- ModalSize,
- openModal,
-} from "@utils/modal";
import definePlugin from "@utils/types";
import { Message } from "@vencord/discord-types";
-import { Menu } from "@webpack/common";
+import { Menu, Modal,openModal } from "@webpack/common";
type CustomMessage = Message & {
editHistory?: any;
@@ -60,38 +50,34 @@ function cleanMessage(msg: CustomMessage) {
}
function openViewRawModal(obj: any, type: string, isMessage?: boolean) {
- const key = openModal(props => (
+ openModal(props => (
-
-
-
- View Raw {type}
-
- closeModal(key)} />
-
-
-
- {isMessage && (
- <>
-
- Content
-
-
-
- >
- )}
+
+
+ {isMessage && (
+ <>
+
+ Content
+
+
+
+ >
+ )}
-
{type} Data
-
-
-
-
+ {type} Data
+
+
+
));
}
diff --git a/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogEntryComponent.tsx b/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogEntryComponent.tsx
index e343de4ef..3e3ccf26f 100644
--- a/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogEntryComponent.tsx
+++ b/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogEntryComponent.tsx
@@ -7,9 +7,8 @@
import "./VoiceChannelLogEntryComponent.css";
import { openUserProfile } from "@utils/discord";
-import { closeAllModals } from "@utils/modal";
import { Channel } from "@vencord/discord-types";
-import { ApplicationStore, Clickable, IconUtils, NavigationRouter, Timestamp, Tooltip, UserStore } from "@webpack/common";
+import { ApplicationStore, Clickable, closeAllModals,IconUtils, NavigationRouter, Timestamp, Tooltip, UserStore } from "@webpack/common";
import { getCallStartTime } from "../logs";
import { VoiceChannelLogEntry } from "../types";
diff --git a/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogModal.tsx b/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogModal.tsx
index 8437dc03d..60bf5a793 100644
--- a/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogModal.tsx
+++ b/src/equicordplugins/voiceChannelLog/components/VoiceChannelLogModal.tsx
@@ -4,12 +4,10 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { BaseText } from "@components/BaseText";
import { classes } from "@utils/misc";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { Channel } from "@vencord/discord-types";
+import { Channel, RenderModalProps } from "@vencord/discord-types";
import { findStoreLazy } from "@webpack";
-import { Button, React, ScrollerThin } from "@webpack/common";
+import { Modal, openModal, React, ScrollerThin } from "@webpack/common";
import { clearLogs, getVcLogs, vcLogSubscribe } from "../logs";
import { cl } from "../utils";
@@ -23,47 +21,43 @@ export function openVoiceChannelLog(channel: Channel) {
));
}
-export function VoiceChannelLogModal({ channel, props }: { channel: Channel; props: ModalProps; }) {
+export function VoiceChannelLogModal({ channel, props }: { channel: Channel; props: RenderModalProps; }) {
const logs = React.useSyncExternalStore(vcLogSubscribe, () => getVcLogs(channel.id));
return (
-
-
-
- {channel.name} logs
-
-
-
-
-
-
- {logs.length > 0 ? logs.map((entry, i) => {
- const elements: React.ReactNode[] = [];
-
- if (i === 0 || entry.timestamp.toDateString() !== logs[i - 1].timestamp.toDateString()) {
- elements.push(
-
- {entry.timestamp.toDateString()}
-
- );
- }
+ clearLogs(channel.id)
+ }
+ ]}
+ >
+
+ {logs.length > 0 ? logs.map((entry, i) => {
+ const elements: React.ReactNode[] = [];
+ if (i === 0 || entry.timestamp.toDateString() !== logs[i - 1].timestamp.toDateString()) {
elements.push(
-
+
+ {entry.timestamp.toDateString()}
+
);
+ }
- return elements;
- }) : (
- No logs to display.
- )}
-
-
+ elements.push(
+
+ );
-
- clearLogs(channel.id)}>
- Clear logs
-
-
-
+ return elements;
+ }) : (
+ No logs to display.
+ )}
+
+
);
}
diff --git a/src/equicordplugins/voiceMessageTranscriber.desktop/index.tsx b/src/equicordplugins/voiceMessageTranscriber.desktop/index.tsx
index 664013588..76b23c6c6 100644
--- a/src/equicordplugins/voiceMessageTranscriber.desktop/index.tsx
+++ b/src/equicordplugins/voiceMessageTranscriber.desktop/index.tsx
@@ -16,10 +16,10 @@ import { Heading } from "@components/Heading";
import { Span } from "@components/Span";
import { copyToClipboard } from "@utils/clipboard";
import { Devs } from "@utils/constants";
-import { ModalCloseButton, ModalContent, ModalHeader, ModalProps, ModalRoot, ModalSize, openModal } from "@utils/modal";
import definePlugin, { OptionType, PluginNative } from "@utils/types";
+import { RenderModalProps } from "@vencord/discord-types";
import { findComponentByCodeLazy } from "@webpack";
-import { lodash, ScrollerAuto, SearchableSelect, useEffect, useRef, useState } from "@webpack/common";
+import { lodash, Modal, openModal, ScrollerAuto, SearchableSelect, useEffect, useRef, useState } from "@webpack/common";
import { cl, decodeAudio, LANGUAGES, TranscriptionWorker } from "./utils";
const Native = VencordNative.pluginHelpers.VoiceMessageTranscriber as PluginNative;
@@ -93,7 +93,7 @@ const settings = definePluginSettings({
}
});
-function LanguageSelectionModal(props: { modalProps: ModalProps, src: string; }) {
+function LanguageSelectionModal(props: { modalProps: RenderModalProps, src: string; }) {
const { modalProps, src } = props;
const [language, setLanguage] = useState("auto");
const [task, setTask] = useState("transcribe");
@@ -118,51 +118,52 @@ function LanguageSelectionModal(props: { modalProps: ModalProps, src: string; })
};
return (
-
-
- Transcription Options
-
-
-
-
-
-
- Audio Language
-
- o.value === language)?.value}
- onChange={setLanguage}
- />
-
+
+
+
+
+ Audio Language
+
+ o.value === language)?.value}
+ onChange={setLanguage}
+ />
+
-
-
- Action
-
- setTask(v as string)}
- />
-
-
-
- Start
-
-
-
-
+
+
+ Action
+
+ setTask(v as string)}
+ />
+
+
+
);
}
-function TranscriptionModal(props: { modalProps: ModalProps, src: string, options: { language: string, task: string; }; }) {
+function TranscriptionModal(props: { modalProps: RenderModalProps, src: string, options: { language: string, task: string; }; }) {
const { modalProps, src, options } = props;
const [status, setStatus] = useState("initializing");
const [result, setResult] = useState<{ text: string, chunks: { timestamp: [number, number], text: string; }[]; } | null>(null);
@@ -252,61 +253,71 @@ function TranscriptionModal(props: { modalProps: ModalProps, src: string, option
: result.text
) : "";
- return
-
- Transcription
-
-
-
- {error ? (
-
- Error
- {error}
-
- Retry
-
-
- ) : (status === "complete" || (status === "transcribing" && result)) ? (
-
- {status === "transcribing" && (
- Transcribing in progress...
- )}
-
- {displayText}
-
-
-
-
-
+ const actions: any[] = [];
+ if (error) {
+ actions.push({
+ text: "Retry",
+ variant: "primary",
+ onClick: retry
+ });
+ } else if (status === "complete" || (status === "transcribing" && result)) {
+ actions.push({
+ text: copied ? "Copied!" : "Copy to Clipboard",
+ variant: "primary",
+ disabled: status === "transcribing" || copied,
+ onClick: () => {
+ copyToClipboard(displayText);
+ setCopied(true);
+ setTimeout(() => setCopied(false), 2000);
+ }
+ });
+ }
+
+ return (
+
+
+ {error ? (
+
+ Error
+ {error}
-
{
- copyToClipboard(displayText);
- setCopied(true);
- setTimeout(() => setCopied(false), 2000);
- }}
- >
- {copied ? "Copied!" : "Copy to Clipboard"}
-
-
- ) : (
-
-
- {status === "initializing" && "Initializing..."}
- {status === "downloading_audio" && "Downloading Audio..."}
- {status === "processing_audio" && "Processing Audio..."}
- {status === "loading" && "Loading Model..."}
- {status === "transcribing" && "Transcribing..."}
-
-
- )}
-
- ;
+ ) : (status === "complete" || (status === "transcribing" && result)) ? (
+
+ {status === "transcribing" && (
+ Transcribing in progress...
+ )}
+
+ {displayText}
+
+
+
+
+
+
+
+ ) : (
+
+
+ {status === "initializing" && "Initializing..."}
+ {status === "downloading_audio" && "Downloading Audio..."}
+ {status === "processing_audio" && "Processing Audio..."}
+ {status === "loading" && "Loading Model..."}
+ {status === "transcribing" && "Transcribing..."}
+
+
+ )}
+
+
+ );
}
export default definePlugin({
diff --git a/src/equicordplugins/webpackTarball/index.tsx b/src/equicordplugins/webpackTarball/index.tsx
index c96e9011c..faecd8ab2 100644
--- a/src/equicordplugins/webpackTarball/index.tsx
+++ b/src/equicordplugins/webpackTarball/index.tsx
@@ -8,13 +8,13 @@ import { definePluginSettings } from "@api/Settings";
import { BaseText } from "@components/BaseText";
import { Flex } from "@components/Flex";
import { FormSwitch } from "@components/FormSwitch";
-import { Heading, HeadingPrimary } from "@components/Heading";
+import { Heading } from "@components/Heading";
import { Devs } from "@utils/constants";
import { makeLazy } from "@utils/lazy";
-import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
+import { RenderModalProps } from "@vencord/discord-types";
import { findByProps, wreq } from "@webpack";
-import { Button, Timestamp, useState } from "@webpack/common";
+import { Button, Modal,openModal, Timestamp, useState } from "@webpack/common";
import TarFile from "./tar";
import * as Webpack from "./webpack";
@@ -37,10 +37,9 @@ export default definePlugin({
toolboxActions: {
"Webpack Tarball"() {
- const key = openModal(props => (
+ openModal(props => (
closeModal(key)}
/>
));
}
@@ -83,7 +82,7 @@ async function saveTar(patched: boolean) {
tar.save(`${root}.tar`);
}
-function TarModal({ modalProps, close }: { modalProps: ModalProps; close(): void; }) {
+function TarModal({ modalProps }: { modalProps: RenderModalProps; }) {
const webpackRequire = wreq as any;
const { buildNumber, builtAt } = getBuildNumber();
const [, rerender] = useState({});
@@ -99,66 +98,63 @@ function TarModal({ modalProps, close }: { modalProps: ModalProps; close(): void
const { patched } = settings.use(["patched"]);
const WEBPACK_CHUNK = "webpackChunkdiscord_app";
return (
-
-
-
- Webpack Tarball
-
+ {
+ saveTar(patched);
+ modalProps.onClose();
+ }
+ }
+ ]}
+ >
+
{"Build number "}
{buildNumber}
-
-
+
-
-
-
- Lazy chunks
-
-
-
- {loaded}/{all}
- {errored ? ` (${errored} errors)` : null}
-
- {
- setLoading(true);
- // @ts-ignore
- await Webpack.protectWebpack(window[WEBPACK_CHUNK], async () => {
- await Webpack.forceLoadAll(webpackRequire, rerender);
- });
- }}
- >
- {loaded === all ? "Loaded" : loading === all ? "Loading" : "Load all"}
-
-
-
+
+
+ Lazy chunks
+
+
+
+ {loaded}/{all}
+ {errored ? ` (${errored} errors)` : null}
+
+ {
+ setLoading(true);
+ // @ts-ignore
+ await Webpack.protectWebpack(window[WEBPACK_CHUNK], async () => {
+ await Webpack.forceLoadAll(webpackRequire, rerender);
+ });
+ }}
+ >
+ {loaded === all ? "Loaded" : loading === all ? "Loading" : "Load all"}
+
+
+
- settings.store.patched = v}
- title={settings.def.patched.description}
- hideBorder
- />
-
-
-
- {
- saveTar(patched);
- close();
- }}
- >
- Create
-
-
-
+ settings.store.patched = v}
+ title={settings.def.patched.description}
+ hideBorder
+ />
+
);
}
diff --git a/src/equicordplugins/zipPreview/components.tsx b/src/equicordplugins/zipPreview/components.tsx
index 5dc9cffbd..da2944bfc 100644
--- a/src/equicordplugins/zipPreview/components.tsx
+++ b/src/equicordplugins/zipPreview/components.tsx
@@ -4,16 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { Button } from "@components/Button";
import { CodeBlock } from "@components/CodeBlock";
import ErrorBoundary from "@components/ErrorBoundary";
-import { Flex } from "@components/Flex";
-import { Heading } from "@components/Heading";
import { ChevronSmallDownIcon, ChevronSmallUpIcon, FolderIcon } from "@components/Icons";
import { classNameFactory } from "@utils/css";
import { copyWithToast } from "@utils/discord";
-import { closeModal, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize, openModal } from "@utils/modal";
-import { useEffect, useMemo, useRef, useState } from "@webpack/common";
+import { Modal,openModal, useEffect, useMemo, useRef, useState } from "@webpack/common";
import {
createImageObjectUrl,
@@ -312,52 +308,50 @@ function openZipEntryModal(entry: ZipEntry) {
function openTextEntryModal(entry: ZipEntry) {
const content = readTextEntry(entry);
- const key = openModal(modalProps => (
+ openModal(modalProps => (
-
-
- {entry.name}
- closeModal(key)} />
-
-
-
-
-
-
-
-
- copyWithToast(content, "File contents copied to clipboard!")}>
- Copy
-
- makeDownload(entry)}>
- Download
-
-
-
-
+ copyWithToast(content, "File contents copied to clipboard!")
+ },
+ {
+ text: "Download",
+ variant: "primary",
+ onClick: () => makeDownload(entry)
+ }
+ ]}
+ >
+
+
+
+
));
}
function openImageEntryModal(entry: ZipEntry) {
- const key = openModal(modalProps => (
+ openModal(modalProps => (
-
-
- {entry.name}
- closeModal(key)} />
-
-
-
-
-
-
- makeDownload(entry)}>
- Download
-
-
-
-
+ makeDownload(entry)
+ }
+ ]}
+ >
+
+
));
}
diff --git a/src/plugins/favEmojiFirst/components/modals/ClearAliasesConfirmModal.tsx b/src/plugins/favEmojiFirst/components/modals/ClearAliasesConfirmModal.tsx
index dac9f4022..00365fe16 100644
--- a/src/plugins/favEmojiFirst/components/modals/ClearAliasesConfirmModal.tsx
+++ b/src/plugins/favEmojiFirst/components/modals/ClearAliasesConfirmModal.tsx
@@ -4,35 +4,29 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { Button } from "@components/Button";
-import { Heading } from "@components/Heading";
import { Paragraph } from "@components/Paragraph";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize } from "@utils/modal";
+import { Modal } from "@webpack/common";
import { ClearAliasesConfirmModalProps } from "./types";
export function ClearAliasesConfirmModal({ modalProps, onConfirm }: ClearAliasesConfirmModalProps) {
return (
-
-
- Delete all aliases
-
-
-
- This will remove every emoji alias you saved.
-
-
- {
+ {
await onConfirm();
modalProps.onClose();
- }}
- >
- Delete all aliases
-
-
-
+ }
+ }
+ ]}
+ >
+ This will remove every emoji alias you saved.
+
);
}
diff --git a/src/plugins/favEmojiFirst/components/modals/SetAliasModal.tsx b/src/plugins/favEmojiFirst/components/modals/SetAliasModal.tsx
index 19e0fddd6..2304f68d3 100644
--- a/src/plugins/favEmojiFirst/components/modals/SetAliasModal.tsx
+++ b/src/plugins/favEmojiFirst/components/modals/SetAliasModal.tsx
@@ -5,11 +5,8 @@
*/
import { BaseText } from "@components/BaseText";
-import { Button } from "@components/Button";
-import { Heading } from "@components/Heading";
import { Paragraph } from "@components/Paragraph";
-import { ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalRoot, ModalSize } from "@utils/modal";
-import { TextInput, useState } from "@webpack/common";
+import { Modal, TextInput, useState } from "@webpack/common";
import { SetAliasModalProps } from "./types";
@@ -30,45 +27,40 @@ export function SetAliasModal({
const canSave = !validationError && !duplicateAlias;
return (
-
-
- Set alias
-
-
-
-
- Set an alias for {emojiDisplayName}
- {
- setInput(value);
- setError(null);
- }}
- placeholder='Alias, e.g. "sob"'
- />
- {finalError && (
-
- {finalError}
-
- )}
-
-
-
- {
+ {
const result = await onSave(input);
if (!result.ok) {
setError(result.error);
return;
}
modalProps.onClose();
- }}
- >
- Save
-
-
-
+ }
+ }
+ ]}
+ >
+ Set an alias for {emojiDisplayName}
+ {
+ setInput(value);
+ setError(null);
+ }}
+ placeholder='Alias, e.g. "sob"'
+ />
+ {finalError && (
+
+ {finalError}
+
+ )}
+
);
}
diff --git a/src/plugins/favEmojiFirst/components/modals/types.ts b/src/plugins/favEmojiFirst/components/modals/types.ts
index 7295b38a7..725ddb6f2 100644
--- a/src/plugins/favEmojiFirst/components/modals/types.ts
+++ b/src/plugins/favEmojiFirst/components/modals/types.ts
@@ -4,12 +4,12 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
-import { ModalProps } from "@utils/modal";
+import { RenderModalProps } from "@vencord/discord-types";
export type SetAliasSaveResult = { ok: true; } | { ok: false; error: string; };
export interface SetAliasModalProps {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
emojiDisplayName: string;
initialAlias: string;
getValidationError: (input: string) => string | null;
@@ -18,6 +18,6 @@ export interface SetAliasModalProps {
}
export interface ClearAliasesConfirmModalProps {
- modalProps: ModalProps;
+ modalProps: RenderModalProps;
onConfirm: () => Promise;
}
diff --git a/src/plugins/favEmojiFirst/index.tsx b/src/plugins/favEmojiFirst/index.tsx
index e2a7b6251..2dc2bfe36 100644
--- a/src/plugins/favEmojiFirst/index.tsx
+++ b/src/plugins/favEmojiFirst/index.tsx
@@ -16,11 +16,10 @@ import { Paragraph } from "@components/Paragraph";
import { Devs, EquicordDevs } from "@utils/constants";
import { classNameFactory } from "@utils/css";
import { Logger } from "@utils/Logger";
-import { openModal } from "@utils/modal";
import definePlugin, { OptionType } from "@utils/types";
import { Emoji, Message } from "@vencord/discord-types";
import { findByPropsLazy } from "@webpack";
-import { EmojiStore, Menu, TextInput, Toasts, useEffect, useState } from "@webpack/common";
+import { EmojiStore, Menu, openModal,TextInput, Toasts, useEffect, useState } from "@webpack/common";
import { ClearAliasesConfirmModal } from "./components/modals/ClearAliasesConfirmModal";
import { SetAliasModal } from "./components/modals/SetAliasModal";
diff --git a/src/plugins/messageClickActions/ReactEmojiSetting.tsx b/src/plugins/messageClickActions/ReactEmojiSetting.tsx
index 536719fd3..14d621363 100644
--- a/src/plugins/messageClickActions/ReactEmojiSetting.tsx
+++ b/src/plugins/messageClickActions/ReactEmojiSetting.tsx
@@ -51,22 +51,26 @@ function getEmojiValue(emoji: EmojiSelectPayload | null | undefined) {
return emoji.name?.trim() ?? "";
}
-function toRenderedEmoji(value: string) {
+type RenderedEmoji =
+ | { kind: "custom"; id: string; name: string; animated: boolean; }
+ | { kind: "unicode"; name: string; animated: boolean; };
+
+function toRenderedEmoji(value: string): RenderedEmoji | null {
const trimmed = value.trim();
if (!trimmed) return null;
const customEmoji = parseCustomEmoji(trimmed);
if (customEmoji) {
return {
- kind: "custom" as const,
- id: customEmoji[3],
- name: customEmoji[2],
+ kind: "custom",
+ id: customEmoji[3]!,
+ name: customEmoji[2]!,
animated: customEmoji[1] === "a"
};
}
return {
- kind: "unicode" as const,
+ kind: "unicode",
name: trimmed,
animated: false
};
diff --git a/src/plugins/serverInfo/GuildInfoModal.tsx b/src/plugins/serverInfo/GuildInfoModal.tsx
index 8003be141..2db1a6e13 100644
--- a/src/plugins/serverInfo/GuildInfoModal.tsx
+++ b/src/plugins/serverInfo/GuildInfoModal.tsx
@@ -7,7 +7,6 @@
import "./styles.css";
import { Heading } from "@components/Heading";
-import { Paragraph } from "@components/Paragraph";
import { classNameFactory } from "@utils/css";
import { getGuildAcronym, openImageModal, openUserProfile } from "@utils/discord";
import { classes } from "@utils/misc";
diff --git a/src/plugins/showMeYourName/index.tsx b/src/plugins/showMeYourName/index.tsx
index 66370e952..17e72e45f 100644
--- a/src/plugins/showMeYourName/index.tsx
+++ b/src/plugins/showMeYourName/index.tsx
@@ -10,17 +10,17 @@ import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/Co
import { DataStore } from "@api/index";
import { isPluginEnabled } from "@api/PluginManager";
import { definePluginSettings } from "@api/Settings";
-import { Button, TextButton } from "@components/Button";
+import { TextButton } from "@components/Button";
import ErrorBoundary from "@components/ErrorBoundary";
import { Heading } from "@components/Heading";
import ircColors from "@plugins/ircColors";
import mentionAvatars from "@plugins/mentionAvatars";
import { Devs, EquicordDevs } from "@utils/constants";
-import { classNameFactory, ModalCloseButton, ModalContent, ModalFooter, ModalHeader, ModalProps, ModalRoot, openModal } from "@utils/index";
+import { classNameFactory } from "@utils/index";
import definePlugin, { OptionType } from "@utils/types";
-import { GuildMember, Message, User } from "@vencord/discord-types";
+import { GuildMember, Message, RenderModalProps, User } from "@vencord/discord-types";
import { findByCodeLazy, findStoreLazy } from "@webpack";
-import { ChannelStore, GuildMemberStore, GuildStore, Menu, MessageStore, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common";
+import { ChannelStore, GuildMemberStore, GuildStore, Menu, MessageStore, Modal, openModal, RelationshipStore, StreamerModeStore, TextInput, useEffect, useState } from "@webpack/common";
import { JSX } from "react";
const SMYNC = classNameFactory();
@@ -842,49 +842,19 @@ function removeHoveringReactionPopout(id: string) {
settings.store.triggerNameRerender = !settings.store.triggerNameRerender;
}
-function CustomNicknameModal({ modalProps, user }: { modalProps: ModalProps; user: User; }) {
+function CustomNicknameModal({ modalProps, user }: { modalProps: RenderModalProps; user: User; }) {
const [value, setValue] = useState(customNicknames[user.id] ?? "");
return (
-
-
-
- {customNicknames[user.id] ? "Change SMYN Nickname" : "Add SMYN Nickname"}
-
-
-
-
-
- {"Set a custom SMYN nickname for this user. Make use of it by specifying {custom} in the SMYN template settings."}
-
-
-
- SMYN Nickname
-
-
- {
- setValue("");
- delete customNicknames[user.id];
- await DataStore.set("SMYNCustomNicknames", customNicknames);
- settings.store.triggerNameRerender = !settings.store.triggerNameRerender;
- }}
- >
- Reset SMYN Nickname
-
-
-
-
- {
+ {
const trimmed = value.trim().slice(0, 32).trim();
if (trimmed) {
@@ -896,19 +866,42 @@ function CustomNicknameModal({ modalProps, user }: { modalProps: ModalProps; use
await DataStore.set("SMYNCustomNicknames", customNicknames);
settings.store.triggerNameRerender = !settings.store.triggerNameRerender;
modalProps.onClose();
- }}
- >
- Save
-
-
- Cancel
-
-
-
+ }
+ },
+ {
+ text: "Cancel",
+ variant: "secondary",
+ onClick: modalProps.onClose
+ }
+ ]}
+ >
+
+ {"Set a custom SMYN nickname for this user. Make use of it by specifying {custom} in the SMYN template settings."}
+
+
+
+ SMYN Nickname
+
+
+ {
+ setValue("");
+ delete customNicknames[user.id];
+ await DataStore.set("SMYNCustomNicknames", customNicknames);
+ settings.store.triggerNameRerender = !settings.store.triggerNameRerender;
+ }}
+ >
+ Reset SMYN Nickname
+
+
+
);
}
diff --git a/src/plugins/translate/TranslateIcon.tsx b/src/plugins/translate/TranslateIcon.tsx
index 20a3d834a..482c5bdbf 100644
--- a/src/plugins/translate/TranslateIcon.tsx
+++ b/src/plugins/translate/TranslateIcon.tsx
@@ -17,7 +17,6 @@
*/
import { ChatBarButton, ChatBarButtonFactory } from "@api/ChatButtons";
-import { Paragraph } from "@components/Paragraph";
import { TooltipContainer } from "@components/TooltipContainer";
import { classes } from "@utils/misc";
import { IconComponent } from "@utils/types";
diff --git a/src/plugins/translate/TranslateModal.tsx b/src/plugins/translate/TranslateModal.tsx
index dd73ca9d3..8b8f29375 100644
--- a/src/plugins/translate/TranslateModal.tsx
+++ b/src/plugins/translate/TranslateModal.tsx
@@ -21,7 +21,7 @@ import { FormSwitch } from "@components/FormSwitch";
import { HeadingSecondary } from "@components/Heading";
import { Margins } from "@utils/margins";
import { RenderModalProps } from "@vencord/discord-types";
-import { Forms, Modal, openModal, SearchableSelect, useMemo } from "@webpack/common";
+import { Modal, openModal, SearchableSelect, useMemo } from "@webpack/common";
import { settings } from "./settings";
import { getLanguages } from "./utils";
diff --git a/src/plugins/viewRaw/index.tsx b/src/plugins/viewRaw/index.tsx
index acff6e0c2..23cc95914 100644
--- a/src/plugins/viewRaw/index.tsx
+++ b/src/plugins/viewRaw/index.tsx
@@ -18,7 +18,6 @@
import { findGroupChildrenByChildId, NavContextMenuPatchCallback } from "@api/ContextMenu";
import { definePluginSettings } from "@api/Settings";
-import { BaseText } from "@components/BaseText";
import { CodeBlock } from "@components/CodeBlock";
import { Divider } from "@components/Divider";
import ErrorBoundary from "@components/ErrorBoundary";
@@ -30,7 +29,6 @@ import definePlugin, { IconComponent, OptionType } from "@utils/types";
import { Message } from "@vencord/discord-types";
import { ChannelStore, Forms, GuildRoleStore, Menu, Modal, openModal } from "@webpack/common";
-
const CopyIcon: IconComponent = ({ height = 20, width = 20, className }) => {
return (