Skip to content

Commit 0635199

Browse files
authored
Merge branch 'main' into presets
2 parents dba5ce0 + 9152c69 commit 0635199

File tree

11 files changed

+37
-41
lines changed

11 files changed

+37
-41
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"adm-zip": "^0.5.16",
5858
"chalk": "^5.6.2",
5959
"codemirror": "^6.0.2",
60-
"discord-client-types": "^0.0.11",
60+
"discord-client-types": "^0.0.12",
6161
"esbuild": "^0.27.0",
6262
"esbuild-sass-plugin": "^3.3.1",
6363
"prompts": "^2.4.2",

pnpm-lock.yaml

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renderer/coremods/installer/AddonEmbed.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ div[class] .addon-embed-copied:hover {
1717
max-width: 210px;
1818
}
1919

20-
.replugged-addon-embed-button-tooltip {
21-
display: flex;
22-
flex: 1;
23-
}
24-
2520
.replugged-addon-embed-button {
2621
flex: 1;
2722
}

src/renderer/coremods/installer/AddonEmbed.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const Embed = React.memo(
151151
<div className={barLoader} />
152152
) : (
153153
<>
154-
<Tooltip text={props.authors} className="replugged-addon-embed-title-tooltip">
154+
<Tooltip text={props.authors}>
155155
<strong className={classNames(title, "replugged-addon-embed-title")}>
156156
{props.authors}
157157
</strong>
@@ -210,7 +210,6 @@ const Embed = React.memo(
210210
text={intl.formatToPlainString(t.REPLUGGED_ERROR_ALREADY_INSTALLED, {
211211
name: props.name,
212212
})}
213-
className="replugged-addon-embed-button-tooltip"
214213
shouldShow={props.isInstalled ? undefined : false}
215214
hideOnClick={false}>
216215
<Button

src/renderer/coremods/installer/util.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
import { marginStyles, modal } from "@common";
22
import { t as discordT, intl } from "@common/i18n";
33
import { ToastType, toast } from "@common/toast";
4-
import { Button, Notice } from "@components";
4+
import { Notice } from "@components";
55
import { Logger } from "@replugged";
66
import { generalSettings } from "src/renderer/managers/settings";
77
import { setUpdaterState } from "src/renderer/managers/updater";
88
import { t } from "src/renderer/modules/i18n";
9-
import { openExternal } from "src/renderer/util";
109
import type { AnyAddonManifest, CheckResultSuccess } from "src/types";
1110
import * as pluginManager from "../../managers/plugins";
1211
import * as themeManager from "../../managers/themes";
13-
import { getAddonType, getSourceLink, label } from "../settings/pages";
12+
import { getAddonType, label } from "../settings/pages";
1413

1514
const logger = Logger.coremod("Installer");
1615

@@ -226,7 +225,7 @@ export function authorList(authors: string[]): string {
226225
async function showInstallPrompt(
227226
manifest: AnyAddonManifest,
228227
source: InstallerSource | undefined,
229-
linkToStore = true,
228+
_linkToStore = true,
230229
): Promise<boolean | null> {
231230
let type: string;
232231
switch (manifest.type) {
@@ -245,7 +244,9 @@ async function showInstallPrompt(
245244
authors,
246245
});
247246

248-
const storeUrl = linkToStore ? getSourceLink(manifest) : undefined;
247+
// TODO: Fix this! Mana ConfirmModals do not support secondary confirm buttons
248+
249+
// const storeUrl = linkToStore ? getSourceLink(manifest) : undefined;
249250

250251
const res = await modal.confirm({
251252
title,
@@ -263,8 +264,8 @@ async function showInstallPrompt(
263264
),
264265
confirmText: intl.string(discordT.CONFIRM),
265266
cancelText: intl.string(discordT.CANCEL),
266-
secondaryConfirmText: storeUrl ? intl.string(t.REPLUGGED_INSTALLER_OPEN_STORE) : undefined,
267-
onConfirmSecondary: () => (storeUrl ? openExternal(storeUrl) : undefined),
267+
// secondaryConfirmText: storeUrl ? intl.string(t.REPLUGGED_INSTALLER_OPEN_STORE) : undefined,
268+
// onConfirmSecondary: () => (storeUrl ? openExternal(storeUrl) : undefined),
268269
});
269270

270271
return res;
@@ -357,7 +358,6 @@ export async function installFlow(
357358
}),
358359
confirmText: intl.string(discordT.ERRORS_RELOAD),
359360
cancelText: intl.string(discordT.CANCEL),
360-
confirmColor: Button.Colors.RED,
361361
})
362362
.then((answer) => {
363363
if (answer) {

src/renderer/coremods/settings/pages/Addons.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ function getSettingsElement(id: string, type: AddonType): React.ComponentType |
144144
if (type === AddonType.Theme) {
145145
if (themes.getDisabled().includes(id)) return undefined;
146146

147-
const theme = themes.themes.get(id)!;
147+
const theme = themes.themes.get(id);
148148

149-
if (theme.manifest.presets?.length) {
149+
if (theme?.manifest.presets?.length) {
150150
return () => <ThemePresetSettings id={id} />;
151151
}
152152
return undefined;
@@ -470,7 +470,6 @@ function Cards({
470470
body: intl.format(t.REPLUGGED_ADDON_UNINSTALL_PROMPT_BODY, { type: label(type) }),
471471
confirmText: intl.string(discordT.APPLICATION_UNINSTALL_PROMPT_CONFIRM),
472472
cancelText: intl.string(discordT.CANCEL),
473-
confirmColor: Button.Colors.RED,
474473
});
475474
if (!confirmation) return;
476475

src/renderer/coremods/settings/pages/General.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { React, modal } from "@common";
22
import { t as discordT, intl } from "@common/i18n";
33
import { ToastType, toast } from "@common/toast";
44
import {
5-
Button,
65
Divider,
76
FieldSet,
87
Notice,
@@ -53,7 +52,6 @@ function restartModal(doRelaunch = false, onConfirm?: () => void, onCancel?: ()
5352
? intl.string(discordT.BUNDLE_READY_RESTART)
5453
: intl.string(discordT.ERRORS_RELOAD),
5554
cancelText: intl.string(discordT.CANCEL),
56-
confirmColor: Button.Colors.RED,
5755
onConfirm,
5856
onCancel,
5957
})

src/renderer/modules/common/components.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { waitForProps } from "@webpack";
22

3+
import type { VoidConfirmModal } from "discord-client-types/discord_app/design/void/components/VoidConfirmModal/VoidConfirmModal";
34
import type * as Design from "discord-client-types/discord_app/design/web";
45

56
export type DiscordComponents = {
@@ -12,7 +13,7 @@ export type DiscordComponents = {
1213
Text: Design.Text;
1314
ToastPosition: typeof Design.ToastPosition;
1415
ToastType: typeof Design.ToastType;
15-
VoidConfirmModal: Design.ConfirmModal;
16+
VoidConfirmModal: VoidConfirmModal;
1617
createToast: Design.CreateToast;
1718
popToast: Design.PopToast;
1819
showToast: Design.ShowToast;

src/renderer/modules/components/Select.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,32 @@
11
import { filters, getFunctionBySource, waitForModule } from "@webpack";
22
import type React from "react";
33

4-
import type * as Design from "discord-client-types/discord_app/design/web";
4+
import type {
5+
VoidSelectOption,
6+
VoidSingleSelect,
7+
VoidSingleSelectProps,
8+
} from "discord-client-types/discord_app/design/components/VoidSelect/web/VoidSelect";
59

610
const selectSource = '"renderLeading","renderTrailing","value","onChange"';
711
const mod = await waitForModule(filters.bySource(selectSource));
8-
const SingleSelect = getFunctionBySource<Design.SingleSelect>(mod, selectSource)!;
12+
const SingleSelect = getFunctionBySource<VoidSingleSelect>(mod, selectSource)!;
913

1014
interface CustomSingleSelectProps<
11-
TOptions extends readonly Design.SelectOption[] = readonly Design.SelectOption[],
15+
TOptions extends readonly VoidSelectOption[] = readonly VoidSelectOption[],
1216
TClearable extends boolean = false,
13-
> extends Design.SingleSelectProps<TOptions, TClearable> {
17+
> extends VoidSingleSelectProps<TOptions, TClearable> {
1418
disabled?: boolean;
1519
}
1620

1721
export type CustomSingleSelectType = <
18-
TOptions extends readonly Design.SelectOption[] = readonly Design.SelectOption[],
22+
TOptions extends readonly VoidSelectOption[] = readonly VoidSelectOption[],
1923
TClearable extends boolean = false,
2024
>(
2125
props: React.PropsWithChildren<CustomSingleSelectProps<TOptions, TClearable>>,
2226
) => React.ReactElement;
2327

2428
function CustomSingleSelect<
25-
TOptions extends readonly Design.SelectOption[] = readonly Design.SelectOption[],
29+
TOptions extends readonly VoidSelectOption[] = readonly VoidSelectOption[],
2630
TClearable extends boolean = false,
2731
>({ disabled, ...props }: CustomSingleSelectProps<TOptions, TClearable>): React.ReactElement {
2832
return <SingleSelect isDisabled={disabled} {...props} />;
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { getFunctionBySource } from "@webpack";
2-
import components from "../common/components";
1+
import { filters, getFunctionBySource, waitForModule } from "@webpack";
32

4-
import type * as Design from "discord-client-types/discord_app/design/web";
3+
import type { Tooltip } from "discord-client-types/discord_app/design/mana/components/Tooltip/Tooltip";
54

6-
export default getFunctionBySource<Design.VoidTooltipContainer>(
7-
components,
8-
/className:\i,element:\i="div"/,
9-
)!;
5+
const tooltipString = ".tooltipWithShortcut,";
6+
const mod = await waitForModule(filters.bySource(tooltipString));
7+
8+
export default getFunctionBySource<Tooltip>(mod, tooltipString)!;

0 commit comments

Comments
 (0)