Merge branch 'dev'
This commit is contained in:
commit
b3d8369933
8 changed files with 66 additions and 25 deletions
2
.vscode/extensions.json
vendored
2
.vscode/extensions.json
vendored
|
|
@ -4,6 +4,6 @@
|
|||
"EditorConfig.EditorConfig",
|
||||
"GregorBiswanger.json2ts",
|
||||
"stylelint.vscode-stylelint",
|
||||
"thororen.equicord-companion"
|
||||
"sadan.vencord-user-companion"
|
||||
]
|
||||
}
|
||||
|
|
@ -30,6 +30,7 @@
|
|||
"generateTypes": "tspc --emitDeclarationOnly --declaration --outDir packages/vencord-types --allowJs false",
|
||||
"inject": "node scripts/runInstaller.mjs -- --install",
|
||||
"uninject": "node scripts/runInstaller.mjs -- --uninstall",
|
||||
"repair": "node scripts/runInstaller.mjs -- --repair",
|
||||
"lint": "eslint",
|
||||
"lint-styles": "stylelint \"src/**/*.css\" --ignore-pattern src/userplugins",
|
||||
"lint:fix": "pnpm lint --fix",
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ interface Props {
|
|||
setEnabled: (enabled: boolean) => void;
|
||||
disabled?: boolean;
|
||||
isNew?: boolean;
|
||||
sourceBadge?: ReactNode;
|
||||
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
||||
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
||||
|
||||
|
|
@ -43,7 +44,7 @@ interface Props {
|
|||
author?: ReactNode;
|
||||
}
|
||||
|
||||
export function AddonCard({ disabled, isNew, name, infoButton, footer, author, enabled, setEnabled, description, onMouseEnter, onMouseLeave }: Props) {
|
||||
export function AddonCard({ disabled, isNew, sourceBadge, name, infoButton, footer, author, enabled, setEnabled, description, onMouseEnter, onMouseLeave }: Props) {
|
||||
const titleRef = useRef<HTMLDivElement>(null);
|
||||
const titleContainerRef = useRef<HTMLDivElement>(null);
|
||||
const { truncated, containerRef } = useTruncatedText(description ? description.toString() : "");
|
||||
|
|
@ -72,6 +73,7 @@ export function AddonCard({ disabled, isNew, name, infoButton, footer, author, e
|
|||
{name}
|
||||
</div>
|
||||
</div>
|
||||
{sourceBadge}
|
||||
{isNew && <AddonBadge text="NEW" color="#ED4245" />}
|
||||
</Text>
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ import { findByPropsLazy } from "@webpack";
|
|||
import { React, showToast, Toasts } from "@webpack/common";
|
||||
import { Settings } from "Vencord";
|
||||
|
||||
import { PluginMeta } from "~plugins";
|
||||
|
||||
import { openPluginModal } from "./PluginModal";
|
||||
|
||||
const logger = new Logger("PluginCard");
|
||||
|
|
@ -35,6 +37,8 @@ interface PluginCardProps extends React.HTMLProps<HTMLDivElement> {
|
|||
|
||||
export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, onMouseLeave, isNew }: PluginCardProps) {
|
||||
const settings = Settings.plugins[plugin.name];
|
||||
const pluginMeta = PluginMeta[plugin.name];
|
||||
const isEquicordPlugin = pluginMeta?.folderName?.startsWith("src/equicordplugins/") ?? false;
|
||||
|
||||
const isEnabled = () => isPluginEnabled(plugin.name);
|
||||
|
||||
|
|
@ -88,9 +92,36 @@ export function PluginCard({ plugin, disabled, onRestartNeeded, onMouseEnter, on
|
|||
settings.enabled = !wasEnabled;
|
||||
}
|
||||
|
||||
const sourceBadge = isEquicordPlugin ? (
|
||||
<img
|
||||
src="https://equicord.org/assets/favicon.png"
|
||||
alt="Equicord"
|
||||
title="Equicord Plugin"
|
||||
style={{
|
||||
width: "20px",
|
||||
height: "20px",
|
||||
marginLeft: "8px",
|
||||
borderRadius: "2px"
|
||||
}}
|
||||
/>
|
||||
) : (
|
||||
<img
|
||||
src="https://vencord.dev/assets/favicon-dark.png"
|
||||
alt="Vencord"
|
||||
title="Vencord Plugin"
|
||||
style={{
|
||||
width: "20px",
|
||||
height: "20px",
|
||||
marginLeft: "8px",
|
||||
borderRadius: "2px"
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<AddonCard
|
||||
name={plugin.name}
|
||||
sourceBadge={sourceBadge}
|
||||
description={plugin.description}
|
||||
isNew={isNew}
|
||||
enabled={isEnabled()}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,9 @@ const enum SearchStatus {
|
|||
ALL,
|
||||
ENABLED,
|
||||
DISABLED,
|
||||
NEW
|
||||
NEW,
|
||||
EQUICORD,
|
||||
VENCORD
|
||||
}
|
||||
|
||||
function ExcludedPluginsList({ search }: { search: string; }) {
|
||||
|
|
@ -187,9 +189,14 @@ export default function PluginSettings() {
|
|||
const pluginFilter = (plugin: typeof Plugins[keyof typeof Plugins]) => {
|
||||
const { status } = searchValue;
|
||||
const enabled = Vencord.Plugins.isPluginEnabled(plugin.name);
|
||||
const pluginMeta = PluginMeta[plugin.name];
|
||||
const isEquicordPlugin = pluginMeta?.folderName?.startsWith("src/equicordplugins/") ?? false;
|
||||
|
||||
if (enabled && status === SearchStatus.DISABLED) return false;
|
||||
if (!enabled && status === SearchStatus.ENABLED) return false;
|
||||
if (status === SearchStatus.NEW && !newPlugins?.includes(plugin.name)) return false;
|
||||
if (status === SearchStatus.EQUICORD && !isEquicordPlugin) return false;
|
||||
if (status === SearchStatus.VENCORD && isEquicordPlugin) return false;
|
||||
if (!search.length) return true;
|
||||
|
||||
return (
|
||||
|
|
@ -362,7 +369,9 @@ export default function PluginSettings() {
|
|||
{ label: "Show All", value: SearchStatus.ALL, default: true },
|
||||
{ label: "Show Enabled", value: SearchStatus.ENABLED },
|
||||
{ label: "Show Disabled", value: SearchStatus.DISABLED },
|
||||
{ label: "Show New", value: SearchStatus.NEW }
|
||||
{ label: "Show New", value: SearchStatus.NEW },
|
||||
{ label: "Show Equicord", value: SearchStatus.EQUICORD },
|
||||
{ label: "Show Vencord", value: SearchStatus.VENCORD }
|
||||
]}
|
||||
serialize={String}
|
||||
select={onStatusChange}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
import "@equicordplugins/_misc/styles.css";
|
||||
|
||||
import { definePluginSettings, Settings } from "@api/Settings";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs, EquicordDevs } from "@utils/constants";
|
||||
import { Logger } from "@utils/Logger";
|
||||
import { isEquicordGuild, isEquicordSupport } from "@utils/misc";
|
||||
|
|
@ -69,11 +69,6 @@ export default definePlugin({
|
|||
predicate: () => settings.store.disableDMContextMenu
|
||||
},
|
||||
],
|
||||
start() {
|
||||
if (Settings.plugins?.PinDMs?.disableCreateDMButton) {
|
||||
settings.store.disableCreateDMButton = true;
|
||||
}
|
||||
},
|
||||
renderMessageAccessory(props) {
|
||||
return pluginToggleButtons(props);
|
||||
}
|
||||
|
|
|
|||
3
src/equicordplugins/statusPresets/fixActionBar.css
Normal file
3
src/equicordplugins/statusPresets/fixActionBar.css
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
[class*="outerContainer_"] [class*="container_"] [class*="actionBar_"] {
|
||||
gap: 0;
|
||||
}
|
||||
|
|
@ -28,8 +28,9 @@ import { openModalLazy } from "@utils/modal";
|
|||
import { useForceUpdater } from "@utils/react";
|
||||
import definePlugin, { OptionType, StartAt } from "@utils/types";
|
||||
import { extractAndLoadChunksLazy, findByPropsLazy, findComponentByCodeLazy, findModuleId, wreq } from "@webpack";
|
||||
import { Button, Clickable, Menu, Toasts, UserStore, useState } from "@webpack/common";
|
||||
import { Clickable, Menu, Toasts, UserStore, useState } from "@webpack/common";
|
||||
|
||||
import managedStyle from "./fixActionBar.css?managed";
|
||||
|
||||
const settings = definePluginSettings({
|
||||
StatusPresets: {
|
||||
|
|
@ -62,7 +63,7 @@ const EmojiComponent = findComponentByCodeLazy(/\.translateSurrogatesToInlineEmo
|
|||
|
||||
const CustomStatusSettings = getUserSettingLazy("status", "customStatus")!;
|
||||
const StatusModule = proxyLazy(() => {
|
||||
const id = findModuleId("this.renderCustomStatusInput()");
|
||||
const id = findModuleId(".customStatusInputTitle,");
|
||||
return wreq(Number(id));
|
||||
});
|
||||
|
||||
|
|
@ -150,12 +151,13 @@ export default definePlugin({
|
|||
authors: [EquicordDevs.iamme],
|
||||
settings: settings,
|
||||
dependencies: ["UserSettingsAPI"],
|
||||
managedStyle,
|
||||
patches: [
|
||||
{
|
||||
find: "#{intl::CUSTOM_STATUS_SET_CUSTOM_STATUS}",
|
||||
find: '"CustomStatusModalWithPreview"',
|
||||
replacement: {
|
||||
match: /cancelButton,(children|text):\i\.\i\.string\(\i\.\i#{intl::CANCEL}\)\}\)/,
|
||||
replace: "$&,$self.renderRememberButton(this.state)"
|
||||
match: /(?<=(\i)\.state\).*?)\{text:\i\.\i\.\i\(\i\.\i\.R3BPHx\)/,
|
||||
replace: "$self.renderRememberButton($1),$&"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -205,21 +207,19 @@ export default definePlugin({
|
|||
</ErrorBoundary>
|
||||
);
|
||||
},
|
||||
renderRememberButton(statue: DiscordStatus) {
|
||||
return <Button
|
||||
look={Button.Looks.LINK}
|
||||
color={Button.Colors.WHITE}
|
||||
size={Button.Sizes.MEDIUM}
|
||||
onClick={e => {
|
||||
settings.store.StatusPresets[statue.text] = statue;
|
||||
renderRememberButton(status: DiscordStatus) {
|
||||
return {
|
||||
text: "Keep",
|
||||
style: { marginLeft: "20px" },
|
||||
onClick: () => {
|
||||
settings.store.StatusPresets[status.text] = status;
|
||||
Toasts.show({
|
||||
message: "Successfully Saved Status",
|
||||
type: Toasts.Type.SUCCESS,
|
||||
id: Toasts.genId()
|
||||
});
|
||||
}}
|
||||
style={{ marginRight: "20px" }}
|
||||
>Remember</Button>;
|
||||
}
|
||||
};
|
||||
},
|
||||
startAt: StartAt.WebpackReady
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue