From 5e5a077ec3de85eef5179a94d46a69b234d0b657 Mon Sep 17 00:00:00 2001 From: Sean Edmunds Date: Thu, 17 Jul 2025 17:01:31 -0500 Subject: [PATCH] Style updates and bugfixes --- package-lock.json | 32 +- package.json | 6 +- .../Shared => components}/AddItemModal.tsx | 4 +- .../Shared => components}/DeleteItemModal.tsx | 4 +- .../Shared => components}/ManagementPill.tsx | 4 +- .../Shared => components}/NoItemsFound.tsx | 4 +- .../Shared => components}/SettingsHeader.tsx | 6 +- src/components/index.ts | 5 + .../components/Bookmarks/BookmarkGroups.tsx | 1 + .../SettingsButton/WakeOnLanCard.tsx | 2 +- src/pages/settings/Settings.tsx | 4 +- .../components/Applications/Applications.tsx | 5 +- .../Applications/DebouncedApplication.tsx | 3 +- .../Bookmarks/BookmarkSettingsItem.tsx | 4 +- .../components/Bookmarks/Bookmarks.tsx | 4 +- .../Bookmarks/DebouncedBookmarkItem.tsx | 34 +- .../Bookmarks/DebouncedGroupSettingsItem.tsx | 17 +- .../components/Messages/DebouncedMessage.tsx | 3 +- .../settings/components/Messages/Messages.tsx | 4 +- .../Personalization/Personalization.tsx | 2 +- .../Search/DebouncedSearchProvider.tsx | 2 +- .../components/Search/SearchProviders.tsx | 4 +- .../{ => Backgrounds}/BackgroundModal.tsx | 9 +- .../{ => Backgrounds}/DeleteBackground.tsx | 4 +- .../{ => Backgrounds}/EditBackground.tsx | 4 +- .../components/Theming/Backgrounds/index.ts | 3 + .../settings/components/Theming/ThemeCard.tsx | 360 ------------------ .../ThemePlaylistCard.tsx | 8 +- .../ThemePlaylistModal.tsx | 7 +- .../{ => ThemePlaylists}/ThemePlaylists.tsx | 11 +- .../Theming/ThemePlaylists/index.ts | 3 + .../components/Theming/Themes/ThemeCard.tsx | 205 ++++++++++ .../Theming/{ => Themes}/ThemeExampleApp.tsx | 4 +- .../Theming/Themes/ThemeManagementPill.tsx | 227 +++++++++++ .../Theming/{ => Themes}/ThemeMiniCard.tsx | 4 +- .../Theming/{ => Themes}/ThemeModal.tsx | 6 +- .../{ => Themes}/ThemeModalColorSwatches.tsx | 4 +- .../{ => Themes}/ThemeModalContent.tsx | 4 +- .../ThemePreviewMiddleware.tsx} | 8 +- .../Theming/{ => Themes}/ThemeSelect.tsx | 4 +- .../Theming/{ => Themes}/Themes.tsx | 13 +- .../Theming/{ => Themes}/TimeOfDay.tsx | 6 +- .../components/Theming/Themes/index.ts | 11 + .../components/WoL/DebouncedWolClient.tsx | 2 +- .../settings/components/WoL/WolClients.tsx | 4 +- src/styles/ActionIcon.module.css | 17 +- src/styles/TextInput.module.css | 6 +- src/types/bookmark.ts | 1 + 48 files changed, 565 insertions(+), 524 deletions(-) rename src/{pages/settings/components/Shared => components}/AddItemModal.tsx (95%) rename src/{pages/settings/components/Shared => components}/DeleteItemModal.tsx (95%) rename src/{pages/settings/components/Shared => components}/ManagementPill.tsx (96%) rename src/{pages/settings/components/Shared => components}/NoItemsFound.tsx (87%) rename src/{pages/settings/components/Shared => components}/SettingsHeader.tsx (97%) rename src/pages/settings/components/Theming/{ => Backgrounds}/BackgroundModal.tsx (98%) rename src/pages/settings/components/Theming/{ => Backgrounds}/DeleteBackground.tsx (97%) rename src/pages/settings/components/Theming/{ => Backgrounds}/EditBackground.tsx (98%) create mode 100644 src/pages/settings/components/Theming/Backgrounds/index.ts delete mode 100644 src/pages/settings/components/Theming/ThemeCard.tsx rename src/pages/settings/components/Theming/{ => ThemePlaylists}/ThemePlaylistCard.tsx (97%) rename src/pages/settings/components/Theming/{ => ThemePlaylists}/ThemePlaylistModal.tsx (95%) rename src/pages/settings/components/Theming/{ => ThemePlaylists}/ThemePlaylists.tsx (97%) create mode 100644 src/pages/settings/components/Theming/ThemePlaylists/index.ts create mode 100644 src/pages/settings/components/Theming/Themes/ThemeCard.tsx rename src/pages/settings/components/Theming/{ => Themes}/ThemeExampleApp.tsx (92%) create mode 100644 src/pages/settings/components/Theming/Themes/ThemeManagementPill.tsx rename src/pages/settings/components/Theming/{ => Themes}/ThemeMiniCard.tsx (91%) rename src/pages/settings/components/Theming/{ => Themes}/ThemeModal.tsx (99%) rename src/pages/settings/components/Theming/{ => Themes}/ThemeModalColorSwatches.tsx (97%) rename src/pages/settings/components/Theming/{ => Themes}/ThemeModalContent.tsx (97%) rename src/pages/settings/components/Theming/{ThemePreivewMiddleware.tsx => Themes/ThemePreviewMiddleware.tsx} (91%) rename src/pages/settings/components/Theming/{ => Themes}/ThemeSelect.tsx (98%) rename src/pages/settings/components/Theming/{ => Themes}/Themes.tsx (97%) rename src/pages/settings/components/Theming/{ => Themes}/TimeOfDay.tsx (92%) create mode 100644 src/pages/settings/components/Theming/Themes/index.ts diff --git a/package-lock.json b/package-lock.json index d4fea3a..1be5576 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,18 +21,18 @@ "react": "^19.1.0", "react-dom": "^19.1.0", "react-icons": "^5.5.0", - "react-router-dom": "^7.6.3", + "react-router-dom": "^7.7.0", "recharts": "^3.1.0" }, "devDependencies": { - "@types/node": "^24.0.13", + "@types/node": "^24.0.14", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", "@vitest/coverage-v8": "^3.2.4", "@vitest/ui": "^3.2.4", "typescript": "^5.8.3", - "vite": "^7.0.4", + "vite": "^7.0.5", "vite-plugin-dts": "~4.5.4", "vite-tsconfig-paths": "^5.1.4", "vitest": "^3.2.4" @@ -1847,9 +1847,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "24.0.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.13.tgz", - "integrity": "sha512-Qm9OYVOFHFYg3wJoTSrz80hoec5Lia/dPp84do3X7dZvLikQvM1YpmvTBEdIr/e+U8HTkFjLHLnl78K/qjf+jQ==", + "version": "24.0.14", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.14.tgz", + "integrity": "sha512-4zXMWD91vBLGRtHK3YbIoFMia+1nqEz72coM42C5ETjnNCa/heoj7NT1G67iAfOqMmcfhuCZ4uNpyz8EjlAejw==", "dev": true, "license": "MIT", "dependencies": { @@ -3694,9 +3694,9 @@ } }, "node_modules/react-router": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.6.3.tgz", - "integrity": "sha512-zf45LZp5skDC6I3jDLXQUu0u26jtuP4lEGbc7BbdyxenBN1vJSTA18czM2D+h5qyMBuMrD+9uB+mU37HIoKGRA==", + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.7.0.tgz", + "integrity": "sha512-3FUYSwlvB/5wRJVTL/aavqHmfUKe0+Xm9MllkYgGo9eDwNdkvwlJGjpPxono1kCycLt6AnDTgjmXvK3/B4QGuw==", "license": "MIT", "dependencies": { "cookie": "^1.0.1", @@ -3716,12 +3716,12 @@ } }, "node_modules/react-router-dom": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.6.3.tgz", - "integrity": "sha512-DiWJm9qdUAmiJrVWaeJdu4TKu13+iB/8IEi0EW/XgaHCjW/vWGrwzup0GVvaMteuZjKnh5bEvJP/K0MDnzawHw==", + "version": "7.7.0", + "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-7.7.0.tgz", + "integrity": "sha512-wwGS19VkNBkneVh9/YD0pK3IsjWxQUVMDD6drlG7eJpo1rXBtctBqDyBm/k+oKHRAm1x9XWT3JFC82QI9YOXXA==", "license": "MIT", "dependencies": { - "react-router": "7.6.3" + "react-router": "7.7.0" }, "engines": { "node": ">=20.0.0" @@ -4517,9 +4517,9 @@ } }, "node_modules/vite": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.4.tgz", - "integrity": "sha512-SkaSguuS7nnmV7mfJ8l81JGBFV7Gvzp8IzgE8A8t23+AxuNX61Q5H1Tpz5efduSN7NHC8nQXD3sKQKZAu5mNEA==", + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.5.tgz", + "integrity": "sha512-1mncVwJxy2C9ThLwz0+2GKZyEXuC3MyWtAAlNftlZZXZDP3AJt5FmwcMit/IGGaNZ8ZOB2BNO/HFUB+CpN0NQw==", "dev": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index f0f1301..3b72595 100644 --- a/package.json +++ b/package.json @@ -23,18 +23,18 @@ "react": "^19.1.0", "react-dom": "^19.1.0", "react-icons": "^5.5.0", - "react-router-dom": "^7.6.3", + "react-router-dom": "^7.7.0", "recharts": "^3.1.0" }, "devDependencies": { - "@types/node": "^24.0.13", + "@types/node": "^24.0.14", "@types/react": "^19.1.8", "@types/react-dom": "^19.1.6", "@vitejs/plugin-react": "^4.6.0", "@vitest/coverage-v8": "^3.2.4", "@vitest/ui": "^3.2.4", "typescript": "^5.8.3", - "vite": "^7.0.4", + "vite": "^7.0.5", "vite-plugin-dts": "~4.5.4", "vite-tsconfig-paths": "^5.1.4", "vitest": "^3.2.4" diff --git a/src/pages/settings/components/Shared/AddItemModal.tsx b/src/components/AddItemModal.tsx similarity index 95% rename from src/pages/settings/components/Shared/AddItemModal.tsx rename to src/components/AddItemModal.tsx index a5fb3d7..a44dc92 100644 --- a/src/pages/settings/components/Shared/AddItemModal.tsx +++ b/src/components/AddItemModal.tsx @@ -3,7 +3,7 @@ import { useCommonHooks } from 'hooks'; import type React from 'react'; import { cardClasses, modalClasses } from 'styles'; -function AddItemModal({ +export function AddItemModal({ modalOpened, handleClose, body, @@ -53,5 +53,3 @@ function AddItemModal({ ); } - -export default AddItemModal; diff --git a/src/pages/settings/components/Shared/DeleteItemModal.tsx b/src/components/DeleteItemModal.tsx similarity index 95% rename from src/pages/settings/components/Shared/DeleteItemModal.tsx rename to src/components/DeleteItemModal.tsx index a063cce..08a2075 100644 --- a/src/pages/settings/components/Shared/DeleteItemModal.tsx +++ b/src/components/DeleteItemModal.tsx @@ -2,7 +2,7 @@ import { Button, Card, Group, Modal } from '@mantine/core'; import { useCommonHooks } from 'hooks'; import { cardClasses, modalClasses } from 'styles'; -function DeleteItemModal({ +export function DeleteItemModal({ modalOpened, handleClose, handleDelete, @@ -56,5 +56,3 @@ function DeleteItemModal({ ); } - -export default DeleteItemModal; diff --git a/src/pages/settings/components/Shared/ManagementPill.tsx b/src/components/ManagementPill.tsx similarity index 96% rename from src/pages/settings/components/Shared/ManagementPill.tsx rename to src/components/ManagementPill.tsx index 14a919c..88e9020 100644 --- a/src/pages/settings/components/Shared/ManagementPill.tsx +++ b/src/components/ManagementPill.tsx @@ -2,7 +2,7 @@ import { ActionIcon, Group, Switch, Tooltip } from '@mantine/core'; import { FiPower, FiTrash } from 'react-icons/fi'; import { switchClasses } from 'styles'; -function ManagementPill({ +export function ManagementPill({ enabled, onChange, openModal, @@ -72,5 +72,3 @@ function ManagementPill({ ); } - -export default ManagementPill; diff --git a/src/pages/settings/components/Shared/NoItemsFound.tsx b/src/components/NoItemsFound.tsx similarity index 87% rename from src/pages/settings/components/Shared/NoItemsFound.tsx rename to src/components/NoItemsFound.tsx index 1b104cf..af0a4b3 100644 --- a/src/pages/settings/components/Shared/NoItemsFound.tsx +++ b/src/components/NoItemsFound.tsx @@ -1,7 +1,7 @@ import { Card, Text } from '@mantine/core'; import { cardClasses } from 'styles'; -function NoItemsFound() { +export function NoItemsFound() { return ( ); } - -export default NoItemsFound; diff --git a/src/pages/settings/components/Shared/SettingsHeader.tsx b/src/components/SettingsHeader.tsx similarity index 97% rename from src/pages/settings/components/Shared/SettingsHeader.tsx rename to src/components/SettingsHeader.tsx index ab63666..909fc2e 100644 --- a/src/pages/settings/components/Shared/SettingsHeader.tsx +++ b/src/components/SettingsHeader.tsx @@ -21,7 +21,7 @@ import { textInputClasses, } from 'styles'; -function SettingsHeader({ +export function SettingsHeader({ setDragging, openModal, title, @@ -124,7 +124,7 @@ function SettingsHeader({ disabled={disabled} w={isMobile ? undefined : '35%'} pos={isMobile ? undefined : 'absolute'} - className={textInputClasses.settingsItem} + className={textInputClasses.default} classNames={textInputClasses} autoFocus={!isMobile} placeholder={searchPlaceholder ?? 'Search...'} @@ -181,5 +181,3 @@ function SettingsHeader({ ); } - -export default SettingsHeader; diff --git a/src/components/index.ts b/src/components/index.ts index 38f539b..b9d7291 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,5 +1,10 @@ +export { AddItemModal } from './AddItemModal'; export { AppItem } from './Applications/AppItem'; +export { DeleteItemModal } from './DeleteItemModal'; export { HelpModal } from './HelpModal/HelpModal'; export { Loading } from './Loading'; export { MainLayout } from './MainLayout'; +export { ManagementPill } from './ManagementPill'; +export { NoItemsFound } from './NoItemsFound'; +export { SettingsHeader } from './SettingsHeader'; export { WeatherModal } from './WeatherModal/WeatherModal'; diff --git a/src/pages/homepage/components/Bookmarks/BookmarkGroups.tsx b/src/pages/homepage/components/Bookmarks/BookmarkGroups.tsx index 575dba4..0cbf3e5 100644 --- a/src/pages/homepage/components/Bookmarks/BookmarkGroups.tsx +++ b/src/pages/homepage/components/Bookmarks/BookmarkGroups.tsx @@ -29,6 +29,7 @@ function BookmarkGroups({ {bookmarks ?.toSorted((a: Bookmark, b: Bookmark) => (a.index > b.index ? 1 : -1)) + .filter((bookmark: Bookmark) => bookmark.enabled === 1) .map((bookmark: Bookmark) => ( { handleWakeRequest(); }} diff --git a/src/pages/settings/Settings.tsx b/src/pages/settings/Settings.tsx index 101cec0..b7354dd 100644 --- a/src/pages/settings/Settings.tsx +++ b/src/pages/settings/Settings.tsx @@ -17,8 +17,8 @@ import Bookmarks from './components/Bookmarks/Bookmarks'; import Messages from './components/Messages/Messages'; import Personalization from './components/Personalization/Personalization'; import SearchProviders from './components/Search/SearchProviders'; -import ThemePlaylists from './components/Theming/ThemePlaylists'; -import Themes from './components/Theming/Themes'; +import { ThemePlaylists } from './components/Theming/ThemePlaylists'; +import { Themes } from './components/Theming/Themes'; import WolClients from './components/WoL/WolClients'; export function Settings() { diff --git a/src/pages/settings/components/Applications/Applications.tsx b/src/pages/settings/components/Applications/Applications.tsx index c43fbb7..c2fa0c6 100644 --- a/src/pages/settings/components/Applications/Applications.tsx +++ b/src/pages/settings/components/Applications/Applications.tsx @@ -15,7 +15,7 @@ import { } from '@mantine/core'; import { isNotEmpty, useForm } from '@mantine/form'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; -import { AppItem } from 'components'; +import { AddItemModal, AppItem, NoItemsFound, SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import * as fa6 from 'react-icons/fa6'; @@ -23,9 +23,6 @@ import * as si from 'react-icons/si'; import * as vsc from 'react-icons/vsc'; import { popoverClasses, selectClasses, textInputClasses } from 'styles'; import type { Application } from 'types'; -import AddItemModal from '../Shared/AddItemModal'; -import NoItemsFound from '../Shared/NoItemsFound'; -import SettingsHeader from '../Shared/SettingsHeader'; import DebouncedApplication from './DebouncedApplication'; const ApplicationSettings = () => { diff --git a/src/pages/settings/components/Applications/DebouncedApplication.tsx b/src/pages/settings/components/Applications/DebouncedApplication.tsx index 37a984b..dd88bec 100644 --- a/src/pages/settings/components/Applications/DebouncedApplication.tsx +++ b/src/pages/settings/components/Applications/DebouncedApplication.tsx @@ -9,12 +9,11 @@ import { TextInput, } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { DeleteItemModal, ManagementPill } from 'components'; import { useCommonHooks, useMutationAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { cardClasses, selectClasses, textInputClasses } from 'styles'; import type { Application } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; -import ManagementPill from '../Shared/ManagementPill'; function DebouncedApplication({ application, diff --git a/src/pages/settings/components/Bookmarks/BookmarkSettingsItem.tsx b/src/pages/settings/components/Bookmarks/BookmarkSettingsItem.tsx index 13d375e..e53100b 100644 --- a/src/pages/settings/components/Bookmarks/BookmarkSettingsItem.tsx +++ b/src/pages/settings/components/Bookmarks/BookmarkSettingsItem.tsx @@ -13,12 +13,14 @@ function BookmarkSettingsItem({ bookmark }: { bookmark: Bookmark }) { color: 'var(--mantine-color-primary-0)', backgroundColor: 'var(--mantine-color-search-0)', padding: '.5rem', + filter: bookmark.enabled ? '' : 'grayscale(100%)', }} onMouseEnter={() => setHover(true)} onMouseLeave={() => setHover(false)} > - + {bookmark.name} + {!bookmark.enabled && !hover && Disabled} {hover && ( { diff --git a/src/pages/settings/components/Bookmarks/DebouncedBookmarkItem.tsx b/src/pages/settings/components/Bookmarks/DebouncedBookmarkItem.tsx index a74a9e7..553372c 100644 --- a/src/pages/settings/components/Bookmarks/DebouncedBookmarkItem.tsx +++ b/src/pages/settings/components/Bookmarks/DebouncedBookmarkItem.tsx @@ -1,11 +1,10 @@ -import { ActionIcon, Card, Group, Stack, Text, TextInput, Tooltip } from '@mantine/core'; +import { Card, Group, Stack, Text, TextInput } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { DeleteItemModal, ManagementPill } from 'components'; import { useCommonHooks, useMutationAPI } from 'hooks'; import { useEffect, useState } from 'react'; -import { FiTrash } from 'react-icons/fi'; import { cardClasses, textInputClasses } from 'styles'; import type { Bookmark } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; function DebouncedBookmarkItem({ bookmarkItem, @@ -66,25 +65,16 @@ function DebouncedBookmarkItem({ } title='Delete Bookmark' /> - - { - setIsOpen(true); - openModal(); - }} - > - - - + ) => { + setUpdate({ + ...bookmark, + enabled: event.target.checked ? 1 : 0, + }); + }} + openModal={openModal} + /> { - handleDelete(bookmarks, 'api/bookmarks'); + bookmarks.length > 0 && handleDelete(bookmarks, 'api/bookmarks'); handleDelete(group, 'api/bookmarkCategories'); }} title='Delete message' @@ -141,12 +142,13 @@ function DebouncedGroupSettingsItem({ pt={0} bg={'var(--mantine-color-search-0)'} c={'var(--mantine-color-background-0)'} + mt={'-1.5rem'} > - + { openModal(); }} @@ -206,8 +207,8 @@ function DebouncedGroupSettingsItem({ borderRadius: '100%', backgroundColor: 'var(--mantine-color-accent-0)', position: 'absolute', - top: isMobile ? 170 : 92, - right: 18, + top: isMobile ? 156 : 78, + right: 22, zIndex: 10, fontSize: '1.25rem', textAlign: 'center', diff --git a/src/pages/settings/components/Messages/DebouncedMessage.tsx b/src/pages/settings/components/Messages/DebouncedMessage.tsx index 0376b11..a02188e 100644 --- a/src/pages/settings/components/Messages/DebouncedMessage.tsx +++ b/src/pages/settings/components/Messages/DebouncedMessage.tsx @@ -1,10 +1,9 @@ import { Card, Stack, Text, TextInput } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; +import { DeleteItemModal, ManagementPill } from 'components'; import { useCommonHooks } from 'hooks'; import { cardClasses, textInputClasses } from 'styles'; import type { Message } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; -import ManagementPill from '../Shared/ManagementPill'; function DebouncedMessage({ label, diff --git a/src/pages/settings/components/Messages/Messages.tsx b/src/pages/settings/components/Messages/Messages.tsx index c261684..3f702e9 100644 --- a/src/pages/settings/components/Messages/Messages.tsx +++ b/src/pages/settings/components/Messages/Messages.tsx @@ -1,12 +1,10 @@ import { Button, Grid, GridCol, Group, Stack, TextInput } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { AddItemModal, NoItemsFound, SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { textInputClasses } from 'styles'; import type { Message } from 'types'; -import AddItemModal from '../Shared/AddItemModal'; -import NoItemsFound from '../Shared/NoItemsFound'; -import SettingsHeader from '../Shared/SettingsHeader'; import DebouncedMessage from './DebouncedMessage'; const MessageSettings = () => { diff --git a/src/pages/settings/components/Personalization/Personalization.tsx b/src/pages/settings/components/Personalization/Personalization.tsx index 3ae05a0..41a3e21 100644 --- a/src/pages/settings/components/Personalization/Personalization.tsx +++ b/src/pages/settings/components/Personalization/Personalization.tsx @@ -1,10 +1,10 @@ import { Card, Grid, GridCol, Overlay, Stack, TextInput } from '@mantine/core'; import { useDebouncedValue } from '@mantine/hooks'; +import { SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { cardClasses, textInputClasses } from 'styles'; import type { PersonalData } from 'types'; -import SettingsHeader from '../Shared/SettingsHeader'; const PersonalizationSettings = () => { const endpoint = 'api/personalData'; diff --git a/src/pages/settings/components/Search/DebouncedSearchProvider.tsx b/src/pages/settings/components/Search/DebouncedSearchProvider.tsx index 4eb5398..035d4ea 100644 --- a/src/pages/settings/components/Search/DebouncedSearchProvider.tsx +++ b/src/pages/settings/components/Search/DebouncedSearchProvider.tsx @@ -1,11 +1,11 @@ import { ActionIcon, Card, Group, Stack, Text, TextInput, Tooltip } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { DeleteItemModal } from 'components'; import { useCommonHooks, useMutationAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { FiTrash } from 'react-icons/fi'; import { cardClasses, textInputClasses } from 'styles'; import type { Provider } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; function DebouncedSearchProvider({ searchProvider, diff --git a/src/pages/settings/components/Search/SearchProviders.tsx b/src/pages/settings/components/Search/SearchProviders.tsx index ae425ef..a408b8b 100644 --- a/src/pages/settings/components/Search/SearchProviders.tsx +++ b/src/pages/settings/components/Search/SearchProviders.tsx @@ -10,13 +10,11 @@ import { } from '@mantine/core'; import { isNotEmpty, useForm } from '@mantine/form'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { AddItemModal, NoItemsFound, SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { popoverClasses, textInputClasses } from 'styles'; import type { Provider } from 'types'; -import AddItemModal from '../Shared/AddItemModal'; -import NoItemsFound from '../Shared/NoItemsFound'; -import SettingsHeader from '../Shared/SettingsHeader'; import DebouncedSearchProvider from './DebouncedSearchProvider'; import SearchProviderSettingsItem from './SearchProviderSettingsItem'; diff --git a/src/pages/settings/components/Theming/BackgroundModal.tsx b/src/pages/settings/components/Theming/Backgrounds/BackgroundModal.tsx similarity index 98% rename from src/pages/settings/components/Theming/BackgroundModal.tsx rename to src/pages/settings/components/Theming/Backgrounds/BackgroundModal.tsx index e48e130..79c0db3 100644 --- a/src/pages/settings/components/Theming/BackgroundModal.tsx +++ b/src/pages/settings/components/Theming/Backgrounds/BackgroundModal.tsx @@ -24,10 +24,10 @@ import { scrollAreaClasses, textInputClasses, } from 'styles'; -import DeleteBackground from './DeleteBackground'; -import EditBackground from './EditBackground'; +import { DeleteBackground } from './DeleteBackground'; +import { EditBackground } from './EditBackground'; -function BackgroundModal({ +export function BackgroundModal({ backgroundModalOpened, handleBackgroundModalClose, backgroundList, @@ -97,7 +97,7 @@ function BackgroundModal({ ); } -export default BackgroundModal; diff --git a/src/pages/settings/components/Theming/DeleteBackground.tsx b/src/pages/settings/components/Theming/Backgrounds/DeleteBackground.tsx similarity index 97% rename from src/pages/settings/components/Theming/DeleteBackground.tsx rename to src/pages/settings/components/Theming/Backgrounds/DeleteBackground.tsx index 096a0f0..34ce7a0 100644 --- a/src/pages/settings/components/Theming/DeleteBackground.tsx +++ b/src/pages/settings/components/Theming/Backgrounds/DeleteBackground.tsx @@ -1,7 +1,7 @@ import { Button, Card, Group, Stack, Text } from '@mantine/core'; import { useMutationAPI } from 'hooks'; -function DeleteBackground({ +export function DeleteBackground({ fileName, setFileName, inUseBackgrounds, @@ -91,5 +91,3 @@ function DeleteBackground({ ); } - -export default DeleteBackground; diff --git a/src/pages/settings/components/Theming/EditBackground.tsx b/src/pages/settings/components/Theming/Backgrounds/EditBackground.tsx similarity index 98% rename from src/pages/settings/components/Theming/EditBackground.tsx rename to src/pages/settings/components/Theming/Backgrounds/EditBackground.tsx index 18fcfa9..f5d1e61 100644 --- a/src/pages/settings/components/Theming/EditBackground.tsx +++ b/src/pages/settings/components/Theming/Backgrounds/EditBackground.tsx @@ -3,7 +3,7 @@ import { useCommonHooks, useMutationAPI } from 'hooks'; import { useState } from 'react'; import { textInputClasses } from 'styles'; -function EditBackground({ +export function EditBackground({ fileName, setFileName, inUseBackgrounds, @@ -125,5 +125,3 @@ function EditBackground({ ); } - -export default EditBackground; diff --git a/src/pages/settings/components/Theming/Backgrounds/index.ts b/src/pages/settings/components/Theming/Backgrounds/index.ts new file mode 100644 index 0000000..75335ed --- /dev/null +++ b/src/pages/settings/components/Theming/Backgrounds/index.ts @@ -0,0 +1,3 @@ +export { BackgroundModal } from './BackgroundModal'; +export { DeleteBackground } from './DeleteBackground'; +export { EditBackground } from './EditBackground'; diff --git a/src/pages/settings/components/Theming/ThemeCard.tsx b/src/pages/settings/components/Theming/ThemeCard.tsx deleted file mode 100644 index 9ca3992..0000000 --- a/src/pages/settings/components/Theming/ThemeCard.tsx +++ /dev/null @@ -1,360 +0,0 @@ -import { ActionIcon, Box, Button, Group, Overlay, Stack, Text } from '@mantine/core'; -import { useDisclosure, useElementSize } from '@mantine/hooks'; -import { useCommonHooks, useMutationAPI } from 'hooks'; -import { useState } from 'react'; -import { FiEdit, FiShuffle, FiTrash, FiX } from 'react-icons/fi'; -import { actionIconClasses, boxClasses } from 'styles'; -import type { Theme, ThemePlaylist } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; - -function ThemeCard({ - cardTheme, - handleOpen, - allThemes, - themePlaylists, -}: { - cardTheme: Theme; - handleOpen: (cardTheme: Theme) => void; - allThemes: Theme[]; - themePlaylists: ThemePlaylist[]; -}) { - const { ref, width } = useElementSize(); - const [hover, setHover] = useState(false); - const [shiftEdit, setShiftEdit] = useState(0); - const [shiftShuffle, setShiftShuffle] = useState(0); - const { mutateAsync } = useMutationAPI(); - const [modalOpened, { open: openModal, close: closeModal }] = useDisclosure(false); - const { - handleThemeChange, - currentTheme, - setCurrentTheme, - theme, - currentThemePlaylist, - setCurrentThemePlaylist, - handleDelete, - } = useCommonHooks(); - - return ( - setHover(true)} - onMouseLeave={() => setHover(false)} - > - handleDelete(cardTheme, 'api/themes')} - title={'Delete Theme'} - body={ - - Are you sure you want to delete this theme? - {`"${cardTheme.name}"`} - This action cannot be undone! - - } - /> - - {cardTheme.name} - - - {currentTheme === 'random' && cardTheme.name === theme.name ? ( - - { - setShiftEdit(2); - }} - onMouseLeave={() => { - setShiftEdit(0); - }} - onClick={() => { - handleOpen(cardTheme); - }} - gap={0} - style={{ - zIndex: 300, - position: 'absolute', - left: 0, - top: 27 - shiftEdit, - backgroundColor: - shiftEdit === 0 ? 'white' : 'var(--mantine-color-background-0)', - borderRadius: '50%', - padding: '.5rem', - margin: '.25rem', - border: 'solid 2px', - borderColor: shiftEdit === 0 ? 'black' : 'var(--mantine-color-primary-0)', - transition: 'all 0.2s', - }} - > - - - { - setShiftShuffle(2); - }} - onMouseLeave={() => { - setShiftShuffle(0); - }} - onClick={() => { - 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, - ); - } else { - const themeList = JSON.parse( - themePlaylists?.find( - (t: ThemePlaylist) => t?.name === currentThemePlaylist, - )?.themeList ?? '[]', - ); - const filteredThemes = allThemes.filter((t: Theme) => - themeList.includes(t.id), - ); - handleThemeChange(filteredThemes, false); - } - }} - gap={0} - style={{ - zIndex: 300, - position: 'absolute', - right: 0, - top: 27 - shiftShuffle, - backgroundColor: - shiftShuffle === 0 ? 'white' : 'var(--mantine-color-background-0)', - borderRadius: '50%', - padding: '.5rem', - margin: '.25rem', - border: 'solid 2px', - borderColor: - shiftShuffle === 0 ? 'black' : 'var(--mantine-color-primary-0)', - transition: 'all 0.2s', - }} - > - - - - ) : ( - - { - mutateAsync({ - method: 'PATCH', - endpoint: 'api/themes', - body: { ...cardTheme, randomEnabled: !cardTheme.randomEnabled }, - }); - }} - > - {cardTheme.randomEnabled ? : } - - handleOpen(cardTheme)} - mb={'.125rem'} - > - - - - - - - )} - - ); -} - -export default ThemeCard; diff --git a/src/pages/settings/components/Theming/ThemePlaylistCard.tsx b/src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylistCard.tsx similarity index 97% rename from src/pages/settings/components/Theming/ThemePlaylistCard.tsx rename to src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylistCard.tsx index c925bbc..6247ba6 100644 --- a/src/pages/settings/components/Theming/ThemePlaylistCard.tsx +++ b/src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylistCard.tsx @@ -8,15 +8,15 @@ import { Text, } from '@mantine/core'; import { useDisclosure } from '@mantine/hooks'; +import { DeleteItemModal } from 'components'; import { useCommonHooks } from 'hooks'; import { useState } from 'react'; import { FiEdit, FiTrash } from 'react-icons/fi'; import { scrollAreaClasses } from 'styles'; import type { Theme, ThemePlaylist } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; -import ThemeMiniCard from './ThemeMiniCard'; +import { ThemeMiniCard } from '../Themes'; -function ThemePlaylistCard({ +export function ThemePlaylistCard({ cardPlaylist, handleOpen, allThemes, @@ -220,5 +220,3 @@ function ThemePlaylistCard({ ); } - -export default ThemePlaylistCard; diff --git a/src/pages/settings/components/Theming/ThemePlaylistModal.tsx b/src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylistModal.tsx similarity index 95% rename from src/pages/settings/components/Theming/ThemePlaylistModal.tsx rename to src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylistModal.tsx index 3e9046b..57d7796 100644 --- a/src/pages/settings/components/Theming/ThemePlaylistModal.tsx +++ b/src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylistModal.tsx @@ -3,10 +3,9 @@ import { useCommonHooks } from 'hooks'; import { useEffect, useState } from 'react'; import { modalClasses, textInputClasses } from 'styles'; import type { Theme, ThemePlaylist } from 'types'; -import ThemePreviewMiddleware from './ThemePreivewMiddleware'; -import TimeOfDay from './TimeOfDay'; +import { ThemePreviewMiddleware, TimeOfDay } from '../Themes'; -function ThemePlaylistModal({ +export function ThemePlaylistModal({ opened, handleClose, createPlaylist, @@ -127,5 +126,3 @@ function ThemePlaylistModal({ ); } - -export default ThemePlaylistModal; diff --git a/src/pages/settings/components/Theming/ThemePlaylists.tsx b/src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylists.tsx similarity index 97% rename from src/pages/settings/components/Theming/ThemePlaylists.tsx rename to src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylists.tsx index d8d0012..01cd669 100644 --- a/src/pages/settings/components/Theming/ThemePlaylists.tsx +++ b/src/pages/settings/components/Theming/ThemePlaylists/ThemePlaylists.tsx @@ -1,16 +1,15 @@ import { Box, Group, SimpleGrid, Stack, Text } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { NoItemsFound, SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { FiChevronRight } from 'react-icons/fi'; import { textClasses } from 'styles'; import type { Theme, ThemePlaylist } from 'types'; -import NoItemsFound from '../Shared/NoItemsFound'; -import SettingsHeader from '../Shared/SettingsHeader'; -import ThemePlaylistCard from './ThemePlaylistCard'; -import ThemePlaylistModal from './ThemePlaylistModal'; +import { ThemePlaylistCard } from './ThemePlaylistCard'; +import { ThemePlaylistModal } from './ThemePlaylistModal'; -function ThemePlaylists() { +export function ThemePlaylists() { const themesEndpoint = 'api/themes'; const { data: allThemeData } = useQueryAPI({ endpoint: themesEndpoint, @@ -303,5 +302,3 @@ function ThemePlaylists() { ); } - -export default ThemePlaylists; diff --git a/src/pages/settings/components/Theming/ThemePlaylists/index.ts b/src/pages/settings/components/Theming/ThemePlaylists/index.ts new file mode 100644 index 0000000..a932193 --- /dev/null +++ b/src/pages/settings/components/Theming/ThemePlaylists/index.ts @@ -0,0 +1,3 @@ +export { ThemePlaylistCard } from './ThemePlaylistCard'; +export { ThemePlaylistModal } from './ThemePlaylistModal'; +export { ThemePlaylists } from './ThemePlaylists'; diff --git a/src/pages/settings/components/Theming/Themes/ThemeCard.tsx b/src/pages/settings/components/Theming/Themes/ThemeCard.tsx new file mode 100644 index 0000000..f6f3df4 --- /dev/null +++ b/src/pages/settings/components/Theming/Themes/ThemeCard.tsx @@ -0,0 +1,205 @@ +import { Box, Button, Group, Overlay, Stack, Text } from '@mantine/core'; +import { + useDebouncedState, + useDisclosure, + useElementSize, + useHover, +} from '@mantine/hooks'; +import { DeleteItemModal } from 'components'; +import { useCommonHooks } from 'hooks'; +import { boxClasses } from 'styles'; +import type { Theme, ThemePlaylist } from 'types'; +import { ThemeManagementPill } from '.'; + +export function ThemeCard({ + cardTheme, + handleOpen, + allThemes, + themePlaylists, +}: { + cardTheme: Theme; + handleOpen: (cardTheme: Theme) => void; + allThemes: Theme[]; + themePlaylists: ThemePlaylist[]; +}) { + const { hovered, ref: hoverRef } = useHover(); + const { ref, width } = useElementSize(); + const [modalOpened, { open: openModal, close: closeModal }] = useDisclosure(false); + const { currentTheme, setCurrentTheme, setCurrentThemePlaylist, handleDelete } = + useCommonHooks(); + const [hoverPreview, setHoverPreview] = useDebouncedState(false, 1000); + return ( + + handleDelete(cardTheme, 'api/themes')} + title={'Delete Theme'} + body={ + + Are you sure you want to delete this theme? + {`"${cardTheme.name}"`} + This action cannot be undone! + + } + /> + + {cardTheme.name} + + + + + + + ); +} diff --git a/src/pages/settings/components/Theming/ThemeExampleApp.tsx b/src/pages/settings/components/Theming/Themes/ThemeExampleApp.tsx similarity index 92% rename from src/pages/settings/components/Theming/ThemeExampleApp.tsx rename to src/pages/settings/components/Theming/Themes/ThemeExampleApp.tsx index f36913b..ffa5f6b 100644 --- a/src/pages/settings/components/Theming/ThemeExampleApp.tsx +++ b/src/pages/settings/components/Theming/Themes/ThemeExampleApp.tsx @@ -4,7 +4,7 @@ import { FiCheck } from 'react-icons/fi'; import { boxClasses, textClasses } from 'styles'; import type { Theme } from 'types'; -function ExampleApp({ selectedTheme }: { selectedTheme: Theme }) { +export function ThemeExampleApp({ selectedTheme }: { selectedTheme: Theme }) { const [textDecoration, setTextDecoration] = useState('none'); return ( @@ -53,5 +53,3 @@ function ExampleApp({ selectedTheme }: { selectedTheme: Theme }) { ); } - -export default ExampleApp; diff --git a/src/pages/settings/components/Theming/Themes/ThemeManagementPill.tsx b/src/pages/settings/components/Theming/Themes/ThemeManagementPill.tsx new file mode 100644 index 0000000..1f0f965 --- /dev/null +++ b/src/pages/settings/components/Theming/Themes/ThemeManagementPill.tsx @@ -0,0 +1,227 @@ +import { ActionIcon, Group, isLightColor, Stack, Text } from '@mantine/core'; +import { useCommonHooks, useMutationAPI } from 'hooks'; +import { useState } from 'react'; +import { FaTrashAlt } from 'react-icons/fa'; +import { FaPencil } from 'react-icons/fa6'; +import { FiEdit, FiPower, FiShuffle } from 'react-icons/fi'; +import { actionIconClasses } from 'styles'; +import type { Theme, ThemePlaylist } from 'types'; + +export function ThemeManagementPill({ + allThemes, + cardTheme, + handleOpen, + themePlaylists, + openModal, + hovered, + setHoverPreview, +}: { + allThemes: Theme[]; + cardTheme: Theme; + handleOpen: (cardTheme: Theme) => void; + themePlaylists: ThemePlaylist[]; + openModal: () => void; + hovered: boolean; + setHoverPreview: (hoverPreview: boolean) => void; +}) { + const { currentTheme, currentThemePlaylist, handleThemeChange, theme } = + useCommonHooks(); + const [shiftEdit, setShiftEdit] = useState(0); + const [shiftShuffle, setShiftShuffle] = useState(0); + const { mutateAsync } = useMutationAPI(); + return ( + <> + {currentTheme === 'random' && cardTheme.name === theme.name ? ( + + { + setShiftEdit(2); + }} + onMouseLeave={() => { + setShiftEdit(0); + }} + onClick={() => { + handleOpen(cardTheme); + }} + gap={0} + style={{ + zIndex: 300, + position: 'absolute', + left: 0, + top: 27 - shiftEdit, + backgroundColor: + shiftEdit === 0 ? 'white' : 'var(--mantine-color-background-0)', + borderRadius: '50%', + padding: '.5rem', + margin: '.25rem', + border: 'solid 2px', + borderColor: shiftEdit === 0 ? 'black' : 'var(--mantine-color-primary-0)', + transition: 'all 0.2s', + }} + > + + + { + setShiftShuffle(2); + }} + onMouseLeave={() => { + setShiftShuffle(0); + }} + onClick={() => { + 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, + ); + } else { + const themeList = JSON.parse( + themePlaylists?.find( + (t: ThemePlaylist) => t?.name === currentThemePlaylist, + )?.themeList ?? '[]', + ); + const filteredThemes = allThemes.filter((t: Theme) => + themeList.includes(t.id), + ); + handleThemeChange(filteredThemes, false); + } + }} + gap={0} + style={{ + zIndex: 300, + position: 'absolute', + right: 0, + top: 27 - shiftShuffle, + backgroundColor: + shiftShuffle === 0 ? 'white' : 'var(--mantine-color-background-0)', + borderRadius: '50%', + padding: '.5rem', + margin: '.25rem', + border: 'solid 2px', + borderColor: + shiftShuffle === 0 ? 'black' : 'var(--mantine-color-primary-0)', + transition: 'all 0.2s', + }} + > + + + + ) : ( + <> + + {!cardTheme.randomEnabled && ( + + DISABLED + + )} + + + setHoverPreview(true)} + onMouseLeave={() => setHoverPreview(false)} + onClick={() => { + mutateAsync({ + method: 'PATCH', + endpoint: 'api/themes', + body: { ...cardTheme, randomEnabled: !cardTheme.randomEnabled }, + }); + }} + mb={'.125rem'} + > + + + handleOpen(cardTheme)} + mb={'.125rem'} + > + + + + + + + + )} + + ); +} diff --git a/src/pages/settings/components/Theming/ThemeMiniCard.tsx b/src/pages/settings/components/Theming/Themes/ThemeMiniCard.tsx similarity index 91% rename from src/pages/settings/components/Theming/ThemeMiniCard.tsx rename to src/pages/settings/components/Theming/Themes/ThemeMiniCard.tsx index 46819f4..3bb8bdb 100644 --- a/src/pages/settings/components/Theming/ThemeMiniCard.tsx +++ b/src/pages/settings/components/Theming/Themes/ThemeMiniCard.tsx @@ -1,7 +1,7 @@ import { Group, Text } from '@mantine/core'; import type { Theme } from 'types'; -function ThemeMiniCard({ miniTheme }: { miniTheme: Theme | undefined }) { +export function ThemeMiniCard({ miniTheme }: { miniTheme: Theme | undefined }) { return ( ); } - -export default ThemeMiniCard; diff --git a/src/pages/settings/components/Theming/ThemeModal.tsx b/src/pages/settings/components/Theming/Themes/ThemeModal.tsx similarity index 99% rename from src/pages/settings/components/Theming/ThemeModal.tsx rename to src/pages/settings/components/Theming/Themes/ThemeModal.tsx index 0e95e22..00bc402 100644 --- a/src/pages/settings/components/Theming/ThemeModal.tsx +++ b/src/pages/settings/components/Theming/Themes/ThemeModal.tsx @@ -19,9 +19,9 @@ import { useEffect, useRef, useState } from 'react'; import { FiImage, FiSave, FiX } from 'react-icons/fi'; import { modalClasses, scrollAreaClasses, textClasses, textInputClasses } from 'styles'; import type { Theme } from 'types'; -import ThemeModalContent from './ThemeModalContent'; +import { ThemeModalContent } from './ThemeModalContent'; -function ThemeModal({ +export function ThemeModal({ opened, handleClose, selectedTheme, @@ -547,5 +547,3 @@ function ThemeModal({ ); } - -export default ThemeModal; diff --git a/src/pages/settings/components/Theming/ThemeModalColorSwatches.tsx b/src/pages/settings/components/Theming/Themes/ThemeModalColorSwatches.tsx similarity index 97% rename from src/pages/settings/components/Theming/ThemeModalColorSwatches.tsx rename to src/pages/settings/components/Theming/Themes/ThemeModalColorSwatches.tsx index c31c637..77e38e3 100644 --- a/src/pages/settings/components/Theming/ThemeModalColorSwatches.tsx +++ b/src/pages/settings/components/Theming/Themes/ThemeModalColorSwatches.tsx @@ -2,7 +2,7 @@ import { ColorSwatch, Group, Stack, Text } from '@mantine/core'; import { colorSwatchClasses, textClasses } from 'styles'; import type { Theme } from 'types'; -function ThemeModalColorSwatches({ +export function ThemeModalColorSwatches({ selectedTheme, openPicker, setColorId, @@ -93,5 +93,3 @@ function ThemeModalColorSwatches({ ); } - -export default ThemeModalColorSwatches; diff --git a/src/pages/settings/components/Theming/ThemeModalContent.tsx b/src/pages/settings/components/Theming/Themes/ThemeModalContent.tsx similarity index 97% rename from src/pages/settings/components/Theming/ThemeModalContent.tsx rename to src/pages/settings/components/Theming/Themes/ThemeModalContent.tsx index 0dcdd77..e0ef9ea 100644 --- a/src/pages/settings/components/Theming/ThemeModalContent.tsx +++ b/src/pages/settings/components/Theming/Themes/ThemeModalContent.tsx @@ -2,9 +2,9 @@ import { Select, Stack, Text } from '@mantine/core'; import SearchSelectItem from 'pages/homepage/components/Search/SearchSelectItem'; import { selectClasses } from 'styles'; import type { Theme } from 'types'; -import ThemeExampleApp from './ThemeExampleApp'; +import { ThemeExampleApp } from './ThemeExampleApp'; -export default function ThemeModalContent({ selectedTheme }: { selectedTheme: Theme }) { +export function ThemeModalContent({ selectedTheme }: { selectedTheme: Theme }) { return ( ); } - -export default ThemePreviewMiddleware; diff --git a/src/pages/settings/components/Theming/ThemeSelect.tsx b/src/pages/settings/components/Theming/Themes/ThemeSelect.tsx similarity index 98% rename from src/pages/settings/components/Theming/ThemeSelect.tsx rename to src/pages/settings/components/Theming/Themes/ThemeSelect.tsx index fece27c..f65badb 100644 --- a/src/pages/settings/components/Theming/ThemeSelect.tsx +++ b/src/pages/settings/components/Theming/Themes/ThemeSelect.tsx @@ -7,7 +7,7 @@ import { } from '@mantine/core'; import type { Theme, ThemePlaylist } from 'types'; -function ThemeSelect({ +export function ThemeSelect({ allThemes, createPlaylist, themeList, @@ -124,5 +124,3 @@ function ThemeSelect({ ); } - -export default ThemeSelect; diff --git a/src/pages/settings/components/Theming/Themes.tsx b/src/pages/settings/components/Theming/Themes/Themes.tsx similarity index 97% rename from src/pages/settings/components/Theming/Themes.tsx rename to src/pages/settings/components/Theming/Themes/Themes.tsx index 6d1ed36..a96354a 100644 --- a/src/pages/settings/components/Theming/Themes.tsx +++ b/src/pages/settings/components/Theming/Themes/Themes.tsx @@ -1,5 +1,6 @@ import { Box, Button, Group, Overlay, Stack, Switch, Text, Tooltip } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { NoItemsFound, SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { FaDice } from 'react-icons/fa'; @@ -7,13 +8,11 @@ import { FiChevronRight, FiEdit, FiMousePointer, FiStopCircle } from 'react-icon import { useNavigate } from 'react-router-dom'; import { switchClasses, textClasses } from 'styles'; import type { Theme, ThemePlaylist } from 'types'; -import NoItemsFound from '../Shared/NoItemsFound'; -import SettingsHeader from '../Shared/SettingsHeader'; -import BackgroundModal from './BackgroundModal'; -import ThemeCard from './ThemeCard'; -import ThemeModal from './ThemeModal'; +import { BackgroundModal } from '../Backgrounds'; +import { ThemeCard } from './ThemeCard'; +import { ThemeModal } from './ThemeModal'; -function ThemesSettings() { +export function Themes() { const themesEndpoint = 'api/themes'; const backgroundsEndpoint = 'api/backgrounds'; const { data: allThemeData, isFetched: isAllThemeDataFetched } = useQueryAPI({ @@ -62,6 +61,7 @@ function ThemesSettings() { currentThemePlaylist, setCurrentThemePlaylist, } = useCommonHooks(); + const handleOpen = (theme: Theme) => { setSelectedTheme(theme); openThemeModal(); @@ -379,4 +379,3 @@ function ThemesSettings() { ); } -export default ThemesSettings; diff --git a/src/pages/settings/components/Theming/TimeOfDay.tsx b/src/pages/settings/components/Theming/Themes/TimeOfDay.tsx similarity index 92% rename from src/pages/settings/components/Theming/TimeOfDay.tsx rename to src/pages/settings/components/Theming/Themes/TimeOfDay.tsx index c1ebf49..8391b4f 100644 --- a/src/pages/settings/components/Theming/TimeOfDay.tsx +++ b/src/pages/settings/components/Theming/Themes/TimeOfDay.tsx @@ -1,8 +1,8 @@ import { Stack } from '@mantine/core'; import type { Theme, ThemePlaylist } from 'types'; -import ThemeSelect from './ThemeSelect'; +import { ThemeSelect } from './ThemeSelect'; -function TimeOfDay({ +export function TimeOfDay({ createPlaylist, themeList, allThemes, @@ -50,5 +50,3 @@ function TimeOfDay({ ); } - -export default TimeOfDay; diff --git a/src/pages/settings/components/Theming/Themes/index.ts b/src/pages/settings/components/Theming/Themes/index.ts new file mode 100644 index 0000000..900df18 --- /dev/null +++ b/src/pages/settings/components/Theming/Themes/index.ts @@ -0,0 +1,11 @@ +export { ThemeCard } from './ThemeCard'; +export { ThemeExampleApp } from './ThemeExampleApp'; +export { ThemeManagementPill } from './ThemeManagementPill'; +export { ThemeMiniCard } from './ThemeMiniCard'; +export { ThemeModal } from './ThemeModal'; +export { ThemeModalColorSwatches } from './ThemeModalColorSwatches'; +export { ThemeModalContent } from './ThemeModalContent'; +export { ThemePreviewMiddleware } from './ThemePreviewMiddleware'; +export { ThemeSelect } from './ThemeSelect'; +export { Themes } from './Themes'; +export { TimeOfDay } from './TimeOfDay'; diff --git a/src/pages/settings/components/WoL/DebouncedWolClient.tsx b/src/pages/settings/components/WoL/DebouncedWolClient.tsx index 7d9ffc5..fae61f8 100644 --- a/src/pages/settings/components/WoL/DebouncedWolClient.tsx +++ b/src/pages/settings/components/WoL/DebouncedWolClient.tsx @@ -1,11 +1,11 @@ import { ActionIcon, Card, Group, Stack, Text, TextInput, Tooltip } from '@mantine/core'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { DeleteItemModal } from 'components'; import { useCommonHooks, useMutationAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { FiTrash } from 'react-icons/fi'; import { cardClasses, textInputClasses } from 'styles'; import type { WolClient } from 'types'; -import DeleteItemModal from '../Shared/DeleteItemModal'; function DebouncedWolClient({ wolClient, diff --git a/src/pages/settings/components/WoL/WolClients.tsx b/src/pages/settings/components/WoL/WolClients.tsx index 6353d60..0b9d5a0 100644 --- a/src/pages/settings/components/WoL/WolClients.tsx +++ b/src/pages/settings/components/WoL/WolClients.tsx @@ -1,13 +1,11 @@ import { Button, Grid, GridCol, Group, Popover, Stack, TextInput } from '@mantine/core'; import { isNotEmpty, matches, useForm } from '@mantine/form'; import { useDebouncedValue, useDisclosure } from '@mantine/hooks'; +import { AddItemModal, NoItemsFound, SettingsHeader } from 'components'; import { useCommonHooks, useMutationAPI, useQueryAPI } from 'hooks'; import { useEffect, useState } from 'react'; import { popoverClasses, textInputClasses } from 'styles'; import type { WolClient } from 'types'; -import AddItemModal from '../Shared/AddItemModal'; -import NoItemsFound from '../Shared/NoItemsFound'; -import SettingsHeader from '../Shared/SettingsHeader'; import DebouncedWolClient from './DebouncedWolClient'; import WolClientSettingsItem from './WolClientSettingsItem'; diff --git a/src/styles/ActionIcon.module.css b/src/styles/ActionIcon.module.css index 8bde41b..8a3b977 100644 --- a/src/styles/ActionIcon.module.css +++ b/src/styles/ActionIcon.module.css @@ -11,26 +11,25 @@ .loader { display: none; } - :hover { - background-color: transparent !important; - color: var(--mantine-color-primary-0) !important; - } } } .themeEditButton { &.root { - background-color: white !important; + background-color: transparent; + border-radius: 100%; .icon { font-size: 1.5rem; } .loader { display: none; } - :hover { - background-color: var(--mantine-color-primary-0) !important; - color: var(--mantine-color-accent-0) !important; - } + + } + &:hover { + &.root { + background-color: white; + } } } diff --git a/src/styles/TextInput.module.css b/src/styles/TextInput.module.css index f62f5cb..92961d0 100644 --- a/src/styles/TextInput.module.css +++ b/src/styles/TextInput.module.css @@ -16,6 +16,10 @@ padding-left: .5rem; opacity: 1; } + ::placeholder { + color: var(--mantine-color-accent-0); + opacity: 50%; + } } } } @@ -57,7 +61,7 @@ opacity: 1; } ::placeholder { - color: var(--mantine-color-accent-0) !important; + color: var(--mantine-color-accent-0); opacity: 50%; } } diff --git a/src/types/bookmark.ts b/src/types/bookmark.ts index 4065047..4578610 100644 --- a/src/types/bookmark.ts +++ b/src/types/bookmark.ts @@ -4,4 +4,5 @@ export interface Bookmark { url: string; index: number; category: string; + enabled: number; }