Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Display Names for Settings #3212

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function SettingBooleanComponent({ option, pluginSettings, definedSetting
hideBorder
style={{ marginBottom: "0.5em" }}
>
{wordsToTitle(wordsFromCamel(id))}
<Forms.FormTitle>{option.displayName ?? wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
</Switch>
{error && <Forms.FormText style={{ color: "var(--text-danger)" }}>{error}</Forms.FormText>}
</Forms.FormSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function SettingNumericComponent({ option, pluginSettings, definedSetting

return (
<Forms.FormSection>
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormTitle>{option.displayName ?? wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
<TextInput
type="number"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function SettingSelectComponent({ option, pluginSettings, definedSettings

return (
<Forms.FormSection>
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormTitle>{option.displayName ?? wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormText className={Margins.bottom16} type="description">{option.description}</Forms.FormText>
<Select
isDisabled={option.disabled?.call(definedSettings) ?? false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function SettingSliderComponent({ option, pluginSettings, definedSettings

return (
<Forms.FormSection>
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormTitle>{option.displayName ?? wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
<Slider
disabled={option.disabled?.call(definedSettings) ?? false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function SettingTextComponent({ option, pluginSettings, definedSettings,

return (
<Forms.FormSection>
<Forms.FormTitle>{wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormTitle>{option.displayName ?? wordsToTitle(wordsFromCamel(id))}</Forms.FormTitle>
<Forms.FormText className={Margins.bottom20} type="description">{option.description}</Forms.FormText>
<TextInput
type="text"
Expand Down
15 changes: 10 additions & 5 deletions src/plugins/customRPC/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ const enum TimestampMode {
const settings = definePluginSettings({
appID: {
type: OptionType.STRING,
description: "Application ID (required)",
displayName: "Application ID (required)",
description: "Application ID from the Discord Developer Portal",
onChange: onChange,
isValid: (value: string) => {
if (!value) return "Application ID is required.";
Expand Down Expand Up @@ -230,7 +231,8 @@ const settings = definePluginSettings({
},
buttonOneText: {
type: OptionType.STRING,
description: "Button 1 text",
displayName: "Button 1 Text",
description: "The text to display on button 1",
onChange: onChange,
isValid: (value: string) => {
if (value && value.length > 31) return "Button 1 text must be not longer than 31 characters.";
Expand All @@ -239,12 +241,14 @@ const settings = definePluginSettings({
},
buttonOneURL: {
type: OptionType.STRING,
description: "Button 1 URL",
displayName: "Button 1 URL",
description: "The URL to open when clicking button 1",
onChange: onChange
},
buttonTwoText: {
type: OptionType.STRING,
description: "Button 2 text",
displayName: "Button 2 Text",
description: "The text to display on button 2",
onChange: onChange,
isValid: (value: string) => {
if (value && value.length > 31) return "Button 2 text must be not longer than 31 characters.";
Expand All @@ -253,7 +257,8 @@ const settings = definePluginSettings({
},
buttonTwoURL: {
type: OptionType.STRING,
description: "Button 2 URL",
displayName: "Button 2 URL",
description: "The URL to open when clicking button 2",
onChange: onChange
}
});
Expand Down
1 change: 1 addition & 0 deletions src/plugins/ircColors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const settings = definePluginSettings({
default: false
},
applyColorOnlyInDms: {
displayName: "Apply Color Only In DMs",
description: "Apply colors only in direct messages; do not apply colors in servers.",
restartNeeded: false,
type: OptionType.BOOLEAN,
Expand Down
18 changes: 10 additions & 8 deletions src/plugins/lastfm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,25 +102,26 @@ function setActivity(activity: Activity | null) {

const settings = definePluginSettings({
username: {
description: "last.fm username",
description: "Last.fm username",
type: OptionType.STRING,
},
apiKey: {
description: "last.fm api key",
displayName: "API Key",
description: "Last.fm api key",
type: OptionType.STRING,
},
shareUsername: {
description: "show link to last.fm profile",
description: "Show link to last.fm profile",
type: OptionType.BOOLEAN,
default: false,
},
shareSong: {
description: "show link to song on last.fm",
description: "Show link to song on last.fm",
type: OptionType.BOOLEAN,
default: true,
},
hideWithSpotify: {
description: "hide last.fm presence if spotify is running",
description: "Hide last.fm presence if spotify is running",
type: OptionType.BOOLEAN,
default: true,
},
Expand All @@ -130,7 +131,7 @@ const settings = definePluginSettings({
default: false,
},
statusName: {
description: "custom status text",
description: "Custom status text",
type: OptionType.STRING,
default: "some music",
},
Expand Down Expand Up @@ -166,7 +167,7 @@ const settings = definePluginSettings({
],
},
useListeningStatus: {
description: 'show "Listening to" status instead of "Playing"',
description: 'Show "Listening to" status instead of "Playing"',
type: OptionType.BOOLEAN,
default: false,
},
Expand All @@ -186,7 +187,8 @@ const settings = definePluginSettings({
],
},
showLastFmLogo: {
description: "show the Last.fm logo by the album cover",
displayName: "Show Last.fm Logo",
description: "Show the Last.fm logo by the album cover",
type: OptionType.BOOLEAN,
default: true,
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/mentionAvatars/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { User } from "discord-types/general";
const settings = definePluginSettings({
showAtSymbol: {
type: OptionType.BOOLEAN,
displayName: "Show @ Symbol",
description: "Whether the the @ symbol should be displayed on user mentions",
default: true
}
Expand Down
1 change: 1 addition & 0 deletions src/plugins/messageLinkEmbeds/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ const settings = definePluginSettings({
]
},
idList: {
displayName: "ID List",
description: "Guild/channel/user IDs to blacklist or whitelist (separate with comma)",
type: OptionType.STRING,
default: ""
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/openInApp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type { MouseEvent } from "react";
interface URLReplacementRule {
match: RegExp;
replace: (...matches: string[]) => string;
displayName?: string;
description: string;
shortlinkMatch?: RegExp;
accountViewReplace?: (userId: string) => string;
Expand Down Expand Up @@ -59,6 +60,7 @@ const UrlReplacementRules: Record<string, URLReplacementRule> = {
itunes: {
match: /^https:\/\/(?:geo\.)?music\.apple\.com\/([a-z]{2}\/)?(album|artist|playlist|song|curator)\/([^/?#]+)\/?([^/?#]+)?(?:\?.*)?(?:#.*)?$/,
replace: (_, lang, type, name, id) => id ? `itunes://music.apple.com/us/${type}/${name}/${id}` : `itunes://music.apple.com/us/${type}/${name}`,
displayName: "iTunes",
description: "Open Apple Music links in the iTunes app"
},
};
Expand All @@ -67,6 +69,7 @@ const pluginSettings = definePluginSettings(
Object.entries(UrlReplacementRules).reduce((acc, [key, rule]) => {
acc[key] = {
type: OptionType.BOOLEAN,
displayName: rule.displayName,
description: rule.description,
default: true,
};
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/pinDms/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,13 @@ export const settings = definePluginSettings({
},
canCollapseDmSection: {
type: OptionType.BOOLEAN,
displayName: "Can Collapse DM Section",
description: "Allow uncategorised DMs section to be collapsable",
default: false
},
dmSectionCollapsed: {
type: OptionType.BOOLEAN,
displayName: "DM Section Collapsed",
description: "Collapse DM section",
default: false,
hidden: true
Expand Down
1 change: 1 addition & 0 deletions src/plugins/replaceGoogleSearch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const settings = definePluginSettings({
placeholder: "Google"
},
customEngineURL: {
displayName: "Custom Engine URL",
description: "The URL of your Engine",
type: OptionType.STRING,
placeholder: "https://google.com/search?q="
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/serverListIndicators/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default definePlugin({

options: {
mode: {
description: "mode",
description: "Mode",
type: OptionType.SELECT,
options: [
{ label: "Only online friend count", value: IndicatorType.FRIEND, default: true },
Expand Down
1 change: 1 addition & 0 deletions src/plugins/shikiCodeblocks.desktop/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const settings = definePluginSettings({
},
tryHljs: {
type: OptionType.SELECT,
displayName: "Try Highlight.js",
description: "Use the more lightweight default Discord highlighter and theme.",
options: [
{
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/silentTyping/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default definePlugin({
options: [
{
name: "value",
description: "whether to hide or not that you're typing (default is toggle)",
description: "Whether to hide or not that you're typing (default is toggle)",
required: false,
type: ApplicationCommandOptionType.BOOLEAN,
},
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/translate/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,10 @@ export const settings = definePluginSettings({
},
deeplApiKey: {
type: OptionType.STRING,
description: "DeepL API key",
displayName: "DeepL API Key",
description: "Your API key from https://www.deepl.com/en/your-account/keys",
default: "",
placeholder: "Get your API key from https://deepl.com/your-account",
placeholder: "API Key",
disabled: () => IS_WEB
},
autoTranslate: {
Expand Down
1 change: 1 addition & 0 deletions src/plugins/viewIcons/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const settings = definePluginSettings({
},
imgSize: {
type: OptionType.SELECT,
displayName: "Image Size",
description: "The image size to use",
options: ["128", "256", "512", "1024", "2048", "4096"].map(n => ({ label: n, value: n, default: n === "1024" }))
}
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/xsOverlay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ const settings = definePluginSettings({
},
preferUDP: {
type: OptionType.BOOLEAN,
displayName: "Prefer UDP",
description: "Enable if you use an older build of XSOverlay unable to connect through websockets. This setting is ignored on web.",
default: false,
disabled: () => IS_WEB
Expand All @@ -120,11 +121,13 @@ const settings = definePluginSettings({
},
dmNotifications: {
type: OptionType.BOOLEAN,
displayName: "DM Notifications",
description: "Allow Direct Message notifications",
default: true
},
groupDmNotifications: {
type: OptionType.BOOLEAN,
displayName: "Group DM Notifications",
description: "Allow Group DM notifications",
default: true
},
Expand Down
1 change: 1 addition & 0 deletions src/utils/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export type PluginSettingDef =

export interface PluginSettingCommon {
description: string;
displayName?: string;
placeholder?: string;
onChange?(newValue: any): void;
/**
Expand Down