Added Theme Playlists

This commit is contained in:
Sean Edmunds
2025-03-13 17:01:20 -05:00
parent 0ba63f57c4
commit 7edbbb6a76
7 changed files with 676 additions and 6 deletions

View File

@@ -22,6 +22,12 @@ export function useCommonHooks() {
key: 'theme',
defaultValue: 'blackboard',
});
const [currentThemePlaylist, setCurrentThemePlaylist] = useLocalStorage<any>({
key: 'themePlaylist',
defaultValue: 'All',
});
const [searchValue, setSearchValue] = useState('');
const [providerLabel, setProviderLabel] = useState('Google Search');
const [providerURL, setProviderURL] = useState('https://www.google.com/search?q=');
@@ -52,6 +58,10 @@ export function useCommonHooks() {
if (enabled.length === 0) {
setTheme(themes[0]);
save && setThemeName(themes[0].name);
} else if (currentThemePlaylist !== 'All') {
const index = Math.floor(Math.random() * themes.length);
setTheme(themes[index]);
save && setThemeName(themes[index].name);
} else {
const index = Math.floor(Math.random() * enabled.length);
setTheme(enabled[index]);
@@ -72,6 +82,8 @@ export function useCommonHooks() {
setBookmarkFilter,
currentTheme,
setCurrentTheme,
currentThemePlaylist,
setCurrentThemePlaylist,
searchValue,
setSearchValue,
providerLabel,