-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Implement Theme Song Volume Control #6674
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,3 +21,7 @@ config.json | |
|
||
# environment related | ||
.envrc | ||
|
||
# other | ||
repomix.config.json | ||
repomix-output.txt |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ export interface DisplaySettingsValues { | |
enableItemDetailsBanner: boolean; | ||
enableLibraryBackdrops: boolean; | ||
enableLibraryThemeSongs: boolean; | ||
libraryThemeSongsVolumeLevel: number; | ||
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. I think it was supposed to be in alphabetical order. |
||
enableLibraryThemeVideos: boolean; | ||
enableRewatchingInNextUp: boolean; | ||
episodeImagesInNextUp: boolean; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,19 @@ export default function UserDisplayPreferences() { | |
} | ||
}, [updateField, values]); | ||
|
||
const handleSliderChange = useCallback(() => (e: Event, newValue: number | number[]) => { | ||
const target = e.target as HTMLInputElement; | ||
const fieldName = target.name as keyof DisplaySettingsValues; | ||
const value = Array.isArray(newValue) ? newValue[0] : newValue; | ||
|
||
if (values?.[fieldName] !== value) { | ||
updateField({ | ||
name: fieldName, | ||
value: value.toString() | ||
}); | ||
} | ||
}, [updateField, values]); | ||
|
||
Comment on lines
+43
to
+55
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. Isn't |
||
if (loading || !values) { | ||
return <LoadingComponent />; | ||
} | ||
|
@@ -66,6 +79,7 @@ export default function UserDisplayPreferences() { | |
/> | ||
<LibraryPreferences | ||
onChange={handleFieldChange} | ||
onSliderChange={handleSliderChange} | ||
values={values} | ||
/> | ||
<NextUpPreferences | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -230,6 +230,19 @@ export class UserSettings { | |||||
return toBoolean(this.get('enableThemeSongs', false), false); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Get or set 'Theme Songs' volume level. | ||||||
* @param {number|undefined} [val] - Volume level to set. | ||||||
* @return {number} Current volume level. | ||||||
*/ | ||||||
themeSongsVolumeLevel(val) { | ||||||
if (val !== undefined) { | ||||||
return this.set('themeSongsVolumeLevel', val.toString()); | ||||||
} | ||||||
|
||||||
return parseInt(this.get('themeSongsVolumeLevel') || '100', 10); | ||||||
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. IMO, it would be better to make the default volume lower.
Suggested change
|
||||||
} | ||||||
|
||||||
/** | ||||||
* Get or set 'Theme Videos' state. | ||||||
* @param {boolean|undefined} [val] - Flag to enable 'Theme Videos' or undefined. | ||||||
|
@@ -676,6 +689,7 @@ export const selectAudioNormalization = currentSettings.selectAudioNormalization | |||||
export const enableNextVideoInfoOverlay = currentSettings.enableNextVideoInfoOverlay.bind(currentSettings); | ||||||
export const enableVideoRemainingTime = currentSettings.enableVideoRemainingTime.bind(currentSettings); | ||||||
export const enableThemeSongs = currentSettings.enableThemeSongs.bind(currentSettings); | ||||||
export const themeSongsVolumeLevel = currentSettings.themeSongsVolumeLevel.bind(currentSettings); | ||||||
export const enableThemeVideos = currentSettings.enableThemeVideos.bind(currentSettings); | ||||||
export const enableFastFadein = currentSettings.enableFastFadein.bind(currentSettings); | ||||||
export const enableBlurhash = currentSettings.enableBlurhash.bind(currentSettings); | ||||||
|
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.
I think it was supposed to be in alphabetical order.