Standardized
This commit is contained in:
33
src/App.tsx
33
src/App.tsx
@@ -28,16 +28,12 @@ function App() {
|
|||||||
endpoint: 'api/themes',
|
endpoint: 'api/themes',
|
||||||
});
|
});
|
||||||
const { theme, setTheme, themeName, handleThemeChange } = useCommonHooks();
|
const { theme, setTheme, themeName, handleThemeChange } = useCommonHooks();
|
||||||
useEffect(() => {
|
const overrides = createTheme({
|
||||||
if (allThemes && themeName) {
|
white: theme?.backgroundColor,
|
||||||
if (themeName !== 'random') {
|
fontFamily: '-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif',
|
||||||
const temp = allThemes.find((t: any) => t.name === themeName);
|
});
|
||||||
setTheme(temp);
|
const mantineTheme = mergeMantineTheme(DEFAULT_THEME, overrides);
|
||||||
} else {
|
|
||||||
handleThemeChange(allThemes, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [isAllThemesFetched, themeName]);
|
|
||||||
const router = createBrowserRouter(
|
const router = createBrowserRouter(
|
||||||
createRoutesFromElements(
|
createRoutesFromElements(
|
||||||
<Route>
|
<Route>
|
||||||
@@ -55,11 +51,18 @@ function App() {
|
|||||||
</Route>,
|
</Route>,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
const overrides = createTheme({
|
|
||||||
white: theme?.backgroundColor,
|
useEffect(() => {
|
||||||
fontFamily: '-apple-system,Jost,BlinkMacSystemFont,Helvetica Neue,Roboto,sans-serif',
|
if (allThemes && themeName) {
|
||||||
});
|
if (themeName !== 'random') {
|
||||||
const mantineTheme = mergeMantineTheme(DEFAULT_THEME, overrides);
|
const temp = allThemes.find((t: any) => t.name === themeName);
|
||||||
|
setTheme(temp);
|
||||||
|
} else {
|
||||||
|
handleThemeChange(allThemes, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [isAllThemesFetched, themeName]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{theme && (
|
{theme && (
|
||||||
|
|||||||
@@ -14,25 +14,27 @@ export function WeatherModal({
|
|||||||
closeWeatherModal,
|
closeWeatherModal,
|
||||||
weatherModalOpened,
|
weatherModalOpened,
|
||||||
}: any) {
|
}: any) {
|
||||||
const { data: personal, isFetched: personalIsFetched } = useQueryAPI({
|
const { data: personalData, isFetched: personalIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/personalData',
|
endpoint: 'api/personalData',
|
||||||
});
|
});
|
||||||
const [personalData, setPersonalData] = useState<any>([]);
|
|
||||||
const { data: hourly } = useWeatherAPI({
|
const { data: hourly } = useWeatherAPI({
|
||||||
endpoint: 'hourly',
|
endpoint: 'hourly',
|
||||||
office: points?.properties.gridId,
|
office: points?.properties.gridId,
|
||||||
x: points?.properties.gridX,
|
x: points?.properties.gridX,
|
||||||
y: points?.properties.gridY,
|
y: points?.properties.gridY,
|
||||||
});
|
});
|
||||||
useEffect(() => {
|
const [personal, setPersonal] = useState<any>([]);
|
||||||
if (personal && personalIsFetched) {
|
|
||||||
setPersonalData(personal);
|
|
||||||
}
|
|
||||||
}, [personal, personalIsFetched]);
|
|
||||||
const [hourlyForecast, setHourlyForecast] = useState<any>([]);
|
const [hourlyForecast, setHourlyForecast] = useState<any>([]);
|
||||||
const [sunset, setSunset] = useState(100);
|
const [sunset, setSunset] = useState(100);
|
||||||
const { theme, isMobile, setProviderLabel, setSearchValue, setProviderURL } =
|
const { theme, isMobile, setProviderLabel, setSearchValue, setProviderURL } =
|
||||||
useCommonHooks();
|
useCommonHooks();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (personalData && personalIsFetched) {
|
||||||
|
setPersonal(personalData);
|
||||||
|
}
|
||||||
|
}, [personalData, personalIsFetched]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hourly) {
|
if (hourly) {
|
||||||
setHourlyForecast(hourly.properties.periods.slice(1, 13));
|
setHourlyForecast(hourly.properties.periods.slice(1, 13));
|
||||||
@@ -51,6 +53,7 @@ export function WeatherModal({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [hourlyForecast]);
|
}, [hourlyForecast]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal.Root
|
<Modal.Root
|
||||||
fullScreen={isMobile}
|
fullScreen={isMobile}
|
||||||
@@ -84,7 +87,7 @@ export function WeatherModal({
|
|||||||
Weather Forecast for{' '}
|
Weather Forecast for{' '}
|
||||||
</Text>
|
</Text>
|
||||||
<Text fz={18} fw={600}>
|
<Text fz={18} fw={600}>
|
||||||
{personalData?.[0]?.physicalAddress}
|
{personal?.[0]?.physicalAddress}
|
||||||
</Text>
|
</Text>
|
||||||
</Group>
|
</Group>
|
||||||
</Modal.Title>
|
</Modal.Title>
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ export function useCommonHooks() {
|
|||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [providerLabel, setProviderLabel] = useState('Google Search');
|
const [providerLabel, setProviderLabel] = useState('Google Search');
|
||||||
const [providerURL, setProviderURL] = useState('https://www.google.com/search?q=');
|
const [providerURL, setProviderURL] = useState('https://www.google.com/search?q=');
|
||||||
|
|
||||||
const handleThemeChange = (themes: any, save: any) => {
|
const handleThemeChange = (themes: any, save: any) => {
|
||||||
const enabled = themes
|
const enabled = themes
|
||||||
.filter((t: any) => t.randomEnabled)
|
.filter((t: any) => t.randomEnabled)
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ export function Homepage() {
|
|||||||
const { data: personal, isFetched: personalIsFetched } = useQueryAPI({
|
const { data: personal, isFetched: personalIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/personalData',
|
endpoint: 'api/personalData',
|
||||||
});
|
});
|
||||||
const [personalData, setPersonalData] = useState<any>([]);
|
|
||||||
const {
|
const {
|
||||||
data: messageData,
|
data: messageData,
|
||||||
isFetching: isMessagesFetching,
|
isFetching: isMessagesFetching,
|
||||||
@@ -22,7 +21,21 @@ export function Homepage() {
|
|||||||
} = useQueryAPI({
|
} = useQueryAPI({
|
||||||
endpoint: 'api/messages',
|
endpoint: 'api/messages',
|
||||||
});
|
});
|
||||||
|
const [personalData, setPersonalData] = useState<any>([]);
|
||||||
const [messages, setMessages] = useState<any>([]);
|
const [messages, setMessages] = useState<any>([]);
|
||||||
|
const [displayedGreeting, setDisplayedGreeting] = useState('');
|
||||||
|
const [weatherModalOpened, { open: openWeatherModal, close: closeWeatherModal }] =
|
||||||
|
useDisclosure(false);
|
||||||
|
const { appFilter, bookmarkFilter, isMobile } = useCommonHooks();
|
||||||
|
const dateOptions: Intl.DateTimeFormatOptions = !isMobile
|
||||||
|
? {
|
||||||
|
weekday: 'long',
|
||||||
|
year: 'numeric',
|
||||||
|
month: 'long',
|
||||||
|
day: 'numeric',
|
||||||
|
}
|
||||||
|
: {};
|
||||||
|
const date = new Date().toLocaleDateString('en-US', dateOptions);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (messageData && isMessagesFetched) {
|
if (messageData && isMessagesFetched) {
|
||||||
@@ -34,21 +47,6 @@ export function Homepage() {
|
|||||||
setPersonalData(personal);
|
setPersonalData(personal);
|
||||||
}
|
}
|
||||||
}, [personal, personalIsFetched]);
|
}, [personal, personalIsFetched]);
|
||||||
const [displayedGreeting, setDisplayedGreeting] = useState('');
|
|
||||||
const { appFilter, bookmarkFilter, isMobile } = useCommonHooks();
|
|
||||||
|
|
||||||
const [weatherModalOpened, { open: openWeatherModal, close: closeWeatherModal }] =
|
|
||||||
useDisclosure(false);
|
|
||||||
|
|
||||||
const dateOptions: Intl.DateTimeFormatOptions = !isMobile
|
|
||||||
? {
|
|
||||||
weekday: 'long',
|
|
||||||
year: 'numeric',
|
|
||||||
month: 'long',
|
|
||||||
day: 'numeric',
|
|
||||||
}
|
|
||||||
: {};
|
|
||||||
const date = new Date().toLocaleDateString('en-US', dateOptions);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (messages && personalData) {
|
if (messages && personalData) {
|
||||||
|
|||||||
@@ -8,14 +8,15 @@ function Applications({ contentType }: any) {
|
|||||||
const { data: apps, isFetching: isAppsFetching } = useQueryAPI({
|
const { data: apps, isFetching: isAppsFetching } = useQueryAPI({
|
||||||
endpoint: 'api/apps',
|
endpoint: 'api/apps',
|
||||||
});
|
});
|
||||||
const { isMobile } = useCommonHooks();
|
|
||||||
const [applicationData, setApplicationData] = useState<any>([]);
|
const [applicationData, setApplicationData] = useState<any>([]);
|
||||||
|
const { isMobile } = useCommonHooks();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (apps && !isAppsFetching) {
|
if (apps && !isAppsFetching) {
|
||||||
setApplicationData(apps);
|
setApplicationData(apps);
|
||||||
}
|
}
|
||||||
}, [apps, isAppsFetching]);
|
}, [apps, isAppsFetching]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{applicationData.length > 0 && contentType.length > 0 && (
|
{applicationData.length > 0 && contentType.length > 0 && (
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ function Links({ contentType }: any) {
|
|||||||
endpoint: 'api/categories',
|
endpoint: 'api/categories',
|
||||||
});
|
});
|
||||||
const [bookmarkData, setBookmarkData] = useState<any>([]);
|
const [bookmarkData, setBookmarkData] = useState<any>([]);
|
||||||
|
|
||||||
const [groups, setGroups] = useState([]);
|
const [groups, setGroups] = useState([]);
|
||||||
|
const { isMobile } = useCommonHooks();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (linkData && linksIsFetched) {
|
if (linkData && linksIsFetched) {
|
||||||
setBookmarkData(linkData);
|
setBookmarkData(linkData);
|
||||||
@@ -28,7 +29,6 @@ function Links({ contentType }: any) {
|
|||||||
setGroups(groupList);
|
setGroups(groupList);
|
||||||
}
|
}
|
||||||
}, [groupData, groupsIsFetched]);
|
}, [groupData, groupsIsFetched]);
|
||||||
const { isMobile } = useCommonHooks();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -20,10 +20,10 @@ function Header({
|
|||||||
const { data: personal, isFetched: personalIsFetched } = useQueryAPI({
|
const { data: personal, isFetched: personalIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/personalData',
|
endpoint: 'api/personalData',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [personalData, setPersonalData] = useState<any>([]);
|
const [personalData, setPersonalData] = useState<any>([]);
|
||||||
const { isMobile } = useCommonHooks();
|
|
||||||
const [time, setTime] = useState(new Date());
|
const [time, setTime] = useState(new Date());
|
||||||
|
const { isMobile } = useCommonHooks();
|
||||||
|
|
||||||
function fixDigits(k: any) {
|
function fixDigits(k: any) {
|
||||||
if (k < 10) {
|
if (k < 10) {
|
||||||
return `0${k}`;
|
return `0${k}`;
|
||||||
@@ -68,6 +68,7 @@ function Header({
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [weather, basicWeather]);
|
}, [weather, basicWeather]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -16,15 +16,9 @@ export default function Search({
|
|||||||
const { data: providers, isFetched: providersIsFetched } = useQueryAPI({
|
const { data: providers, isFetched: providersIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/providers',
|
endpoint: 'api/providers',
|
||||||
});
|
});
|
||||||
|
|
||||||
const [providerData, setProviderData] = useState<any>([]);
|
const [providerData, setProviderData] = useState<any>([]);
|
||||||
|
const [providerModalOpened, { open: openProviderModal, close: closeProviderModal }] =
|
||||||
useEffect(() => {
|
useDisclosure(false);
|
||||||
if (providers && providersIsFetched) {
|
|
||||||
setProviderData(providers);
|
|
||||||
}
|
|
||||||
}, [providers, providersIsFetched]);
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
providerLabel,
|
providerLabel,
|
||||||
setProviderLabel,
|
setProviderLabel,
|
||||||
@@ -34,9 +28,6 @@ export default function Search({
|
|||||||
setSearchValue,
|
setSearchValue,
|
||||||
} = useCommonHooks();
|
} = useCommonHooks();
|
||||||
|
|
||||||
const [providerModalOpened, { open: openProviderModal, close: closeProviderModal }] =
|
|
||||||
useDisclosure(false);
|
|
||||||
|
|
||||||
const handleKeyPress = (item: any) => {
|
const handleKeyPress = (item: any) => {
|
||||||
let option = '';
|
let option = '';
|
||||||
let subtext = '';
|
let subtext = '';
|
||||||
@@ -78,6 +69,12 @@ export default function Search({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (providers && providersIsFetched) {
|
||||||
|
setProviderData(providers);
|
||||||
|
}
|
||||||
|
}, [providers, providersIsFetched]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -34,10 +34,14 @@ function SettingsButton() {
|
|||||||
const { data: allThemes, isFetched: isAllThemesFetched } = useQueryAPI({
|
const { data: allThemes, isFetched: isAllThemesFetched } = useQueryAPI({
|
||||||
endpoint: 'api/themes',
|
endpoint: 'api/themes',
|
||||||
});
|
});
|
||||||
const [allThemeData, setAllThemeData] = useState<any>([]);
|
|
||||||
const { mutateAsync: wakeRequest } = useMutationAPI();
|
const { mutateAsync: wakeRequest } = useMutationAPI();
|
||||||
|
const [allThemeData, setAllThemeData] = useState<any>([]);
|
||||||
const [categories, setCategories] = useState([{ value: 'All', label: 'All' }]);
|
const [categories, setCategories] = useState([{ value: 'All', label: 'All' }]);
|
||||||
|
const [selectedClient, setSelectedClient] = useState<any>(wolClients?.[0]);
|
||||||
|
const [overlayOpened, setOverlayOpened] = useState(false);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
const notify = (notification: any) => toast(notification, { position: 'bottom-right' });
|
||||||
const {
|
const {
|
||||||
currentTheme,
|
currentTheme,
|
||||||
setCurrentTheme,
|
setCurrentTheme,
|
||||||
@@ -50,10 +54,6 @@ function SettingsButton() {
|
|||||||
isMobile,
|
isMobile,
|
||||||
} = useCommonHooks();
|
} = useCommonHooks();
|
||||||
|
|
||||||
const notify = (notification: any) => toast(notification, { position: 'bottom-right' });
|
|
||||||
|
|
||||||
const [selectedClient, setSelectedClient] = useState<any>(wolClients?.[0]);
|
|
||||||
const [overlayOpened, setOverlayOpened] = useState(false);
|
|
||||||
const handleWakeRequest = () => {
|
const handleWakeRequest = () => {
|
||||||
wakeRequest({
|
wakeRequest({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import WolClients from './components/WolClients';
|
|||||||
export function Settings() {
|
export function Settings() {
|
||||||
const { isMobile } = useCommonHooks();
|
const { isMobile } = useCommonHooks();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack px={'2rem'}>
|
<Stack px={'2rem'}>
|
||||||
<Group gap={0}>
|
<Group gap={0}>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const ApplicationSettings = () => {
|
|||||||
isFetching: isAppsFetching,
|
isFetching: isAppsFetching,
|
||||||
isLoading: isAppsLoading,
|
isLoading: isAppsLoading,
|
||||||
} = useQueryAPI({
|
} = useQueryAPI({
|
||||||
endpoint: 'api/apps',
|
endpoint: endpoint,
|
||||||
});
|
});
|
||||||
const [applicationData, setApplicationData] = useState<any>([]);
|
const [applicationData, setApplicationData] = useState<any>([]);
|
||||||
|
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ const BookmarkSettings = () => {
|
|||||||
isFetching: linksIsFetching,
|
isFetching: linksIsFetching,
|
||||||
isLoading: linksIsLoading,
|
isLoading: linksIsLoading,
|
||||||
} = useQueryAPI({
|
} = useQueryAPI({
|
||||||
endpoint: 'api/links',
|
endpoint: endpoint,
|
||||||
});
|
});
|
||||||
const { data: groupData, isFetched: groupsIsFetched } = useQueryAPI({
|
const { data: groupData, isFetched: groupsIsFetched } = useQueryAPI({
|
||||||
endpoint: 'api/categories',
|
endpoint: 'api/categories',
|
||||||
});
|
});
|
||||||
const [bookmarkData, setBookmarkData] = useState<any>([]);
|
const [bookmarkData, setBookmarkData] = useState<any>([]);
|
||||||
|
|
||||||
const [groups, setGroups] = useState([]);
|
const [groups, setGroups] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (linkData && linksIsFetched) {
|
if (linkData && linksIsFetched) {
|
||||||
setBookmarkData(linkData);
|
setBookmarkData(linkData);
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ const CategorySettings = () => {
|
|||||||
} = useQueryAPI({
|
} = useQueryAPI({
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [groups, setGroups] = useState([]);
|
const [groups, setGroups] = useState([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -24,6 +23,7 @@ const CategorySettings = () => {
|
|||||||
setGroups(groupList);
|
setGroups(groupList);
|
||||||
}
|
}
|
||||||
}, [groupData, groupsIsFetched]);
|
}, [groupData, groupsIsFetched]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ const MessageSettings = () => {
|
|||||||
setMessages(messageData);
|
setMessages(messageData);
|
||||||
}
|
}
|
||||||
}, [messageData, isMessagesFetched]);
|
}, [messageData, isMessagesFetched]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack>
|
<Stack>
|
||||||
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ const PersonalizationSettings = () => {
|
|||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
});
|
});
|
||||||
const [personal, setPersonal] = useState<any>([]);
|
const [personal, setPersonal] = useState<any>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (personalData && personalIsFetched) {
|
if (personalData && personalIsFetched) {
|
||||||
setPersonal(personalData);
|
setPersonal(personalData);
|
||||||
}
|
}
|
||||||
}, [personalData, personalIsFetched]);
|
}, [personalData, personalIsFetched]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
<Text className={textClasses.settingsSubTitle} classNames={textClasses}>
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ const SearchProviderSettings = () => {
|
|||||||
} = useQueryAPI({
|
} = useQueryAPI({
|
||||||
endpoint: endpoint,
|
endpoint: endpoint,
|
||||||
});
|
});
|
||||||
|
|
||||||
const [providerData, setProviderData] = useState<any>([]);
|
const [providerData, setProviderData] = useState<any>([]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ function ThemeCard({
|
|||||||
const [hover, setHover] = useState(false);
|
const [hover, setHover] = useState(false);
|
||||||
const [shift, setShift] = useState<number>(0);
|
const [shift, setShift] = useState<number>(0);
|
||||||
const { handleThemeChange, currentTheme, setCurrentTheme, theme } = useCommonHooks();
|
const { handleThemeChange, currentTheme, setCurrentTheme, theme } = useCommonHooks();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Group
|
<Group
|
||||||
gap={0}
|
gap={0}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ function ThemeModal({
|
|||||||
handleSaveTheme,
|
handleSaveTheme,
|
||||||
}: any) {
|
}: any) {
|
||||||
const { theme } = useCommonHooks();
|
const { theme } = useCommonHooks();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal.Root
|
<Modal.Root
|
||||||
size={'50%'}
|
size={'50%'}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { stackClasses } from 'styles';
|
|||||||
export default function ThemeModalContent({ selectedTheme }: any) {
|
export default function ThemeModalContent({ selectedTheme }: any) {
|
||||||
const ExampleApp = (previewTheme: any) => {
|
const ExampleApp = (previewTheme: any) => {
|
||||||
const [textDecoration, setTextDecoration] = useState<string>('none');
|
const [textDecoration, setTextDecoration] = useState<string>('none');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
component='a'
|
component='a'
|
||||||
@@ -69,6 +70,7 @@ export default function ThemeModalContent({ selectedTheme }: any) {
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack
|
<Stack
|
||||||
style={{
|
style={{
|
||||||
|
|||||||
@@ -16,23 +16,15 @@ function ThemesSettings() {
|
|||||||
const { data: backgroundData, isFetched: isBackgroundFetched } = useQueryAPI({
|
const { data: backgroundData, isFetched: isBackgroundFetched } = useQueryAPI({
|
||||||
endpoint: 'api/backgrounds',
|
endpoint: 'api/backgrounds',
|
||||||
});
|
});
|
||||||
const [opened, { open, close }] = useDisclosure(false);
|
|
||||||
const [pickerOpen, { open: openPicker, close: closePicker }] = useDisclosure(false);
|
|
||||||
const [colorId, setColorId] = useState<string>('');
|
|
||||||
const [colorValue, setColorValue] = useState('#000000');
|
|
||||||
|
|
||||||
const [backgroundList, setBackgroundList] = useState<any>(['None']);
|
|
||||||
const [selectedTheme, setSelectedTheme] = useState<any>({});
|
|
||||||
const { mutateAsync: createTheme } = useMutationAPI();
|
const { mutateAsync: createTheme } = useMutationAPI();
|
||||||
const { mutateAsync: deleteTheme } = useMutationAPI();
|
const { mutateAsync: deleteTheme } = useMutationAPI();
|
||||||
|
const [opened, { open, close }] = useDisclosure(false);
|
||||||
const { currentTheme, setCurrentTheme, isMobile, theme } = useCommonHooks();
|
const [colorId, setColorId] = useState<string>('');
|
||||||
|
const [colorValue, setColorValue] = useState('#000000');
|
||||||
useEffect(() => {
|
const [backgroundList, setBackgroundList] = useState<any>(['None']);
|
||||||
if (backgroundData && isBackgroundFetched) {
|
const [selectedTheme, setSelectedTheme] = useState<any>({});
|
||||||
setBackgroundList(['None', ...backgroundData]);
|
const [pickerOpen, { open: openPicker, close: closePicker }] = useDisclosure(false);
|
||||||
}
|
const { currentTheme, setCurrentTheme, theme } = useCommonHooks();
|
||||||
}, [backgroundData, isBackgroundFetched]);
|
|
||||||
|
|
||||||
const handleOpen = (theme: any) => {
|
const handleOpen = (theme: any) => {
|
||||||
setSelectedTheme(theme);
|
setSelectedTheme(theme);
|
||||||
@@ -66,6 +58,12 @@ function ThemesSettings() {
|
|||||||
openDeleteConfirmModal(theme);
|
openDeleteConfirmModal(theme);
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (backgroundData && isBackgroundFetched) {
|
||||||
|
setBackgroundList(['None', ...backgroundData]);
|
||||||
|
}
|
||||||
|
}, [backgroundData, isBackgroundFetched]);
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ThemeModal
|
<ThemeModal
|
||||||
|
|||||||
Reference in New Issue
Block a user