Random theme bug fix

This commit is contained in:
Sean Edmunds
2025-06-13 14:06:34 -05:00
parent 8405fc75af
commit 4a77340ba5

View File

@@ -213,6 +213,7 @@ function SettingsButton() {
<ActionIcon
className={actionIconClasses.menuActions}
classNames={actionIconClasses}
disabled={currentThemePlaylist === 'Time of Day'}
style={{
backgroundColor:
currentTheme === 'random'
@@ -246,16 +247,36 @@ function SettingsButton() {
backgroundColor: 'transparent',
color: 'var(--mantine-color-primary-0)',
}}
disabled={currentThemePlaylist === 'Time of Day'}
onClick={() => {
const themeList = JSON.parse(
themePlaylistData?.find(
(t: ThemePlaylist) => t?.name === currentThemePlaylist,
)?.themeList ?? '[]',
);
const filteredThemes = allThemes.filter((t: Theme) =>
themeList.includes(t.id),
);
handleThemeChange(filteredThemes, false);
if (themeList.length > 0) {
const filteredThemes = allThemes.filter((t: Theme) =>
themeList.includes(t.id),
);
handleThemeChange(filteredThemes, false);
} else if (currentThemePlaylist === 'All') {
handleThemeChange(allThemes, false);
} else if (currentThemePlaylist === 'Backgrounds') {
handleThemeChange(
allThemes.filter(
(a: any) =>
!a.backgroundImage.toLowerCase().includes('none'),
),
false,
);
} else if (currentThemePlaylist === 'No Backgrounds') {
handleThemeChange(
allThemes.filter((a: any) =>
a.backgroundImage.toLowerCase().includes('none'),
),
false,
);
}
}}
>
<FaDice />