State fixes, Tab routing
This commit is contained in:
@@ -51,6 +51,10 @@ function App() {
|
|||||||
path={`/${import.meta.env.VITE_BASE_URL}/settings`}
|
path={`/${import.meta.env.VITE_BASE_URL}/settings`}
|
||||||
element={<Settings />}
|
element={<Settings />}
|
||||||
/>
|
/>
|
||||||
|
<Route
|
||||||
|
path={`/${import.meta.env.VITE_BASE_URL}/settings/:tabValue`}
|
||||||
|
element={<Settings />}
|
||||||
|
/>
|
||||||
</Route>
|
</Route>
|
||||||
</Route>,
|
</Route>,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ function SettingsButton() {
|
|||||||
<Select
|
<Select
|
||||||
labelProps={{ display: 'none' }}
|
labelProps={{ display: 'none' }}
|
||||||
placeholder='Pick a playlist...'
|
placeholder='Pick a playlist...'
|
||||||
defaultValue={currentThemePlaylist}
|
value={currentThemePlaylist}
|
||||||
data={
|
data={
|
||||||
themePlaylists
|
themePlaylists
|
||||||
?.map((playlist: any) => {
|
?.map((playlist: any) => {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
FiSearch,
|
FiSearch,
|
||||||
FiUser,
|
FiUser,
|
||||||
} from 'react-icons/fi';
|
} from 'react-icons/fi';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate, useParams } from 'react-router-dom';
|
||||||
import { actionIconClasses, tabClasses, textClasses } from 'styles';
|
import { actionIconClasses, tabClasses, textClasses } from 'styles';
|
||||||
import Applications from './components/Applications';
|
import Applications from './components/Applications';
|
||||||
import Bookmarks from './components/Bookmarks';
|
import Bookmarks from './components/Bookmarks';
|
||||||
@@ -26,7 +26,7 @@ import WolClients from './components/WolClients';
|
|||||||
export function Settings() {
|
export function Settings() {
|
||||||
const { isMobile } = useCommonHooks();
|
const { isMobile } = useCommonHooks();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const { tabValue } = useParams();
|
||||||
return (
|
return (
|
||||||
<Stack px={'2rem'}>
|
<Stack px={'2rem'}>
|
||||||
<Group gap={0}>
|
<Group gap={0}>
|
||||||
@@ -44,9 +44,14 @@ export function Settings() {
|
|||||||
</Group>
|
</Group>
|
||||||
<Tabs
|
<Tabs
|
||||||
orientation={isMobile ? 'horizontal' : 'vertical'}
|
orientation={isMobile ? 'horizontal' : 'vertical'}
|
||||||
defaultValue={'personalization'}
|
defaultValue={tabValue ?? 'personalization'}
|
||||||
className={tabClasses.settingsTabs}
|
className={tabClasses.settingsTabs}
|
||||||
classNames={tabClasses}
|
classNames={tabClasses}
|
||||||
|
keepMounted={false}
|
||||||
|
value={tabValue}
|
||||||
|
onChange={(value) =>
|
||||||
|
navigate(`/${import.meta.env.VITE_BASE_URL}/settings/${value}`)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<Tabs.List style={{ justifyContent: isMobile ? 'space-between' : undefined }}>
|
<Tabs.List style={{ justifyContent: isMobile ? 'space-between' : undefined }}>
|
||||||
<Tabs.Tab px={isMobile ? '.9rem' : undefined} value='personalization'>
|
<Tabs.Tab px={isMobile ? '.9rem' : undefined} value='personalization'>
|
||||||
|
|||||||
@@ -9,13 +9,14 @@ function ThemeMiniCard({ allThemes, item }: any) {
|
|||||||
justify='center'
|
justify='center'
|
||||||
display={'grid'}
|
display={'grid'}
|
||||||
pos={'relative'}
|
pos={'relative'}
|
||||||
w={'200px'}
|
w={'175px'}
|
||||||
h={'75px'}
|
h={'60px'}
|
||||||
style={{
|
style={{
|
||||||
background: `linear-gradient(${theme.backgroundColor}33, ${theme.backgroundColor}33), no-repeat center url(/backgrounds/${theme.backgroundImage})`,
|
background: `linear-gradient(${theme.backgroundColor}33, ${theme.backgroundColor}33), no-repeat center url(/backgrounds/${theme.backgroundImage})`,
|
||||||
backgroundSize: 'cover',
|
backgroundSize: 'cover',
|
||||||
backgroundColor: theme.backgroundColor,
|
backgroundColor: theme.backgroundColor,
|
||||||
border: `solid ${theme.borderColor}`,
|
border: `solid ${theme.borderColor}`,
|
||||||
|
borderRadius: '8px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Text
|
<Text
|
||||||
|
|||||||
@@ -169,10 +169,10 @@ function ThemePlaylistCard({
|
|||||||
)}
|
)}
|
||||||
<Button
|
<Button
|
||||||
w={'275px'}
|
w={'275px'}
|
||||||
h={'300px'}
|
h={'310px'}
|
||||||
style={{
|
style={{
|
||||||
backgroundSize: 'cover',
|
backgroundSize: 'cover',
|
||||||
backgroundColor: theme.primaryColor,
|
backgroundColor: theme.searchColor,
|
||||||
color: theme.accentColor,
|
color: theme.accentColor,
|
||||||
border: `solid ${theme.borderColor}`,
|
border: `solid ${theme.borderColor}`,
|
||||||
}}
|
}}
|
||||||
@@ -185,22 +185,32 @@ function ThemePlaylistCard({
|
|||||||
<Stack h={'100%'} w={'100%'}>
|
<Stack h={'100%'} w={'100%'}>
|
||||||
{cardPlaylist.name !== 'Time of Day' ? (
|
{cardPlaylist.name !== 'Time of Day' ? (
|
||||||
<>
|
<>
|
||||||
<Text>Count: {themeList.length}</Text>
|
<Text mt={8} mb={-8}>
|
||||||
<ScrollArea h={'240px'} w={'100%'} style={{ zIndex: 2 }}>
|
Count: {themeList.length}
|
||||||
|
</Text>
|
||||||
|
<ScrollArea h={'255px'} w={'100%'} style={{ zIndex: 2 }}>
|
||||||
|
<Stack gap={4}>
|
||||||
{themeList.length > 0 &&
|
{themeList.length > 0 &&
|
||||||
themeList.map((item: any) => {
|
themeList.map((item: any) => {
|
||||||
return <ThemeMiniCard key={item} item={item} allThemes={allThemes} />;
|
return (
|
||||||
|
<ThemeMiniCard key={item} item={item} allThemes={allThemes} />
|
||||||
|
);
|
||||||
})}
|
})}
|
||||||
|
</Stack>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Text>Timed Themes</Text>
|
<Text mt={8} mb={-8}>
|
||||||
<ScrollArea h={'240px'} w={'100%'} style={{ zIndex: 2 }}>
|
Timed Themes
|
||||||
|
</Text>
|
||||||
|
<ScrollArea h={'255px'} w={'100%'} style={{ zIndex: 2 }}>
|
||||||
|
<Stack gap={4}>
|
||||||
<ThemeMiniCard item={Number(themeList[0])} allThemes={allThemes} />
|
<ThemeMiniCard item={Number(themeList[0])} allThemes={allThemes} />
|
||||||
<ThemeMiniCard item={Number(themeList[1])} allThemes={allThemes} />
|
<ThemeMiniCard item={Number(themeList[1])} allThemes={allThemes} />
|
||||||
<ThemeMiniCard item={Number(themeList[2])} allThemes={allThemes} />
|
<ThemeMiniCard item={Number(themeList[2])} allThemes={allThemes} />
|
||||||
<ThemeMiniCard item={Number(themeList[3])} allThemes={allThemes} />
|
<ThemeMiniCard item={Number(themeList[3])} allThemes={allThemes} />
|
||||||
|
</Stack>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ function ThemePlaylistModal({
|
|||||||
}: any) {
|
}: any) {
|
||||||
const { theme } = useCommonHooks();
|
const { theme } = useCommonHooks();
|
||||||
const [themeList, setThemeList] = useState<any>('[]');
|
const [themeList, setThemeList] = useState<any>('[]');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (selectedPlaylist.themeList) {
|
if (selectedPlaylist.themeList) {
|
||||||
setThemeList(JSON.parse(selectedPlaylist?.themeList));
|
setThemeList(JSON.parse(selectedPlaylist?.themeList));
|
||||||
@@ -40,6 +39,7 @@ function ThemePlaylistModal({
|
|||||||
onClose={() => {
|
onClose={() => {
|
||||||
handleClose();
|
handleClose();
|
||||||
setThemeList('[]');
|
setThemeList('[]');
|
||||||
|
setSelectedPlaylist({});
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
'--color-text-pri': theme.primaryColor,
|
'--color-text-pri': theme.primaryColor,
|
||||||
@@ -59,6 +59,7 @@ function ThemePlaylistModal({
|
|||||||
className={textInputClasses.default}
|
className={textInputClasses.default}
|
||||||
classNames={textInputClasses}
|
classNames={textInputClasses}
|
||||||
value={selectedPlaylist.name}
|
value={selectedPlaylist.name}
|
||||||
|
disabled={selectedPlaylist.name === 'Time of Day'}
|
||||||
onChange={(e) =>
|
onChange={(e) =>
|
||||||
setSelectedPlaylist({ ...selectedPlaylist, name: e.target.value })
|
setSelectedPlaylist({ ...selectedPlaylist, name: e.target.value })
|
||||||
}
|
}
|
||||||
@@ -80,7 +81,7 @@ function ThemePlaylistModal({
|
|||||||
{selectedPlaylist.name === 'Time of Day' ? (
|
{selectedPlaylist.name === 'Time of Day' ? (
|
||||||
<Stack>
|
<Stack>
|
||||||
<Group>
|
<Group>
|
||||||
<Text>00:00-05:59</Text>
|
<Text w={'100px'}>00:00-05:59</Text>
|
||||||
<Select
|
<Select
|
||||||
labelProps={{ display: 'none' }}
|
labelProps={{ display: 'none' }}
|
||||||
placeholder='Select Theme'
|
placeholder='Select Theme'
|
||||||
@@ -113,7 +114,7 @@ function ThemePlaylistModal({
|
|||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group w={'100%'}>
|
<Group w={'100%'}>
|
||||||
<Text>06:00-11:59</Text>
|
<Text w={'100px'}>06:00-11:59</Text>
|
||||||
<Select
|
<Select
|
||||||
labelProps={{ display: 'none' }}
|
labelProps={{ display: 'none' }}
|
||||||
placeholder='Select Theme'
|
placeholder='Select Theme'
|
||||||
@@ -146,7 +147,7 @@ function ThemePlaylistModal({
|
|||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group w={'100%'}>
|
<Group w={'100%'}>
|
||||||
<Text>12:00-17:59</Text>
|
<Text w={'100px'}>12:00-17:59</Text>
|
||||||
<Select
|
<Select
|
||||||
labelProps={{ display: 'none' }}
|
labelProps={{ display: 'none' }}
|
||||||
placeholder='Select Theme'
|
placeholder='Select Theme'
|
||||||
@@ -179,7 +180,7 @@ function ThemePlaylistModal({
|
|||||||
/>
|
/>
|
||||||
</Group>
|
</Group>
|
||||||
<Group w={'100%'}>
|
<Group w={'100%'}>
|
||||||
<Text>18:00-23:59</Text>
|
<Text w={'100px'}>18:00-23:59</Text>
|
||||||
<Select
|
<Select
|
||||||
labelProps={{ display: 'none' }}
|
labelProps={{ display: 'none' }}
|
||||||
placeholder='Select Theme'
|
placeholder='Select Theme'
|
||||||
@@ -228,12 +229,14 @@ function ThemePlaylistModal({
|
|||||||
: undefined,
|
: undefined,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
const newSelectedPlaylist = { ...selectedPlaylist };
|
||||||
if (themeList?.includes(miniTheme.id)) {
|
if (themeList?.includes(miniTheme.id)) {
|
||||||
newThemeList.splice(themeList.indexOf(miniTheme.id), 1);
|
newThemeList.splice(themeList.indexOf(miniTheme.id), 1);
|
||||||
} else {
|
} else {
|
||||||
newThemeList.push(miniTheme.id);
|
newThemeList.push(miniTheme.id);
|
||||||
}
|
}
|
||||||
selectedPlaylist.themeList = JSON.stringify(newThemeList);
|
newSelectedPlaylist.themeList = JSON.stringify(newThemeList);
|
||||||
|
setSelectedPlaylist(newSelectedPlaylist);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ThemeMiniCard allThemes={allThemes} item={miniTheme.id} />
|
<ThemeMiniCard allThemes={allThemes} item={miniTheme.id} />
|
||||||
@@ -254,7 +257,11 @@ function ThemePlaylistModal({
|
|||||||
<Button
|
<Button
|
||||||
color={'red'}
|
color={'red'}
|
||||||
styles={{ label: { color: 'black' } }}
|
styles={{ label: { color: 'black' } }}
|
||||||
onClick={handleClose}
|
onClick={() => {
|
||||||
|
handleClose();
|
||||||
|
setThemeList('[]');
|
||||||
|
setSelectedPlaylist({});
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Cancel
|
Cancel
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -91,7 +91,14 @@ function ThemePlaylists() {
|
|||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<Group justify='center' align='center' pos={'relative'}>
|
<Group justify='center' align='center' pos={'relative'}>
|
||||||
{themePlaylists?.map((cardPlaylist: any) => {
|
<Text p={0} className={textClasses.settingsSubTitle} classNames={textClasses}>
|
||||||
|
Defaults
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
<Group justify='center' align='center' pos={'relative'}>
|
||||||
|
{themePlaylists
|
||||||
|
?.filter((playlist: any) => playlist.default === 1)
|
||||||
|
.map((cardPlaylist: any) => {
|
||||||
return (
|
return (
|
||||||
<Group key={cardPlaylist.name} pos={'relative'}>
|
<Group key={cardPlaylist.name} pos={'relative'}>
|
||||||
{cardPlaylist.name === currentThemePlaylist && (
|
{cardPlaylist.name === currentThemePlaylist && (
|
||||||
@@ -99,7 +106,50 @@ function ThemePlaylists() {
|
|||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
left: -14,
|
left: -14,
|
||||||
zIndex: 1,
|
zIndex: 10,
|
||||||
|
fontSize: '2em',
|
||||||
|
fontWeight: 'bold',
|
||||||
|
borderRadius: '50%',
|
||||||
|
backgroundColor: theme.borderColor,
|
||||||
|
color:
|
||||||
|
theme.borderColor === theme.primaryColor
|
||||||
|
? theme.accentColor
|
||||||
|
: theme.primaryColor,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<Box>
|
||||||
|
<ThemePlaylistCard
|
||||||
|
cardPlaylist={cardPlaylist}
|
||||||
|
handleOpen={handleOpen}
|
||||||
|
currentThemePlaylist={currentThemePlaylist}
|
||||||
|
setCurrentThemePlaylist={setCurrentThemePlaylist}
|
||||||
|
handleDeletePlaylist={handleDeletePlaylist}
|
||||||
|
allThemes={allThemes}
|
||||||
|
createPlaylist={createPlaylist}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
|
</Group>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</Group>
|
||||||
|
<Group justify='center' align='center' pos={'relative'}>
|
||||||
|
<Text p={0} className={textClasses.settingsSubTitle} classNames={textClasses}>
|
||||||
|
User Made
|
||||||
|
</Text>
|
||||||
|
</Group>
|
||||||
|
<Group justify='center' align='center' pos={'relative'}>
|
||||||
|
{themePlaylists
|
||||||
|
?.filter((playlist: any) => playlist.default === 0)
|
||||||
|
.map((cardPlaylist: any) => {
|
||||||
|
return (
|
||||||
|
<Group key={cardPlaylist.name} pos={'relative'}>
|
||||||
|
{cardPlaylist.name === currentThemePlaylist && (
|
||||||
|
<FiChevronRight
|
||||||
|
style={{
|
||||||
|
position: 'absolute',
|
||||||
|
left: -14,
|
||||||
|
zIndex: 10,
|
||||||
fontSize: '2em',
|
fontSize: '2em',
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
borderRadius: '50%',
|
borderRadius: '50%',
|
||||||
|
|||||||
Reference in New Issue
Block a user