-
Notifications
You must be signed in to change notification settings - Fork 21
release: version 5.1.17 #109
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
Changes from all commits
cc6f27b
d0e9fb0
c87e5e5
fa65139
218a7a4
e956e06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -50,40 +50,45 @@ export default class SettingsModule extends TwitchModule { | |||||
| title: "Channel", | ||||||
| iconUrl: await this.commonUtils().getAssetFile(this.workerService(), "settings/channel.svg"), | ||||||
| }, | ||||||
| { | ||||||
| title: "Experimental", | ||||||
| iconUrl: await this.commonUtils().getAssetFile(this.workerService(), "settings/experimental.svg"), | ||||||
| }, | ||||||
| { | ||||||
| title: "About", | ||||||
| iconUrl: await this.commonUtils().getAssetFile(this.workerService(), "settings/about.svg"), | ||||||
| }, | ||||||
| ]; | ||||||
| ] as const; | ||||||
| const tabIndexes = Object.fromEntries(this.SETTINGS_TABS.map((tab, index) => [tab.title, index])); | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To improve type safety and leverage the
Suggested change
|
||||||
| const brandIcons = { | ||||||
| website: await this.commonUtils().getAssetFile(this.workerService(), "brands/website.svg"), | ||||||
| github: await this.commonUtils().getAssetFile(this.workerService(), "brands/github.svg"), | ||||||
| twitter: await this.commonUtils().getAssetFile(this.workerService(), "brands/twitter.svg"), | ||||||
| discord: await this.commonUtils().getAssetFile(this.workerService(), "brands/discord.svg"), | ||||||
| }; | ||||||
| } as const; | ||||||
| this.SETTING_DEFINITIONS = [ | ||||||
| { | ||||||
| id: "streamLatencyEnabled", | ||||||
| title: "Enable Stream Latency", | ||||||
| description: "Shows the current stream delay on top of the chat.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 0, | ||||||
| tabIndex: tabIndexes.General, | ||||||
| requiresRefreshToDisable: true, | ||||||
| }, | ||||||
| { | ||||||
| id: "realVideoTimeEnabled", | ||||||
| title: "Enable Real Video Time", | ||||||
| description: "Displays the real-world time of the VOD.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 0, | ||||||
| tabIndex: tabIndexes.General, | ||||||
| requiresRefreshToDisable: true, | ||||||
| }, | ||||||
| { | ||||||
| id: "pinnedStreamersEnabled", | ||||||
| title: "Enable Pinning Streamers", | ||||||
| description: "Allows you to pin your favorite streamers for easy access.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 0, | ||||||
| tabIndex: tabIndexes.General, | ||||||
| requiresRefreshToDisable: true, | ||||||
| }, | ||||||
| { | ||||||
|
|
@@ -92,15 +97,23 @@ export default class SettingsModule extends TwitchModule { | |||||
| description: | ||||||
| "Displays watchtime in usercards and via the /watchtime command for Polish channels by xayo.pl service.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 0, | ||||||
| tabIndex: tabIndexes.General, | ||||||
| requiresRefreshToDisable: true, | ||||||
| }, | ||||||
| { | ||||||
| id: "realVideoTimeFormat12h", | ||||||
| title: "12-Hour Time Format", | ||||||
| description: "Display real video time in 12-hour format (AM/PM) instead of 24-hour format.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 0, | ||||||
| tabIndex: tabIndexes.General, | ||||||
| }, | ||||||
| { | ||||||
| id: "channelSection", | ||||||
| title: "Channel Section", | ||||||
| description: "Shows a section with watch time and quick access links.", | ||||||
| type: "toggle", | ||||||
| tabIndex: tabIndexes.General, | ||||||
| requiresRefreshToDisable: true, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatImagesEnabled", | ||||||
|
|
@@ -110,21 +123,21 @@ export default class SettingsModule extends TwitchModule { | |||||
| confirmOnEnable: true, | ||||||
| confirmationMessage: | ||||||
| "Enhancer is not responsible for the content of images sent in the chat by users. By enabling this option, you can see images in the chat that may not look good. We do not moderate them in any way, we simply display them. Are you sure you want to enable this option?", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatImagesOnHover", | ||||||
| title: "Show Images on Hover", | ||||||
| description: "Images are hidden until you hover your mouse to reveal them.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatImagesSize", | ||||||
| title: "Chat Image Size", | ||||||
| description: "Maximum size of images allowed in chat messages (in megabytes).", | ||||||
| type: "number", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| min: 1, | ||||||
| step: 1, | ||||||
| }, | ||||||
|
|
@@ -133,44 +146,44 @@ export default class SettingsModule extends TwitchModule { | |||||
| title: "Enable Chat Badges", | ||||||
| description: "Show custom chat badges from Enhancer extension.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatNicknameCustomizationEnabled", | ||||||
| title: "Enable Nickname Customization", | ||||||
| description: "Show custom chat nickname customizations from Enhancer extension in chat.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatMessageMenuEnabled", | ||||||
| title: "Enable Chat Message Menu", | ||||||
| description: "Show a menu with message options when you right-click a chat message.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatMessageMenuUseAddInsteadOfSet", | ||||||
| title: "Appending Content via Chat Message Menu", | ||||||
| description: | ||||||
| "When using the chat message menu, new content will be added to the message in chat input instead of replacing it.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatMentionSoundEnabled", | ||||||
| title: "Enable Chat Mention Sound", | ||||||
| description: "Turn on to receive a sound notification when someone mentions you in chat.", | ||||||
| type: "toggle", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatMentionSoundSource", | ||||||
| title: "Custom Mention Sound URL", | ||||||
| description: | ||||||
| "Set a custom audio file to play when you are mentioned in chat. Leave it empty for default sound.", | ||||||
| type: "input", | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "chatMentionSoundVolume", | ||||||
|
|
@@ -180,15 +193,15 @@ export default class SettingsModule extends TwitchModule { | |||||
| min: 0, | ||||||
| max: 100, | ||||||
| step: 1, | ||||||
| tabIndex: 1, | ||||||
| tabIndex: tabIndexes.Chat, | ||||||
| }, | ||||||
| { | ||||||
| id: "quickAccessLinks", | ||||||
| title: "Quick Access Links", | ||||||
| description: | ||||||
| "Manage your quick access links. Use %username% in the URL to dynamically include the streamer's name.", | ||||||
| type: "array", | ||||||
| tabIndex: 2, | ||||||
| tabIndex: tabIndexes.Channel, | ||||||
| arrayItemFields: [ | ||||||
| { name: "title", placeholder: "Enter link name..." }, | ||||||
| { name: "url", placeholder: "Enter URL..." }, | ||||||
|
|
@@ -199,7 +212,7 @@ export default class SettingsModule extends TwitchModule { | |||||
| title: "Watchtime List", | ||||||
| description: "Watchtime List", | ||||||
| type: "text", | ||||||
| tabIndex: 2, | ||||||
| tabIndex: tabIndexes.Channel, | ||||||
| content: () => { | ||||||
| return <WatchtimeListComponent platform="twitch" workerService={workerService} />; | ||||||
| }, | ||||||
|
|
@@ -210,7 +223,7 @@ export default class SettingsModule extends TwitchModule { | |||||
| title: "About This Extension", | ||||||
| description: "Information about the extension", | ||||||
| type: "text", | ||||||
| tabIndex: 3, | ||||||
| tabIndex: tabIndexes.About, | ||||||
| content: () => { | ||||||
| return <EnhancerAboutComponent icons={brandIcons} />; | ||||||
| }, | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To improve type safety and leverage the
as constassertion onSETTINGS_TABS, you can add a type assertion totabIndexes. This will ensure that any typos when accessing tab indexes (e.g.,tabIndexes.Genral) are caught at compile time.