Added thumbnails and updated background pages
This commit is contained in:
54
package-lock.json
generated
54
package-lock.json
generated
@@ -9,10 +9,10 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hello-pangea/dnd": "^18.0.1",
|
"@hello-pangea/dnd": "^18.0.1",
|
||||||
"@mantine/core": "^8.1.3",
|
"@mantine/core": "^8.2.1",
|
||||||
"@mantine/form": "^8.1.3",
|
"@mantine/form": "^8.2.1",
|
||||||
"@mantine/hooks": "^8.1.3",
|
"@mantine/hooks": "^8.2.1",
|
||||||
"@mantine/notifications": "^8.1.3",
|
"@mantine/notifications": "^8.2.1",
|
||||||
"@tanstack/react-query": "^5.83.0",
|
"@tanstack/react-query": "^5.83.0",
|
||||||
"@tanstack/react-query-devtools": "^5.83.0",
|
"@tanstack/react-query-devtools": "^5.83.0",
|
||||||
"@tanstack/react-query-persist-client": "^5.83.0",
|
"@tanstack/react-query-persist-client": "^5.83.0",
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"recharts": "^3.1.0"
|
"recharts": "^3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.0.14",
|
"@types/node": "^24.0.15",
|
||||||
"@types/react": "^19.1.8",
|
"@types/react": "^19.1.8",
|
||||||
"@types/react-dom": "^19.1.6",
|
"@types/react-dom": "^19.1.6",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
@@ -930,9 +930,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mantine/core": {
|
"node_modules/@mantine/core": {
|
||||||
"version": "8.1.3",
|
"version": "8.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mantine/core/-/core-8.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mantine/core/-/core-8.2.1.tgz",
|
||||||
"integrity": "sha512-2WOPC8GSN3MApet0MccSn6LaXRhcP6SVtZnbuHoqJ/atrfK7kLE66ILr4OXov7JAj1ASJ4Xk0bOXmu5fBExAvQ==",
|
"integrity": "sha512-KxvydotyFRdrRbqULUX2G35/GddPFju9XQUv/vdDWu1ytIWZViTguc+WSj1aBd0DtfRrSaofU5ezZISEXVrPBA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@floating-ui/react": "^0.26.28",
|
"@floating-ui/react": "^0.26.28",
|
||||||
@@ -943,15 +943,15 @@
|
|||||||
"type-fest": "^4.27.0"
|
"type-fest": "^4.27.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@mantine/hooks": "8.1.3",
|
"@mantine/hooks": "8.2.1",
|
||||||
"react": "^18.x || ^19.x",
|
"react": "^18.x || ^19.x",
|
||||||
"react-dom": "^18.x || ^19.x"
|
"react-dom": "^18.x || ^19.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mantine/form": {
|
"node_modules/@mantine/form": {
|
||||||
"version": "8.1.3",
|
"version": "8.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mantine/form/-/form-8.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mantine/form/-/form-8.2.1.tgz",
|
||||||
"integrity": "sha512-OoSVv2cyjKRZ+C4Rw63VsnO3qjKGZHJkd6DSJTVRQHXfDr10hxmC5yXgxGKsxGQ+xFd4ZCdtzPUU2BoWbHfZAA==",
|
"integrity": "sha512-XXGdO3IgTNcDl6lP7FIysEaH0rP6CfOGulxQA3ot+hHA8/JxmHWoWeoKOBE8I6QW7UYqaBxARxgBHLMcp8qASw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fast-deep-equal": "^3.1.3",
|
"fast-deep-equal": "^3.1.3",
|
||||||
@@ -962,34 +962,34 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mantine/hooks": {
|
"node_modules/@mantine/hooks": {
|
||||||
"version": "8.1.3",
|
"version": "8.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-8.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-8.2.1.tgz",
|
||||||
"integrity": "sha512-yL4SbyYjrkmtIhscswajNz9RL0iO2+V8CMtOi0KISch2rPNvTAJNumFuZaXgj4UHeDc0JQYSmcZ+EW8NGm7xcQ==",
|
"integrity": "sha512-gnRDk5FXCD9fa0AjlAj9otCsZL9QJzVrpYZk9KjOEoP5XR1TEE2F9/rGbajh1UVjPnD3jUlNLRJMH0YHTlA65A==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^18.x || ^19.x"
|
"react": "^18.x || ^19.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mantine/notifications": {
|
"node_modules/@mantine/notifications": {
|
||||||
"version": "8.1.3",
|
"version": "8.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-8.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-8.2.1.tgz",
|
||||||
"integrity": "sha512-Xy6f/l1yLTo77hz8X80sOuY+HW80e1rn8ucygx9TAexK5+XtyriOv26TQ3EJ6Ej5jlchtZRFEUJ4tJGRWjGCNg==",
|
"integrity": "sha512-9s4oN0ruX7AqUghZIXEwx9/t+fHATe/kvn5O5Zum+MFoOH46p8k4ljNb6BBDKTtT3clRHx7KHTR7OrLWlDEjrw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@mantine/store": "8.1.3",
|
"@mantine/store": "8.2.1",
|
||||||
"react-transition-group": "4.4.5"
|
"react-transition-group": "4.4.5"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@mantine/core": "8.1.3",
|
"@mantine/core": "8.2.1",
|
||||||
"@mantine/hooks": "8.1.3",
|
"@mantine/hooks": "8.2.1",
|
||||||
"react": "^18.x || ^19.x",
|
"react": "^18.x || ^19.x",
|
||||||
"react-dom": "^18.x || ^19.x"
|
"react-dom": "^18.x || ^19.x"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@mantine/store": {
|
"node_modules/@mantine/store": {
|
||||||
"version": "8.1.3",
|
"version": "8.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@mantine/store/-/store-8.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@mantine/store/-/store-8.2.1.tgz",
|
||||||
"integrity": "sha512-rO72LfSJqSNCwufqJxTWiHMyOR6sR3mqAcnBcw/f5aTvyOYoHZzlm4q4+TL8/2vYGRVsr9YM2Ez6HQ1vk/RR8g==",
|
"integrity": "sha512-4DAVJcI5Sa8Zez/23DV4eipYbqRfw7r+UkuWczPFyhAU+BZdfIql1gFipojAlR0FpWbB8aL0F7wFKNKfkZ0YCQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "^18.x || ^19.x"
|
"react": "^18.x || ^19.x"
|
||||||
@@ -1846,9 +1846,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "24.0.14",
|
"version": "24.0.15",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.14.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz",
|
||||||
"integrity": "sha512-4zXMWD91vBLGRtHK3YbIoFMia+1nqEz72coM42C5ETjnNCa/heoj7NT1G67iAfOqMmcfhuCZ4uNpyz8EjlAejw==",
|
"integrity": "sha512-oaeTSbCef7U/z7rDeJA138xpG3NuKc64/rZ2qmUFkFJmnMsAPaluIifqyWd8hSSMxyP9oie3dLAqYPblag9KgA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
10
package.json
10
package.json
@@ -11,10 +11,10 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hello-pangea/dnd": "^18.0.1",
|
"@hello-pangea/dnd": "^18.0.1",
|
||||||
"@mantine/core": "^8.1.3",
|
"@mantine/core": "^8.2.1",
|
||||||
"@mantine/form": "^8.1.3",
|
"@mantine/form": "^8.2.1",
|
||||||
"@mantine/hooks": "^8.1.3",
|
"@mantine/hooks": "^8.2.1",
|
||||||
"@mantine/notifications": "^8.1.3",
|
"@mantine/notifications": "^8.2.1",
|
||||||
"@tanstack/react-query": "^5.83.0",
|
"@tanstack/react-query": "^5.83.0",
|
||||||
"@tanstack/react-query-devtools": "^5.83.0",
|
"@tanstack/react-query-devtools": "^5.83.0",
|
||||||
"@tanstack/react-query-persist-client": "^5.83.0",
|
"@tanstack/react-query-persist-client": "^5.83.0",
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
"recharts": "^3.1.0"
|
"recharts": "^3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^24.0.14",
|
"@types/node": "^24.0.15",
|
||||||
"@types/react": "^19.1.8",
|
"@types/react": "^19.1.8",
|
||||||
"@types/react-dom": "^19.1.6",
|
"@types/react-dom": "^19.1.6",
|
||||||
"@vitejs/plugin-react": "^4.7.0",
|
"@vitejs/plugin-react": "^4.7.0",
|
||||||
|
|||||||
@@ -125,6 +125,48 @@ export function useCommonHooks() {
|
|||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getObjectDiff(original: any, current: any) {
|
||||||
|
const changes: any = {};
|
||||||
|
|
||||||
|
// Check current object's properties
|
||||||
|
for (const [key, value] of Object.entries(current)) {
|
||||||
|
if (!(key in original)) {
|
||||||
|
changes[key] = {
|
||||||
|
oldValue: undefined,
|
||||||
|
newValue: value,
|
||||||
|
};
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const originalValue = original[key];
|
||||||
|
const currentValue = value;
|
||||||
|
|
||||||
|
// Handle different types of comparisons
|
||||||
|
if (
|
||||||
|
originalValue !== currentValue &&
|
||||||
|
String(originalValue) !== String(currentValue) &&
|
||||||
|
JSON.stringify(originalValue) !== JSON.stringify(currentValue)
|
||||||
|
) {
|
||||||
|
changes[key] = {
|
||||||
|
oldValue: originalValue,
|
||||||
|
newValue: currentValue,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for removed properties
|
||||||
|
for (const key of Object.keys(original)) {
|
||||||
|
if (!(key in current)) {
|
||||||
|
changes[key] = {
|
||||||
|
oldValue: original[key],
|
||||||
|
newValue: undefined,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Object.keys(changes).length === 0 ? null : changes;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
isMobile,
|
isMobile,
|
||||||
theme,
|
theme,
|
||||||
@@ -132,6 +174,7 @@ export function useCommonHooks() {
|
|||||||
urlPattern,
|
urlPattern,
|
||||||
fixDigits,
|
fixDigits,
|
||||||
reorder,
|
reorder,
|
||||||
|
getObjectDiff,
|
||||||
handleThemeChange,
|
handleThemeChange,
|
||||||
handleDelete,
|
handleDelete,
|
||||||
themeName,
|
themeName,
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import { Group, Image, Modal, Text } from '@mantine/core';
|
||||||
|
|
||||||
|
export function BackgroundLightbox({
|
||||||
|
opened,
|
||||||
|
close,
|
||||||
|
background,
|
||||||
|
}: {
|
||||||
|
opened: boolean;
|
||||||
|
close: () => void;
|
||||||
|
background: string;
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Modal.Root opened={opened} onClose={close} size={'auto'} centered zIndex={250}>
|
||||||
|
<Group
|
||||||
|
px={'1rem'}
|
||||||
|
onClick={close}
|
||||||
|
w={'100%'}
|
||||||
|
pos={'absolute'}
|
||||||
|
top={'1rem'}
|
||||||
|
justify='space-between'
|
||||||
|
style={{ zIndex: 251 }}
|
||||||
|
>
|
||||||
|
<Text style={{ color: 'var(--mantine-color-primary-0)' }}>{background}</Text>
|
||||||
|
<Modal.CloseButton c={'red'} bg={'none'} />
|
||||||
|
</Group>
|
||||||
|
<Modal.Overlay opacity={0.1} />
|
||||||
|
<Modal.Content>
|
||||||
|
<Modal.Body p={'1rem'}>
|
||||||
|
<Image
|
||||||
|
style={{ cursor: 'zoom-out' }}
|
||||||
|
onClick={close}
|
||||||
|
src={`../../api/backgroundImages/${background}`}
|
||||||
|
/>
|
||||||
|
</Modal.Body>
|
||||||
|
</Modal.Content>
|
||||||
|
</Modal.Root>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
TextInput,
|
TextInput,
|
||||||
} from '@mantine/core';
|
} from '@mantine/core';
|
||||||
import { useDebouncedValue, useElementSize } from '@mantine/hooks';
|
import { useDebouncedValue, useDisclosure, useElementSize } from '@mantine/hooks';
|
||||||
import { useCommonHooks } from 'hooks';
|
import { useCommonHooks } from 'hooks';
|
||||||
import { useFileUploadAPI } from 'hooks/useAPI';
|
import { useFileUploadAPI } from 'hooks/useAPI';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
scrollAreaClasses,
|
scrollAreaClasses,
|
||||||
textInputClasses,
|
textInputClasses,
|
||||||
} from 'styles';
|
} from 'styles';
|
||||||
|
import { BackgroundLightbox } from './BackgroundLightbox';
|
||||||
import { DeleteBackground } from './DeleteBackground';
|
import { DeleteBackground } from './DeleteBackground';
|
||||||
import { EditBackground } from './EditBackground';
|
import { EditBackground } from './EditBackground';
|
||||||
|
|
||||||
@@ -38,7 +39,10 @@ export function BackgroundModal({
|
|||||||
backgroundList: string[];
|
backgroundList: string[];
|
||||||
inUseBackgrounds: string[];
|
inUseBackgrounds: string[];
|
||||||
}) {
|
}) {
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
|
const [lightboxName, setLightboxName] = useState<string>('');
|
||||||
const { ref, width } = useElementSize();
|
const { ref, width } = useElementSize();
|
||||||
|
const [hovered, setHovered] = useState<string>('');
|
||||||
const [background, setBackground] = useState<File | null>(null);
|
const [background, setBackground] = useState<File | null>(null);
|
||||||
const [fileName, setFileName] = useState<string>('');
|
const [fileName, setFileName] = useState<string>('');
|
||||||
const [newFileName, setNewFileName] = useState<string>('');
|
const [newFileName, setNewFileName] = useState<string>('');
|
||||||
@@ -64,6 +68,10 @@ export function BackgroundModal({
|
|||||||
}, [debouncedSearch]);
|
}, [debouncedSearch]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
<>
|
||||||
|
{opened && (
|
||||||
|
<BackgroundLightbox opened={opened} close={close} background={lightboxName} />
|
||||||
|
)}
|
||||||
<Modal.Root
|
<Modal.Root
|
||||||
size={'75%'}
|
size={'75%'}
|
||||||
className={modalClasses.editThemeModal}
|
className={modalClasses.editThemeModal}
|
||||||
@@ -79,13 +87,13 @@ export function BackgroundModal({
|
|||||||
}}
|
}}
|
||||||
fullScreen={isMobile}
|
fullScreen={isMobile}
|
||||||
centered
|
centered
|
||||||
keepMounted
|
keepMounted={false}
|
||||||
>
|
>
|
||||||
<Modal.Overlay />
|
<Modal.Overlay />
|
||||||
<Modal.Content>
|
<Modal.Content>
|
||||||
<Modal.Header style={{ justifyContent: 'center' }}>
|
<Modal.Header style={{ justifyContent: 'center' }}>
|
||||||
<Group pos={'absolute'}>
|
<Group pos={'absolute'}>
|
||||||
<Text fw={600} fz={'1.5rem'} c={'var(--mantine-color-primary-0)'}>
|
<Text fw={600} fz={'1.5rem'} c={'var(--mantine-color-background-0)'}>
|
||||||
Manage Backgrounds
|
Manage Backgrounds
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
@@ -194,18 +202,35 @@ export function BackgroundModal({
|
|||||||
.includes(debouncedSearch.toLocaleLowerCase()),
|
.includes(debouncedSearch.toLocaleLowerCase()),
|
||||||
)
|
)
|
||||||
.map((background) => (
|
.map((background) => (
|
||||||
<Group key={background} display={'flex'} pos={'relative'}>
|
<Group
|
||||||
|
onMouseEnter={() => {
|
||||||
|
setHovered(background);
|
||||||
|
}}
|
||||||
|
onMouseLeave={() => {
|
||||||
|
setHovered('');
|
||||||
|
}}
|
||||||
|
key={background}
|
||||||
|
display={'flex'}
|
||||||
|
pos={'relative'}
|
||||||
|
style={{
|
||||||
|
borderRadius: '.5rem',
|
||||||
|
backgroundColor:
|
||||||
|
hovered === background
|
||||||
|
? 'var(--mantine-color-search-0)'
|
||||||
|
: undefined,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Text
|
<Text
|
||||||
style={{
|
style={{
|
||||||
color: 'var(--mantine-color-primary-0)',
|
color: 'var(--mantine-color-background-0)',
|
||||||
backgroundColor: 'var(--mantine-color-accent-0)',
|
backgroundColor: 'var(--mantine-color-primary-0)',
|
||||||
padding: '.25rem',
|
padding: '.25rem',
|
||||||
borderRadius: '.5rem',
|
borderRadius: '.5rem',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: '-.5rem',
|
top: '-.25rem',
|
||||||
left: 0,
|
left: 0,
|
||||||
zIndex: 3,
|
zIndex: 3,
|
||||||
boxShadow: '2px -2px var(--mantine-color-primary-0)',
|
boxShadow: '2px 2px var(--mantine-color-accent-0)',
|
||||||
textOverflow: 'ellipsis',
|
textOverflow: 'ellipsis',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
whiteSpace: 'nowrap',
|
whiteSpace: 'nowrap',
|
||||||
@@ -219,12 +244,17 @@ export function BackgroundModal({
|
|||||||
style={{
|
style={{
|
||||||
aspectRatio: '16/9',
|
aspectRatio: '16/9',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
backgroundImage: `url(../../api/backgroundImages/${background})`,
|
backgroundImage: `url(../../api/backgroundImages/thumbs/${background})`,
|
||||||
backgroundSize: 'cover',
|
backgroundSize: 'cover',
|
||||||
backgroundPosition: 'center',
|
backgroundPosition: 'center',
|
||||||
backgroundRepeat: 'no-repeat',
|
backgroundRepeat: 'no-repeat',
|
||||||
padding: '2rem',
|
padding: '2rem',
|
||||||
margin: '1rem',
|
margin: '1rem',
|
||||||
|
cursor: 'zoom-in',
|
||||||
|
}}
|
||||||
|
onClick={() => {
|
||||||
|
setLightboxName(background);
|
||||||
|
open();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
@@ -344,9 +374,15 @@ export function BackgroundModal({
|
|||||||
disabled={!background}
|
disabled={!background}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (background) {
|
if (background) {
|
||||||
|
const extension = background.name.substring(
|
||||||
|
background.name.lastIndexOf('.'),
|
||||||
|
);
|
||||||
|
const validatedName = newFileName.endsWith(extension)
|
||||||
|
? newFileName
|
||||||
|
: `${newFileName}${extension}`;
|
||||||
const newBackground = new File(
|
const newBackground = new File(
|
||||||
[background],
|
[background],
|
||||||
newFileName || background.name,
|
validatedName || background.name,
|
||||||
{ type: background.type },
|
{ type: background.type },
|
||||||
);
|
);
|
||||||
fd.append('background', newBackground || '');
|
fd.append('background', newBackground || '');
|
||||||
@@ -385,5 +421,6 @@ export function BackgroundModal({
|
|||||||
</Modal.Body>
|
</Modal.Body>
|
||||||
</Modal.Content>
|
</Modal.Content>
|
||||||
</Modal.Root>
|
</Modal.Root>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export function DeleteBackground({
|
|||||||
style={{
|
style={{
|
||||||
aspectRatio: '16/9',
|
aspectRatio: '16/9',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
backgroundImage: `url(../../api/backgroundImages/${fileName})`,
|
backgroundImage: `url(../../api/backgroundImages/thumbs/${fileName})`,
|
||||||
backgroundSize: 'cover',
|
backgroundSize: 'cover',
|
||||||
backgroundPosition: 'center',
|
backgroundPosition: 'center',
|
||||||
backgroundRepeat: 'no-repeat',
|
backgroundRepeat: 'no-repeat',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Button, Card, Group, Stack, Text, TextInput } from '@mantine/core';
|
import { Button, Group, Image, Stack, Text, TextInput } from '@mantine/core';
|
||||||
import { useCommonHooks, useMutationAPI } from 'hooks';
|
import { useCommonHooks, useMutationAPI } from 'hooks';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { textInputClasses } from 'styles';
|
import { textInputClasses } from 'styles';
|
||||||
@@ -27,7 +27,6 @@ export function EditBackground({
|
|||||||
align='center'
|
align='center'
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '30rem',
|
|
||||||
backgroundColor: 'var(--mantine-color-search-0)',
|
backgroundColor: 'var(--mantine-color-search-0)',
|
||||||
padding: '1rem',
|
padding: '1rem',
|
||||||
borderRadius: '.5rem',
|
borderRadius: '.5rem',
|
||||||
@@ -42,7 +41,7 @@ export function EditBackground({
|
|||||||
Updating the name will update the associated themes.
|
Updating the name will update the associated themes.
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
<Group h={'100%'} mb={'1rem'}>
|
<Stack h={'100%'} mb={'1rem'}>
|
||||||
<TextInput
|
<TextInput
|
||||||
className={textInputClasses.settingsItem}
|
className={textInputClasses.settingsItem}
|
||||||
classNames={textInputClasses}
|
classNames={textInputClasses}
|
||||||
@@ -56,19 +55,8 @@ export function EditBackground({
|
|||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<Card
|
<Image src={`../../api/backgroundImages/thumbs/${fileName}`} />
|
||||||
style={{
|
</Stack>
|
||||||
aspectRatio: '16/9',
|
|
||||||
height: '100%',
|
|
||||||
backgroundImage: `url(../../api/backgroundImages/${fileName})`,
|
|
||||||
backgroundSize: 'cover',
|
|
||||||
backgroundPosition: 'center',
|
|
||||||
backgroundRepeat: 'no-repeat',
|
|
||||||
padding: '2rem',
|
|
||||||
margin: '1rem',
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</Group>
|
|
||||||
<Group>
|
<Group>
|
||||||
<Button
|
<Button
|
||||||
mt={'auto'}
|
mt={'auto'}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export function ThemeCard({
|
|||||||
style={{
|
style={{
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
cardTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
cardTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
? `linear-gradient(${cardTheme?.backgroundColor}33, ${cardTheme?.backgroundColor}33), url(../../api/backgroundImages/${cardTheme?.backgroundImage})`
|
? `linear-gradient(${cardTheme?.backgroundColor}33, ${cardTheme?.backgroundColor}33), url(../../api/backgroundImages/thumbs/${cardTheme?.backgroundImage})`
|
||||||
: undefined,
|
: undefined,
|
||||||
backgroundSize:
|
backgroundSize:
|
||||||
cardTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
cardTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export function ThemeMiniCard({ miniTheme }: { miniTheme: Theme | undefined }) {
|
|||||||
style={{
|
style={{
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
miniTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
miniTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
? `linear-gradient(${miniTheme?.backgroundColor}33, ${miniTheme?.backgroundColor}33), url(../../api/backgroundImages/${miniTheme?.backgroundImage})`
|
? `linear-gradient(${miniTheme?.backgroundColor}33, ${miniTheme?.backgroundColor}33), url(../../api/backgroundImages/thumbs/${miniTheme?.backgroundImage})`
|
||||||
: undefined,
|
: undefined,
|
||||||
backgroundSize:
|
backgroundSize:
|
||||||
miniTheme?.backgroundImage.toLocaleLowerCase() !== 'none' ? 'cover' : undefined,
|
miniTheme?.backgroundImage.toLocaleLowerCase() !== 'none' ? 'cover' : undefined,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
ColorPicker,
|
ColorPicker,
|
||||||
ColorSwatch,
|
ColorSwatch,
|
||||||
Group,
|
Group,
|
||||||
|
Image,
|
||||||
Modal,
|
Modal,
|
||||||
ScrollArea,
|
ScrollArea,
|
||||||
Stack,
|
Stack,
|
||||||
@@ -42,7 +43,7 @@ export function ThemeModal({
|
|||||||
closePicker: () => void;
|
closePicker: () => void;
|
||||||
handleSaveTheme: () => void;
|
handleSaveTheme: () => void;
|
||||||
}) {
|
}) {
|
||||||
const { isMobile, theme } = useCommonHooks();
|
const { isMobile, theme, getObjectDiff } = useCommonHooks();
|
||||||
const viewportRef = useRef<HTMLDivElement>(null);
|
const viewportRef = useRef<HTMLDivElement>(null);
|
||||||
const [query, setQuery] = useState('');
|
const [query, setQuery] = useState('');
|
||||||
const [hovered, setHovered] = useState(-1);
|
const [hovered, setHovered] = useState(-1);
|
||||||
@@ -71,8 +72,8 @@ export function ThemeModal({
|
|||||||
background:
|
background:
|
||||||
item !== 'none' && item !== 'None'
|
item !== 'none' && item !== 'None'
|
||||||
? index === hovered
|
? index === hovered
|
||||||
? `linear-gradient(${selectedTheme.backgroundColor}88, ${selectedTheme.backgroundColor}88), no-repeat center url(../../api/backgroundImages/${item})`
|
? `linear-gradient(${selectedTheme.backgroundColor}88, ${selectedTheme.backgroundColor}88), no-repeat center url(../../api/backgroundImages/thumbs/${item})`
|
||||||
: `no-repeat center url(../../api/backgroundImages/${item})`
|
: `no-repeat center url(../../api/backgroundImages/thumbs/${item})`
|
||||||
: 'repeating-linear-gradient(45deg, #33333366, #33333366 10px, #88888866 10px, #88888866 20px)',
|
: 'repeating-linear-gradient(45deg, #33333366, #33333366 10px, #88888866 10px, #88888866 20px)',
|
||||||
backgroundSize: item !== 'none' ? 'cover' : undefined,
|
backgroundSize: item !== 'none' ? 'cover' : undefined,
|
||||||
backgroundColor: item === 'none' ? '#00000088' : undefined,
|
backgroundColor: item === 'none' ? '#00000088' : undefined,
|
||||||
@@ -491,7 +492,8 @@ export function ThemeModal({
|
|||||||
</Stack>
|
</Stack>
|
||||||
)}
|
)}
|
||||||
{!pickerOpen && !backgroundPicker && (
|
{!pickerOpen && !backgroundPicker && (
|
||||||
<Stack h={'100%'} align='center' justify='center' gap={4}>
|
<Stack h={'100%'} justify='space-between' align='center' gap={4}>
|
||||||
|
<Stack w={'100%'} align='center' gap={4}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='Text Shadows'
|
label='Text Shadows'
|
||||||
checked={selectedTheme.textShadowsEnabled === 1}
|
checked={selectedTheme.textShadowsEnabled === 1}
|
||||||
@@ -501,6 +503,14 @@ export function ThemeModal({
|
|||||||
textShadowsEnabled: e.target.checked ? 1 : 0,
|
textShadowsEnabled: e.target.checked ? 1 : 0,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
styles={{
|
||||||
|
root: { width: '50%' },
|
||||||
|
body: {
|
||||||
|
width: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
label='App Shadows'
|
label='App Shadows'
|
||||||
@@ -511,7 +521,102 @@ export function ThemeModal({
|
|||||||
appShadowsEnabled: e.target.checked ? 1 : 0,
|
appShadowsEnabled: e.target.checked ? 1 : 0,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
styles={{
|
||||||
|
root: { width: '50%' },
|
||||||
|
body: {
|
||||||
|
width: '100%',
|
||||||
|
display: 'flex',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
},
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
</Stack>
|
||||||
|
{JSON.stringify(defaultTheme) !== JSON.stringify(selectedTheme) && (
|
||||||
|
<>
|
||||||
|
<Text fz={'1.5rem'}>Changes:</Text>
|
||||||
|
<ScrollArea.Autosize
|
||||||
|
w={'100%'}
|
||||||
|
className={scrollAreaClasses.default}
|
||||||
|
classNames={scrollAreaClasses}
|
||||||
|
style={{
|
||||||
|
backgroundColor: 'var(--mantine-color-accent-0)',
|
||||||
|
borderRadius: 8,
|
||||||
|
padding: '1rem',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Stack w={'100%'} gap={0}>
|
||||||
|
{getObjectDiff(defaultTheme, designerTheme) !== null &&
|
||||||
|
Object.keys(getObjectDiff(defaultTheme, designerTheme)).map(
|
||||||
|
(key: any) => {
|
||||||
|
return (
|
||||||
|
<Stack
|
||||||
|
w={'100%'}
|
||||||
|
align='center'
|
||||||
|
justify='center'
|
||||||
|
gap={0}
|
||||||
|
key={key}
|
||||||
|
>
|
||||||
|
<Text key={key}>{key}</Text>
|
||||||
|
{key === 'name' && (
|
||||||
|
<Group w={'100%'} justify='center'>
|
||||||
|
<Text>{defaultTheme[key as keyof Theme]}</Text>
|
||||||
|
<Text>→</Text>
|
||||||
|
<Text>{designerTheme[key as keyof Theme]}</Text>
|
||||||
|
</Group>
|
||||||
|
)}
|
||||||
|
{key === 'backgroundImage' && (
|
||||||
|
<Group w={'100%'} justify='center'>
|
||||||
|
<Image
|
||||||
|
w={'40%'}
|
||||||
|
src={`../../api/backgroundImages/thumbs/${defaultTheme[key as keyof Theme] as string}`}
|
||||||
|
alt='None'
|
||||||
|
/>
|
||||||
|
<Text>→</Text>
|
||||||
|
<Image
|
||||||
|
w={'40%'}
|
||||||
|
src={`../../api/backgroundImages/thumbs/${designerTheme[key as keyof Theme] as string}`}
|
||||||
|
alt='None'
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
)}
|
||||||
|
{key.includes('Color') && (
|
||||||
|
<Group w={'100%'} justify='center'>
|
||||||
|
<ColorSwatch
|
||||||
|
color={
|
||||||
|
defaultTheme[key as keyof Theme] as string
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<Text>→</Text>
|
||||||
|
<ColorSwatch
|
||||||
|
color={
|
||||||
|
designerTheme[key as keyof Theme] as string
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</Group>
|
||||||
|
)}
|
||||||
|
{key.includes('Shadow') && (
|
||||||
|
<Group w={'100%'} justify='center'>
|
||||||
|
{defaultTheme[key as keyof Theme] === 0 ? (
|
||||||
|
<Text>Off</Text>
|
||||||
|
) : (
|
||||||
|
<Text>On</Text>
|
||||||
|
)}
|
||||||
|
<Text>→</Text>
|
||||||
|
{designerTheme[key as keyof Theme] === 0 ? (
|
||||||
|
<Text>Off</Text>
|
||||||
|
) : (
|
||||||
|
<Text>On</Text>
|
||||||
|
)}
|
||||||
|
</Group>
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)}
|
||||||
|
</Stack>
|
||||||
|
</ScrollArea.Autosize>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<Button
|
<Button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setSelectedTheme({ ...defaultTheme });
|
setSelectedTheme({ ...defaultTheme });
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export function ThemeModalContent({ selectedTheme }: { selectedTheme: Theme }) {
|
|||||||
style={{
|
style={{
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
selectedTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
selectedTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
? `linear-gradient(${selectedTheme?.backgroundColor}33, ${selectedTheme?.backgroundColor}33), url(../../api/backgroundImages/${selectedTheme?.backgroundImage})`
|
? `linear-gradient(${selectedTheme?.backgroundColor}33, ${selectedTheme?.backgroundColor}33), url(../../api/backgroundImages/thumbs/${selectedTheme?.backgroundImage})`
|
||||||
: undefined,
|
: undefined,
|
||||||
backgroundSize:
|
backgroundSize:
|
||||||
selectedTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
selectedTheme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function ThemeSelect({
|
|||||||
color: theme?.primaryColor,
|
color: theme?.primaryColor,
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
theme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
theme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
? `linear-gradient(${theme?.backgroundColor}33, ${theme?.backgroundColor}33), url(../../api/backgroundImages/${theme?.backgroundImage})`
|
? `linear-gradient(${theme?.backgroundColor}33, ${theme?.backgroundColor}33), url(../../api/backgroundImages/thumbs/${theme?.backgroundImage})`
|
||||||
: undefined,
|
: undefined,
|
||||||
backgroundSize:
|
backgroundSize:
|
||||||
theme?.backgroundImage.toLocaleLowerCase() !== 'none' ? 'cover' : undefined,
|
theme?.backgroundImage.toLocaleLowerCase() !== 'none' ? 'cover' : undefined,
|
||||||
@@ -88,7 +88,7 @@ export function ThemeSelect({
|
|||||||
style={{
|
style={{
|
||||||
backgroundImage:
|
backgroundImage:
|
||||||
theme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
theme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
? `linear-gradient(${theme?.backgroundColor}33, ${theme?.backgroundColor}33), url(../../api/backgroundImages/${theme?.backgroundImage})`
|
? `linear-gradient(${theme?.backgroundColor}33, ${theme?.backgroundColor}33), url(../../api/backgroundImages/thumbs/${theme?.backgroundImage})`
|
||||||
: undefined,
|
: undefined,
|
||||||
backgroundSize:
|
backgroundSize:
|
||||||
theme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
theme?.backgroundImage.toLocaleLowerCase() !== 'none'
|
||||||
|
|||||||
Reference in New Issue
Block a user