@ryan-0324

Merge branch 'dev' of https://github.com/Vendicated/Vencord into discord-types
This commit is contained in:
ryan-0324 2024-06-22 06:57:04 -04:00
parent 98afd551fe
commit c7c417ae2d
7 changed files with 24 additions and 21 deletions

View file

@ -41,7 +41,7 @@ interface PluginData {
hasCommands: boolean;
required: boolean;
enabledByDefault: boolean;
target: "discordDesktop" | "vencordDesktop" | "web" | "dev";
target: "discordDesktop" | "vencordDesktop" | "desktop" | "web" | "dev";
filePath: string;
}

View file

@ -46,7 +46,7 @@ interface UserSettingDefinition<T> {
export const UserSettings: Record<PropertyKey, UserSettingDefinition<any>> | undefined = proxyLazyWebpack(() => {
const modId = findModuleId('"textAndImages","renderSpoilers"');
if (modId == null) {
new Logger("UserSettingsAPI ").error("Didn't find settings module.");
new Logger("UserSettingsAPI").error("Didn't find settings module.");
return;
}

View file

@ -8,6 +8,7 @@ import "./LinkIconButton.css";
import { getTheme, Theme } from "@utils/discord";
import { MaskedLink, Tooltip } from "@webpack/common";
import type { ComponentType } from "react";
const WebsiteIconDark = "/assets/e1e96d89e192de1997f73730db26e94f.svg";
const WebsiteIconLight = "/assets/730f58bcfd5a57a5e22460c445a0c6cf.svg";
@ -29,8 +30,7 @@ interface Props {
href: string;
}
function LinkIcon({ text, href, Icon }: Props & { Icon: React.ComponentType; }) {
return (
const LinkIcon = ({ text, href, Icon }: Props & { Icon: ComponentType; }) => (
<Tooltip text={text}>
{props => (
<MaskedLink {...props} href={href}>
@ -38,8 +38,7 @@ function LinkIcon({ text, href, Icon }: Props & { Icon: React.ComponentType; })
</MaskedLink>
)}
</Tooltip>
);
}
);
export const WebsiteButton = (props: Props) => <LinkIcon {...props} Icon={WebsiteIcon} />;
export const GithubButton = (props: Props) => <LinkIcon {...props} Icon={GithubIcon} />;

View file

@ -206,7 +206,7 @@ export default function PluginModal({ plugin, onRestartNeeded, onClose, transiti
}
*/
const pluginMeta = PluginMeta[plugin.name];
const pluginMeta = PluginMeta[plugin.name]!;
return (
<ModalRoot transitionState={transitionState} size={ModalSize.MEDIUM} className="vc-text-selectable">

View file

@ -173,7 +173,7 @@ export function subscribePluginFluxActions(plugin: Plugin, fluxDispatcher: typeo
try {
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
const res = handler.apply(plugin, arguments as any);
// @ts-ignore
// @ts-expect-error
return res instanceof Promise
? res.catch(e => { logger.error(`${plugin.name}: Error while handling ${action}\n`, e); })
: res;

View file

@ -91,7 +91,7 @@ export function identity<T>(value: T) {
// "In summary, we recommend looking for the string Mobi anywhere in the User Agent to detect a mobile device."
export const isMobile = navigator.userAgent.includes("Mobi");
export const isPluginDev = (id: string) => Object.hasOwn(DevsById, id);
export const isPluginDev = (id?: string | null) => id != null && Object.hasOwn(DevsById, id);
export function pluralise(amount: number, singular: string, plural = singular + "s") {
return amount === 1 ? `${amount} ${singular}` : `${amount} ${plural}`;

View file

@ -18,7 +18,7 @@
import type { GuildMember, GuildRecord, UserRecord } from "@vencord/discord-types";
import type { ReactNode } from "react";
import { LiteralUnion } from "type-fest";
import type { LiteralUnion } from "type-fest";
export type MarkupUtils = Record<
| "parse"
@ -167,8 +167,12 @@ export interface BrowserWindowFeatures {
backgroundColor?: string;
}
export interface PopoutActions {
open(key: string, render: (windowKey: string) => ReactNode, features?: BrowserWindowFeatures);
close(key: string): void;
setAlwaysOnTop(key: string, alwaysOnTop: boolean): void;
export interface PopoutWindowActionCreators {
close: (key: string) => Promise<void>;
open: (
key: string,
render: (windowKey: string) => ReactNode,
features?: BrowserWindowFeatures
) => Promise<void>;
setAlwaysOnTop: (key: string, alwaysOnTop: boolean) => Promise<void>;
}