@admin-layout/tailwind-design-pro 12.0.16-alpha.6 → 12.0.16-alpha.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -0
- package/lib/cdm-locales/en/menu.json +2 -1
- package/lib/cdm-locales/es/menu.json +2 -1
- package/lib/cdm-locales/index.d.ts +2 -0
- package/lib/cdm-locales/index.d.ts.map +1 -0
- package/lib/cdm-locales/index.ts +1 -0
- package/lib/components/LanguageMenu/LanguageMenu.js.map +1 -1
- package/lib/components/Layout/BasicLayout/index.d.ts +2 -1
- package/lib/components/Layout/BasicLayout/index.d.ts.map +1 -1
- package/lib/components/Layout/BasicLayout/index.js +120 -43
- package/lib/components/Layout/BasicLayout/index.js.map +1 -1
- package/lib/components/Layout/BasicLayout/utils.d.ts +2 -0
- package/lib/components/Layout/BasicLayout/utils.d.ts.map +1 -1
- package/lib/components/Layout/BasicLayout/utils.js +16 -13
- package/lib/components/Layout/BasicLayout/utils.js.map +1 -1
- package/lib/components/Layout/GlobalFooter/Account.d.ts +4 -0
- package/lib/components/Layout/GlobalFooter/Account.d.ts.map +1 -0
- package/lib/components/Layout/GlobalFooter/Account.js +147 -0
- package/lib/components/Layout/GlobalFooter/Account.js.map +1 -0
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.d.ts.map +1 -1
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.js +7 -12
- package/lib/components/Layout/GlobalFooter/BottomMenuDropdown.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/Header.d.ts.map +1 -1
- package/lib/components/Layout/GlobalHeader/Header.js +32 -9
- package/lib/components/Layout/GlobalHeader/Header.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/MainHeader.d.ts +0 -2
- package/lib/components/Layout/GlobalHeader/MainHeader.d.ts.map +1 -1
- package/lib/components/Layout/GlobalHeader/MainHeader.js +32 -84
- package/lib/components/Layout/GlobalHeader/MainHeader.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/OrganizationDropdown.js +1 -1
- package/lib/components/Layout/GlobalHeader/OrganizationDropdown.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/RightContent.d.ts +1 -0
- package/lib/components/Layout/GlobalHeader/RightContent.d.ts.map +1 -1
- package/lib/components/Layout/GlobalHeader/RightContent.js +73 -6
- package/lib/components/Layout/GlobalHeader/RightContent.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/RightMenu.d.ts.map +1 -1
- package/lib/components/Layout/GlobalHeader/RightMenu.js +2 -4
- package/lib/components/Layout/GlobalHeader/RightMenu.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/SearchBar.js.map +1 -1
- package/lib/components/Layout/GlobalHeader/index.d.ts +0 -1
- package/lib/components/Layout/GlobalHeader/index.d.ts.map +1 -1
- package/lib/components/Layout/ProTailwindLayout.d.ts +2 -2
- package/lib/components/Layout/ProTailwindLayout.d.ts.map +1 -1
- package/lib/components/Layout/ProTailwindLayout.js +69 -7
- package/lib/components/Layout/ProTailwindLayout.js.map +1 -1
- package/lib/components/Layout/Sidebar/Divider.js.map +1 -1
- package/lib/components/Layout/Sidebar/DynamicIcon.js.map +1 -1
- package/lib/components/Layout/Sidebar/MainSidebar.d.ts +5 -0
- package/lib/components/Layout/Sidebar/MainSidebar.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/{Sidebar.js → MainSidebar.js} +37 -9
- package/lib/components/Layout/Sidebar/MainSidebar.js.map +1 -0
- package/lib/components/Layout/Sidebar/MainSidebarMenu.d.ts +4 -0
- package/lib/components/Layout/Sidebar/MainSidebarMenu.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/MainSidebarMenu.js +294 -0
- package/lib/components/Layout/Sidebar/MainSidebarMenu.js.map +1 -0
- package/lib/components/Layout/Sidebar/PerplexSidebar.d.ts +5 -0
- package/lib/components/Layout/Sidebar/PerplexSidebar.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/PerplexSidebar.js +192 -0
- package/lib/components/Layout/Sidebar/PerplexSidebar.js.map +1 -0
- package/lib/components/Layout/Sidebar/PerplexSidebarMenu.d.ts +4 -0
- package/lib/components/Layout/Sidebar/PerplexSidebarMenu.d.ts.map +1 -0
- package/lib/components/Layout/Sidebar/PerplexSidebarMenu.js +330 -0
- package/lib/components/Layout/Sidebar/PerplexSidebarMenu.js.map +1 -0
- package/lib/components/Layout/TailwindLayout.d.ts.map +1 -1
- package/lib/components/Layout/TailwindLayout.js +78 -15
- package/lib/components/Layout/TailwindLayout.js.map +1 -1
- package/lib/components/Layout/getPageTitle.js.map +1 -1
- package/lib/components/Layout/slot-fill/AdditionalSettings.js.map +1 -1
- package/lib/components/Layout/slot-fill/Footer.js.map +1 -1
- package/lib/components/Layout/slot-fill/HeaderSearchBar.js.map +1 -1
- package/lib/components/Layout/slot-fill/HeaderSearchButton.js.map +1 -1
- package/lib/components/Layout/slot-fill/Logo.d.ts +4 -0
- package/lib/components/Layout/slot-fill/Logo.d.ts.map +1 -0
- package/lib/components/Layout/slot-fill/Logo.js +7 -0
- package/lib/components/Layout/slot-fill/Logo.js.map +1 -0
- package/lib/components/Layout/slot-fill/RightContent.js.map +1 -1
- package/lib/components/Layout/util.js +1 -1
- package/lib/components/Layout/util.js.map +1 -1
- package/lib/components/SettingDrawer/CheckBoxTheme.d.ts.map +1 -1
- package/lib/components/SettingDrawer/CheckBoxTheme.js +13 -3
- package/lib/components/SettingDrawer/CheckBoxTheme.js.map +1 -1
- package/lib/components/SettingDrawer/InvitationSettings.d.ts.map +1 -1
- package/lib/components/SettingDrawer/InvitationSettings.js +10 -6
- package/lib/components/SettingDrawer/InvitationSettings.js.map +1 -1
- package/lib/components/SettingDrawer/LayoutChange.d.ts.map +1 -1
- package/lib/components/SettingDrawer/LayoutChange.js +23 -16
- package/lib/components/SettingDrawer/LayoutChange.js.map +1 -1
- package/lib/components/SettingDrawer/MenuVisibilitySettings.d.ts +20 -0
- package/lib/components/SettingDrawer/MenuVisibilitySettings.d.ts.map +1 -0
- package/lib/components/SettingDrawer/MenuVisibilitySettings.js +120 -0
- package/lib/components/SettingDrawer/MenuVisibilitySettings.js.map +1 -0
- package/lib/components/SettingDrawer/NavigationsModes.d.ts +1 -1
- package/lib/components/SettingDrawer/NavigationsModes.d.ts.map +1 -1
- package/lib/components/SettingDrawer/NavigationsModes.js +103 -15
- package/lib/components/SettingDrawer/NavigationsModes.js.map +1 -1
- package/lib/components/SettingDrawer/RegionalSettings.d.ts.map +1 -1
- package/lib/components/SettingDrawer/RegionalSettings.js +54 -177
- package/lib/components/SettingDrawer/RegionalSettings.js.map +1 -1
- package/lib/components/SettingDrawer/SettingDrawer.d.ts.map +1 -1
- package/lib/components/SettingDrawer/SettingDrawer.js +423 -62
- package/lib/components/SettingDrawer/SettingDrawer.js.map +1 -1
- package/lib/components/SettingDrawer/Switch/index.js.map +1 -1
- package/lib/components/SettingDrawer/ThemeColor.d.ts.map +1 -1
- package/lib/components/SettingDrawer/ThemeColor.js +15 -3
- package/lib/components/SettingDrawer/ThemeColor.js.map +1 -1
- package/lib/components/SettingDrawer/types.d.ts +12 -0
- package/lib/components/SettingDrawer/types.d.ts.map +1 -1
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts +8 -5
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.d.ts.map +1 -1
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js +239 -4
- package/lib/components/UpdateSettingsResource/UpdateSettingsResource.server.js.map +1 -1
- package/lib/components/index.d.ts +0 -1
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/typings.d.ts +14 -6
- package/lib/components/typings.d.ts.map +1 -1
- package/lib/compute.d.ts.map +1 -1
- package/lib/compute.js +10 -2
- package/lib/compute.js.map +1 -1
- package/lib/config/analytics-config.js +9 -0
- package/lib/config/analytics-config.js.map +1 -0
- package/lib/config/constants.js.map +1 -1
- package/lib/config/env-config.d.ts +3 -0
- package/lib/config/env-config.d.ts.map +1 -1
- package/lib/config/env-config.js +10 -0
- package/lib/config/env-config.js.map +1 -1
- package/lib/helpers/DynamicIcon.js.map +1 -1
- package/lib/hooks/index.d.ts +0 -3
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/useMediaQuery.js.map +1 -1
- package/lib/hooks/useScrollThreshold.js.map +1 -1
- package/lib/hooks/useTailwindTheme.js.map +1 -1
- package/lib/icons.d.ts +2 -0
- package/lib/icons.d.ts.map +1 -1
- package/lib/icons.js +4 -2
- package/lib/icons.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/machines/selectors.d.ts +118 -0
- package/lib/machines/selectors.d.ts.map +1 -0
- package/lib/machines/settingsMachine.d.ts +25 -2
- package/lib/machines/settingsMachine.d.ts.map +1 -1
- package/lib/machines/settingsMachine.js +217 -161
- package/lib/machines/settingsMachine.js.map +1 -1
- package/lib/machines/settingsMachine.test.d.ts +2 -0
- package/lib/machines/settingsMachine.test.d.ts.map +1 -0
- package/lib/machines/types.d.ts +106 -9
- package/lib/machines/types.d.ts.map +1 -1
- package/lib/machines/types.js.map +1 -1
- package/lib/module.js.map +1 -1
- package/lib/redux/searchReducer.js.map +1 -1
- package/lib/routes.json +9 -1
- package/lib/tailwindConfig.js.map +1 -1
- package/lib/utils/__tests__/configOverrides.test.d.ts +2 -0
- package/lib/utils/__tests__/configOverrides.test.d.ts.map +1 -0
- package/lib/utils/configOverrides.d.ts +213 -0
- package/lib/utils/configOverrides.d.ts.map +1 -0
- package/lib/utils/configOverrides.js +91 -0
- package/lib/utils/configOverrides.js.map +1 -0
- package/lib/utils/isBrowser/index.js.map +1 -1
- package/lib/utils/settingsUtils.d.ts +20 -0
- package/lib/utils/settingsUtils.d.ts.map +1 -0
- package/lib/utils/settingsUtils.js +74 -0
- package/lib/utils/settingsUtils.js.map +1 -0
- package/lib/utils/utils/index.js.map +1 -1
- package/package.json +6 -16
- package/lib/components/Layout/GlobalHeader/Logo.d.ts +0 -4
- package/lib/components/Layout/GlobalHeader/Logo.d.ts.map +0 -1
- package/lib/components/Layout/GlobalHeader/Logo.js +0 -141
- package/lib/components/Layout/GlobalHeader/Logo.js.map +0 -1
- package/lib/components/Layout/Sidebar/Sidebar.d.ts +0 -5
- package/lib/components/Layout/Sidebar/Sidebar.d.ts.map +0 -1
- package/lib/components/Layout/Sidebar/Sidebar.js.map +0 -1
- package/lib/components/Layout/Sidebar/SidebarMenu.d.ts +0 -4
- package/lib/components/Layout/Sidebar/SidebarMenu.d.ts.map +0 -1
- package/lib/components/Layout/Sidebar/SidebarMenu.js +0 -176
- package/lib/components/Layout/Sidebar/SidebarMenu.js.map +0 -1
- package/lib/components/UI/CardList.d.ts +0 -61
- package/lib/components/UI/CardList.d.ts.map +0 -1
- package/lib/components/UI/CardList.js +0 -43
- package/lib/components/UI/CardList.js.map +0 -1
- package/lib/components/UI/CategoriesTypeList.d.ts +0 -29
- package/lib/components/UI/CategoriesTypeList.d.ts.map +0 -1
- package/lib/components/UI/CategoriesTypeList.js +0 -139
- package/lib/components/UI/CategoriesTypeList.js.map +0 -1
- package/lib/components/UI/LazyLoadingGoogleMarker.d.ts +0 -83
- package/lib/components/UI/LazyLoadingGoogleMarker.d.ts.map +0 -1
- package/lib/components/UI/LazyLoadingGoogleMarker.js +0 -107
- package/lib/components/UI/LazyLoadingGoogleMarker.js.map +0 -1
- package/lib/components/UI/Pagination.d.ts +0 -6
- package/lib/components/UI/Pagination.d.ts.map +0 -1
- package/lib/components/UI/Pagination.js +0 -56
- package/lib/components/UI/Pagination.js.map +0 -1
- package/lib/components/UI/ParamSearchResultContainer.d.ts +0 -99
- package/lib/components/UI/ParamSearchResultContainer.d.ts.map +0 -1
- package/lib/components/UI/ParamSearchResultContainer.js +0 -120
- package/lib/components/UI/ParamSearchResultContainer.js.map +0 -1
- package/lib/components/UI/PropertyCard.d.ts +0 -24
- package/lib/components/UI/PropertyCard.d.ts.map +0 -1
- package/lib/components/UI/PropertyCard.js +0 -420
- package/lib/components/UI/PropertyCard.js.map +0 -1
- package/lib/components/UI/PropertyCardOnMap.d.ts +0 -10
- package/lib/components/UI/PropertyCardOnMap.d.ts.map +0 -1
- package/lib/components/UI/PropertyCardOnMap.js +0 -108
- package/lib/components/UI/PropertyCardOnMap.js.map +0 -1
- package/lib/components/UI/VehicleCard/PricePopover.d.ts +0 -8
- package/lib/components/UI/VehicleCard/PricePopover.d.ts.map +0 -1
- package/lib/components/UI/VehicleCard/PricePopover.js +0 -98
- package/lib/components/UI/VehicleCard/PricePopover.js.map +0 -1
- package/lib/components/UI/VehicleCard/VehicleBadge.d.ts +0 -7
- package/lib/components/UI/VehicleCard/VehicleBadge.d.ts.map +0 -1
- package/lib/components/UI/VehicleCard/VehicleFeature.d.ts +0 -9
- package/lib/components/UI/VehicleCard/VehicleFeature.d.ts.map +0 -1
- package/lib/components/UI/VehicleCard/VehicleFeature.js +0 -22
- package/lib/components/UI/VehicleCard/VehicleFeature.js.map +0 -1
- package/lib/components/UI/VehicleCard/types.d.ts +0 -59
- package/lib/components/UI/VehicleCard/types.d.ts.map +0 -1
- package/lib/components/UI/VehicleCard.d.ts +0 -15
- package/lib/components/UI/VehicleCard.d.ts.map +0 -1
- package/lib/components/UI/VehicleCard.js +0 -166
- package/lib/components/UI/VehicleCard.js.map +0 -1
- package/lib/components/UI/VehicleCardList.d.ts +0 -14
- package/lib/components/UI/VehicleCardList.d.ts.map +0 -1
- package/lib/components/UI/VehicleCardList.js +0 -38
- package/lib/components/UI/VehicleCardList.js.map +0 -1
- package/lib/components/UI/VehicleParamSearchResultContainer.d.ts +0 -90
- package/lib/components/UI/VehicleParamSearchResultContainer.d.ts.map +0 -1
- package/lib/components/UI/icons/LocationIcon.d.ts +0 -7
- package/lib/components/UI/icons/LocationIcon.d.ts.map +0 -1
- package/lib/components/UI/icons/LocationIcon.js +0 -18
- package/lib/components/UI/icons/LocationIcon.js.map +0 -1
- package/lib/components/UI/icons/index.d.ts +0 -2
- package/lib/components/UI/icons/index.d.ts.map +0 -1
- package/lib/components/UI/index.d.ts +0 -10
- package/lib/components/UI/index.d.ts.map +0 -1
- package/lib/components/typings.js +0 -6
- package/lib/components/typings.js.map +0 -1
- package/lib/hooks/use-get-current-lat-long.d.ts +0 -18
- package/lib/hooks/use-get-current-lat-long.d.ts.map +0 -1
- package/lib/hooks/use-get-current-lat-long.js +0 -29
- package/lib/hooks/use-get-current-lat-long.js.map +0 -1
- package/lib/hooks/useWindowSize.d.ts +0 -6
- package/lib/hooks/useWindowSize.d.ts.map +0 -1
- package/lib/hooks/useWindowSize.js +0 -20
- package/lib/hooks/useWindowSize.js.map +0 -1
- package/lib/middlewares/airbnbDatasourcesMiddleware.d.ts +0 -6
- package/lib/middlewares/airbnbDatasourcesMiddleware.d.ts.map +0 -1
- package/lib/middlewares/bookingCarRentalMiddleware.d.ts +0 -6
- package/lib/middlewares/bookingCarRentalMiddleware.d.ts.map +0 -1
- package/lib/middlewares/bookingDatasourcesMiddleware.d.ts +0 -7
- package/lib/middlewares/bookingDatasourcesMiddleware.d.ts.map +0 -1
- package/lib/middlewares/datasourcesMiddleware.d.ts +0 -6
- package/lib/middlewares/datasourcesMiddleware.d.ts.map +0 -1
- package/lib/middlewares/pricelineDatasourcesMiddleware.d.ts +0 -7
- package/lib/middlewares/pricelineDatasourcesMiddleware.d.ts.map +0 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {useState,useRef,useEffect}from'react';import {
|
|
2
|
-
const updateTheme = (dark, color, publicPath = '/theme') => {
|
|
1
|
+
import {jsx,Fragment,jsxs}from'react/jsx-runtime';import {useSelector}from'@xstate/react';import clsx from'clsx';import {parse}from'qs';import*as React from'react';import {useState,useRef,useEffect}from'react';import {useTranslation}from'react-i18next';import'@react-icons/all-files/fa/FaMoon.js';import'@react-icons/all-files/fa/FaSun.js';import {useMediaQuery}from'../../hooks/useMediaQuery.js';import {icons}from'../../icons.js';import isBrowser from'../../utils/isBrowser/index.js';import {getDefaultApplyToAllRoutes,getSettingValue}from'../../utils/settingsUtils.js';import'@common-stack/components-pro';import {AdditionalSettingsSlot}from'../Layout/slot-fill/AdditionalSettings.js';import'reflect-metadata';import'@admin-layout/client/lib/constants/layout.js';import CheckBoxTheme from'./CheckBoxTheme.js';import InvitationSettings from'./InvitationSettings.js';import LayoutChange from'./LayoutChange.js';import MenuVisibilitySettings from'./MenuVisibilitySettings.js';import NavigationModes from'./NavigationsModes.js';import RegionalSettings from'./RegionalSettings.js';import ThemeColor from'./ThemeColor.js';import {ThemeSelector}from'./ThemeSelector.js';import {WebFontsSelector}from'./WebFontsSelector.js';import {useWriteSettingsMutation,useResetApplicationUiSettingsMutation}from'common/lib/generated/generated.js';import {ConfigCollectionName,ConfigFragmentName}from'common/lib/generated/generated-models.js';import {generateCdecodeUri,DEFAULT_CONTRIBUTION_TENANT_ID}from'@adminide-stack/core';import {config}from'../../config/env-config.js';const updateTheme = (dark, color, publicPath = '/theme') => {
|
|
3
2
|
// ssr
|
|
4
3
|
if (typeof window === 'undefined' || !window.umi_plugin_ant_themeVar) {
|
|
5
4
|
return;
|
|
@@ -42,7 +41,7 @@ const updateTheme = (dark, color, publicPath = '/theme') => {
|
|
|
42
41
|
}
|
|
43
42
|
// localStorage.setItem('site-theme', dark ? 'dark' : 'light');
|
|
44
43
|
};
|
|
45
|
-
const initState = (settings, onSettingChange, publicPath) => {
|
|
44
|
+
const initState = (settings, onSettingChange, publicPath, oldSetting) => {
|
|
46
45
|
if (!isBrowser()) {
|
|
47
46
|
return;
|
|
48
47
|
}
|
|
@@ -51,21 +50,25 @@ const initState = (settings, onSettingChange, publicPath) => {
|
|
|
51
50
|
const params = parse(window.location.search.replace('?', ''));
|
|
52
51
|
const replaceSetting = {};
|
|
53
52
|
Object.keys(params).forEach(key => {
|
|
54
|
-
if (
|
|
53
|
+
if (settings[key] !== undefined || settings[key] === undefined) {
|
|
55
54
|
replaceSetting[key] = params[key];
|
|
56
55
|
if (key.includes('Render')) {
|
|
57
56
|
replaceSetting[key] = params[key] === 'false' ? false : undefined;
|
|
58
57
|
}
|
|
59
58
|
}
|
|
60
59
|
});
|
|
61
|
-
|
|
60
|
+
// Only call onSettingChange if we have actual URL parameters to apply
|
|
61
|
+
if (onSettingChange && Object.keys(replaceSetting).length > 0) {
|
|
62
|
+
console.log('✅ initState: Calling onSettingChange with URL params:', replaceSetting);
|
|
62
63
|
onSettingChange({
|
|
63
64
|
...settings,
|
|
64
65
|
...replaceSetting
|
|
65
66
|
});
|
|
67
|
+
} else {
|
|
68
|
+
console.log('⏭️ initState: Skipping onSettingChange - no valid URL params to apply');
|
|
66
69
|
}
|
|
67
70
|
// Set the topic in the URL and load it once.
|
|
68
|
-
if (oldSetting
|
|
71
|
+
if (oldSetting?.navTheme !== params.navTheme && params.navTheme) {
|
|
69
72
|
updateTheme(settings.navTheme === 'realDark', params.primaryColor, publicPath);
|
|
70
73
|
loadedStyle = true;
|
|
71
74
|
}
|
|
@@ -74,21 +77,37 @@ const initState = (settings, onSettingChange, publicPath) => {
|
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
79
|
// If there is no topic in the URL, and no load in the URL is loaded.
|
|
77
|
-
if (
|
|
80
|
+
if (oldSetting?.navTheme !== settings.navTheme && settings.navTheme) {
|
|
78
81
|
updateTheme(settings.navTheme === 'realDark', settings.primaryColor, publicPath);
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
|
-
const getThemeList = (settings, location) => {
|
|
84
|
+
const getThemeList = (settings, location, routePattern) => {
|
|
82
85
|
const {
|
|
83
86
|
t
|
|
84
87
|
} = useTranslation('settings');
|
|
85
88
|
const {
|
|
86
89
|
isMobile
|
|
87
90
|
} = useMediaQuery();
|
|
88
|
-
const currentRoute = location?.pathname || '/';
|
|
89
|
-
const routeSettings = settings?.routeSettings?.[currentRoute] || settings?.routeSettings?.['/'] || settings;
|
|
91
|
+
const currentRoute = routePattern || location?.pathname || '/';
|
|
90
92
|
const deviceType = isMobile ? 'mobile' : 'desktop';
|
|
91
|
-
|
|
93
|
+
// Helper function to get value from settings with route/device override support
|
|
94
|
+
const getUILayoutValue = path => {
|
|
95
|
+
const routeDeviceKey = `[${currentRoute}][${deviceType}]`;
|
|
96
|
+
const uiOverride = settings?.uiSettings?.[routeDeviceKey];
|
|
97
|
+
if (uiOverride) {
|
|
98
|
+
const value = path.split('.').reduce((obj, key) => obj?.[key], uiOverride);
|
|
99
|
+
if (value !== undefined) return value;
|
|
100
|
+
}
|
|
101
|
+
return path.split('.').reduce((obj, key) => obj?.[key], settings);
|
|
102
|
+
};
|
|
103
|
+
const deviceLayout = {
|
|
104
|
+
navigationMode: getUILayoutValue('navigationMode'),
|
|
105
|
+
sideMenuType: getUILayoutValue('sideMenuType'),
|
|
106
|
+
contentWidth: getUILayoutValue('contentWidth'),
|
|
107
|
+
fixedHeader: getUILayoutValue('fixedHeader'),
|
|
108
|
+
fixedSidebar: getUILayoutValue('fixedSidebar'),
|
|
109
|
+
splitMenus: getUILayoutValue('splitMenus')
|
|
110
|
+
};
|
|
92
111
|
let list = [];
|
|
93
112
|
const defaultList = [
|
|
94
113
|
//@sri following are needed otherwise we need make above plugin to work
|
|
@@ -264,7 +283,6 @@ const fontOptions = [{
|
|
|
264
283
|
}];
|
|
265
284
|
const SettingDrawer = props => {
|
|
266
285
|
const {
|
|
267
|
-
settings,
|
|
268
286
|
onSettingChange,
|
|
269
287
|
hideLoading,
|
|
270
288
|
hideColors,
|
|
@@ -275,8 +293,12 @@ const SettingDrawer = props => {
|
|
|
275
293
|
colorList,
|
|
276
294
|
navTheme,
|
|
277
295
|
pathname,
|
|
278
|
-
location
|
|
296
|
+
location,
|
|
297
|
+
fullMenuData,
|
|
298
|
+
routePattern
|
|
279
299
|
} = props;
|
|
300
|
+
// Don't use useLayoutSettings() - it pulls from Redux which may be stale
|
|
301
|
+
// Use settingState from XState actor instead (line 393)
|
|
280
302
|
const {
|
|
281
303
|
CloseIcon,
|
|
282
304
|
Settings5FillIcon,
|
|
@@ -289,41 +311,130 @@ const SettingDrawer = props => {
|
|
|
289
311
|
} = useMediaQuery();
|
|
290
312
|
const [copied, setCopied] = useState(false);
|
|
291
313
|
const [copiedModified, setCopiedModified] = useState(false);
|
|
314
|
+
const [activeDeviceTab, setActiveDeviceTab] = useState(isMobile ? 'mobile' : 'desktop');
|
|
315
|
+
const [applyToAllRoutes, setApplyToAllRoutes] = useState(false);
|
|
292
316
|
const {
|
|
293
317
|
t
|
|
294
318
|
} = useTranslation('settings');
|
|
295
|
-
|
|
319
|
+
// Track if we've already initialized to prevent loops
|
|
320
|
+
const hasInitializedRef = useRef(false);
|
|
321
|
+
const resource = generateCdecodeUri(DEFAULT_CONTRIBUTION_TENANT_ID, {
|
|
322
|
+
resourceType: ConfigCollectionName.Applications,
|
|
323
|
+
resourceId: config.APPLICATION_ID,
|
|
324
|
+
idField: 'appId'
|
|
325
|
+
}, {}, ConfigFragmentName.UiSettings);
|
|
326
|
+
const [writeSettingsMutation, {
|
|
327
|
+
client
|
|
328
|
+
}] = useWriteSettingsMutation();
|
|
329
|
+
const [resetApplicationSettings] = useResetApplicationUiSettingsMutation();
|
|
296
330
|
const btnRef = useRef();
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
//
|
|
300
|
-
//
|
|
301
|
-
|
|
302
|
-
//
|
|
303
|
-
const
|
|
331
|
+
// REVOLUTIONARY APPROACH: Use stable selectors instead of raw context access
|
|
332
|
+
// This completely eliminates the infinite loop problem because:
|
|
333
|
+
// 1. selectPublicSettings only returns context.public (no internal state)
|
|
334
|
+
// 2. useSelector memoizes the result - only re-renders if PUBLIC settings actually change
|
|
335
|
+
// 3. configModel reference changes are isolated in context.internal, never seen here
|
|
336
|
+
// 4. No filtering logic needed - separation is built into the machine
|
|
337
|
+
const settingState = useSelector(actor, state => state.context.public);
|
|
338
|
+
const changedSettings = useSelector(actor, state => state.context.internal.changedSettings);
|
|
339
|
+
useSelector(actor, state => state.context.internal.deviceType);
|
|
340
|
+
// Track previous settings to detect meaningful changes
|
|
341
|
+
const prevSettingsRef = useRef();
|
|
342
|
+
useEffect(() => {
|
|
343
|
+
const prevSettings = prevSettingsRef.current;
|
|
344
|
+
const currentSettings = settingState;
|
|
345
|
+
if (prevSettings) {
|
|
346
|
+
const prevString = JSON.stringify(prevSettings);
|
|
347
|
+
const currentString = JSON.stringify(currentSettings);
|
|
348
|
+
const hasChanged = prevString !== currentString;
|
|
349
|
+
console.log('⚡ SettingDrawer - PUBLIC settings update:', {
|
|
350
|
+
hasChanged,
|
|
351
|
+
prevKeys: prevSettings ? Object.keys(prevSettings).length : 0,
|
|
352
|
+
currentKeys: currentSettings ? Object.keys(currentSettings).length : 0
|
|
353
|
+
});
|
|
354
|
+
if (hasChanged) {
|
|
355
|
+
console.log('🔍 What changed in PUBLIC settings:', {
|
|
356
|
+
changedKeys: Object.keys(currentSettings).filter(key => {
|
|
357
|
+
const prevValue = JSON.stringify(prevSettings[key]);
|
|
358
|
+
const currentValue = JSON.stringify(currentSettings[key]);
|
|
359
|
+
return prevValue !== currentValue;
|
|
360
|
+
})
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
prevSettingsRef.current = JSON.parse(JSON.stringify(currentSettings));
|
|
365
|
+
}, [settingState]);
|
|
366
|
+
const currentRoute = routePattern || location?.pathname || '/';
|
|
367
|
+
// Use activeDeviceTab instead of isMobile for device type
|
|
368
|
+
const deviceType = activeDeviceTab;
|
|
369
|
+
// Calculate the default value for applyToAllRoutes based on what overrides exist
|
|
370
|
+
const defaultApplyToAllRoutes = React.useMemo(() => {
|
|
371
|
+
return getDefaultApplyToAllRoutes(settingState, currentRoute, deviceType);
|
|
372
|
+
}, [settingState, currentRoute, deviceType]);
|
|
373
|
+
// Update applyToAllRoutes when route or device changes
|
|
374
|
+
useEffect(() => {
|
|
375
|
+
setApplyToAllRoutes(defaultApplyToAllRoutes);
|
|
376
|
+
}, [defaultApplyToAllRoutes]);
|
|
377
|
+
// Pass settingState directly - child components will use getSettingValue internally
|
|
378
|
+
// with the applyToAllRoutes prop to get the correct scoped values
|
|
379
|
+
const settingsForComponents = settingState;
|
|
380
|
+
// Helper to get theme value with overrides applied
|
|
381
|
+
const getThemeValue = () => getSettingValue(settingState, 'theme', applyToAllRoutes, currentRoute, deviceType, 'default');
|
|
382
|
+
// Helper to get font family value with overrides applied
|
|
383
|
+
const getFontFamilyValue = () => getSettingValue(settingState, 'fontFamily', applyToAllRoutes, currentRoute, deviceType, 'Poppins, sans-serif');
|
|
384
|
+
const themeList = getThemeList(settingState, location, routePattern);
|
|
304
385
|
/**
|
|
305
386
|
* Modify settings
|
|
306
387
|
* @param key
|
|
307
388
|
* @param value
|
|
308
389
|
*/
|
|
309
390
|
const handleSettingChange = (key, value) => {
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
391
|
+
console.log('🎨 handleSettingChange called:', {
|
|
392
|
+
key,
|
|
393
|
+
value,
|
|
394
|
+
valueType: typeof value,
|
|
395
|
+
applyToAllRoutes,
|
|
396
|
+
currentRoute,
|
|
397
|
+
deviceType
|
|
398
|
+
});
|
|
399
|
+
// Menu visibility and applyToAllRoutes are always global
|
|
400
|
+
const isGlobalSetting = key === 'hiddenMenuKeys' || key === 'hiddenMenuCategories' || key === 'applyToAllRoutes';
|
|
401
|
+
// If this is a global setting, save as global
|
|
402
|
+
if (isGlobalSetting) {
|
|
403
|
+
console.log('🌐 Sending GLOBAL setting to actor:', {
|
|
404
|
+
key,
|
|
405
|
+
value
|
|
318
406
|
});
|
|
319
|
-
} else {
|
|
320
407
|
actor.send({
|
|
321
|
-
type: '
|
|
408
|
+
type: 'UISETTING_UPDATE',
|
|
322
409
|
value: {
|
|
323
410
|
[key]: value
|
|
324
411
|
}
|
|
325
412
|
});
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
// Extract the setting name from the key
|
|
416
|
+
// Key is just "settingName" (no uilayout wrapper)
|
|
417
|
+
const settingName = key;
|
|
418
|
+
// Build the correct bracket pattern based on applyToAllRoutes
|
|
419
|
+
let fullKey;
|
|
420
|
+
if (applyToAllRoutes) {
|
|
421
|
+
// Apply to all routes: [device].settingName
|
|
422
|
+
fullKey = `[${deviceType}].${settingName}`;
|
|
423
|
+
} else {
|
|
424
|
+
// Route-specific: [route][device].settingName
|
|
425
|
+
fullKey = `[${currentRoute}][${deviceType}].${settingName}`;
|
|
326
426
|
}
|
|
427
|
+
console.log('📤 Sending SCOPED setting to actor:', {
|
|
428
|
+
fullKey,
|
|
429
|
+
value,
|
|
430
|
+
eventType: 'UISETTING_UPDATE'
|
|
431
|
+
});
|
|
432
|
+
actor.send({
|
|
433
|
+
type: 'UISETTING_UPDATE',
|
|
434
|
+
value: {
|
|
435
|
+
[fullKey]: value
|
|
436
|
+
}
|
|
437
|
+
});
|
|
327
438
|
};
|
|
328
439
|
const handleCopySettings = async () => {
|
|
329
440
|
if (!isBrowser()) return;
|
|
@@ -339,7 +450,23 @@ const SettingDrawer = props => {
|
|
|
339
450
|
const handleCopyModifiedSettings = async () => {
|
|
340
451
|
if (!isBrowser()) return;
|
|
341
452
|
try {
|
|
342
|
-
|
|
453
|
+
// Get ConfigurationModel from actor's internal state
|
|
454
|
+
// This is one of the rare cases where we access internal state,
|
|
455
|
+
// but it's safe because we're not using it for change detection
|
|
456
|
+
const configModel = actor.getSnapshot().context.internal.configModel;
|
|
457
|
+
if (!configModel || !configModel.overrides) {
|
|
458
|
+
console.log('No overrides to copy');
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
// Build a clean object with all overrides
|
|
462
|
+
const modifiedSettings = {};
|
|
463
|
+
configModel.overrides.forEach(override => {
|
|
464
|
+
// Each override has identifiers like ['[desktop]'] or ['[/vault][desktop]']
|
|
465
|
+
const identifier = override.identifiers?.[0];
|
|
466
|
+
if (identifier) {
|
|
467
|
+
modifiedSettings[identifier] = override.contents;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
343
470
|
const settings = JSON.stringify(modifiedSettings, null, 2);
|
|
344
471
|
await navigator.clipboard.writeText(settings);
|
|
345
472
|
setCopiedModified(true);
|
|
@@ -348,29 +475,142 @@ const SettingDrawer = props => {
|
|
|
348
475
|
console.error('Failed to copy modified settings:', err);
|
|
349
476
|
}
|
|
350
477
|
};
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if
|
|
361
|
-
|
|
478
|
+
const handleSaveSettings = async () => {
|
|
479
|
+
if (!isBrowser()) return;
|
|
480
|
+
try {
|
|
481
|
+
// Transform changedSettings to wrap in uilayout structure for backend
|
|
482
|
+
const wrappedSettings = {};
|
|
483
|
+
Object.keys(changedSettings || {}).forEach(key => {
|
|
484
|
+
const value = changedSettings[key];
|
|
485
|
+
// Skip route paths
|
|
486
|
+
if (key.startsWith('/')) return;
|
|
487
|
+
// Check if it's a bracket key like [device].settingName or [route][device].settingName
|
|
488
|
+
if (key.startsWith('[')) {
|
|
489
|
+
// Extract bracket pattern and setting name
|
|
490
|
+
// e.g., "[desktop].theme" or "[/route][desktop].navTheme"
|
|
491
|
+
const match = key.match(/^(\[.+?\](?:\[.+?\])?)\.(.+)$/);
|
|
492
|
+
if (match) {
|
|
493
|
+
const bracketKey = match[1]; // e.g., "[desktop]" or "[/route][desktop]"
|
|
494
|
+
const settingName = match[2]; // e.g., "theme"
|
|
495
|
+
// Wrap in uilayout structure: [desktop].uilayout.theme
|
|
496
|
+
const wrappedKey = `${bracketKey}.uilayout.${settingName}`;
|
|
497
|
+
wrappedSettings[wrappedKey] = value;
|
|
498
|
+
} else {
|
|
499
|
+
// If pattern doesn't match, keep as is
|
|
500
|
+
wrappedSettings[key] = value;
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
// Non-bracket keys (like hiddenMenuKeys) - keep as is
|
|
504
|
+
wrappedSettings[key] = value;
|
|
362
505
|
}
|
|
506
|
+
});
|
|
507
|
+
// Prepare mutation variables
|
|
508
|
+
const variables = {
|
|
509
|
+
editingUri: resource,
|
|
510
|
+
settings: wrappedSettings
|
|
511
|
+
};
|
|
512
|
+
const response = await writeSettingsMutation({
|
|
513
|
+
variables
|
|
514
|
+
});
|
|
515
|
+
if (response.data) {
|
|
516
|
+
console.log('Settings saved successfully');
|
|
517
|
+
// Reset XState changedSettings (this will disable save button)
|
|
518
|
+
actor.send({
|
|
519
|
+
type: 'UISETTING_RESET_CHANGED_SETTINGS'
|
|
520
|
+
});
|
|
363
521
|
}
|
|
522
|
+
} catch (err) {
|
|
523
|
+
console.error('Failed to save settings:', err);
|
|
364
524
|
}
|
|
365
|
-
}
|
|
525
|
+
};
|
|
526
|
+
const handleResetSettings = async () => {
|
|
527
|
+
if (!isBrowser()) return;
|
|
528
|
+
const confirmed = window.confirm('Are you sure you want to reset all settings? This will delete all customizations from database and cookies, then reload the page.');
|
|
529
|
+
if (!confirmed) return;
|
|
530
|
+
try {
|
|
531
|
+
console.log('🔥 Resetting all settings...');
|
|
532
|
+
// Step 1: Delete uiSettings from database using the resetApplicationSettings mutation
|
|
533
|
+
try {
|
|
534
|
+
await resetApplicationSettings({
|
|
535
|
+
variables: {
|
|
536
|
+
appId: config.APPLICATION_ID
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
console.log('✅ Database uiSettings deleted');
|
|
540
|
+
} catch (dbErr) {
|
|
541
|
+
console.error('⚠️ Failed to delete database uiSettings:', dbErr);
|
|
542
|
+
// Continue anyway to clear cookies
|
|
543
|
+
}
|
|
544
|
+
// Step 2: Clear cookies by sending DELETE request
|
|
545
|
+
try {
|
|
546
|
+
const response = await fetch('/resources/settings', {
|
|
547
|
+
method: 'DELETE',
|
|
548
|
+
headers: {
|
|
549
|
+
'Content-Type': 'application/json'
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
const result = await response.json();
|
|
553
|
+
console.log('✅ Settings cookies cleared');
|
|
554
|
+
} catch (cookieErr) {
|
|
555
|
+
console.error('⚠️ Failed to clear cookies:', cookieErr);
|
|
556
|
+
}
|
|
557
|
+
// Step 3: Reset XState machine
|
|
558
|
+
actor.send({
|
|
559
|
+
type: 'UISETTING_RESET_CHANGED_SETTINGS'
|
|
560
|
+
});
|
|
561
|
+
} catch (err) {
|
|
562
|
+
console.error('❌ Error resetting settings:', err);
|
|
563
|
+
alert('Failed to reset settings. Please try again.');
|
|
564
|
+
}
|
|
565
|
+
};
|
|
566
|
+
useEffect(() => {
|
|
567
|
+
// REVOLUTIONARY: No filtering needed! settingState already contains ONLY public settings
|
|
568
|
+
// The XState machine now has a separated structure:
|
|
569
|
+
// - context.public = user-facing settings (what we're using)
|
|
570
|
+
// - context.internal = machine state (never exposed)
|
|
571
|
+
//
|
|
572
|
+
// This completely eliminates the loop problem at the architectural level.
|
|
573
|
+
if (isBrowser()) {
|
|
574
|
+
const hasUrlParams = !!window.location.search;
|
|
575
|
+
console.log('🔄 SettingDrawer useEffect - PUBLIC settings:', {
|
|
576
|
+
hasUrlParams,
|
|
577
|
+
hasInitialized: hasInitializedRef.current,
|
|
578
|
+
settingsKeys: settingState ? Object.keys(settingState).length : 0
|
|
579
|
+
});
|
|
580
|
+
// Only call initState on first mount OR if there are URL params
|
|
581
|
+
const shouldInit = !hasInitializedRef.current || hasUrlParams;
|
|
582
|
+
if (shouldInit) {
|
|
583
|
+
console.log('🔥 Calling initState:', {
|
|
584
|
+
reason: !hasInitializedRef.current ? 'first mount' : 'has URL params'
|
|
585
|
+
});
|
|
586
|
+
initState(settingState, onSettingChange, props.publicPath, undefined);
|
|
587
|
+
hasInitializedRef.current = true;
|
|
588
|
+
} else {
|
|
589
|
+
console.log('⏭️ Skipping initState - already initialized and no URL params');
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}, [settingState, props.publicPath]); // settingState only changes when PUBLIC settings change
|
|
593
|
+
// Update activeDeviceTab when isMobile changes
|
|
594
|
+
useEffect(() => {
|
|
595
|
+
setActiveDeviceTab(isMobile ? 'mobile' : 'desktop');
|
|
596
|
+
}, [isMobile]);
|
|
597
|
+
// Update machine when device tab changes
|
|
598
|
+
useEffect(() => {
|
|
599
|
+
if (actor) {
|
|
600
|
+
actor.send({
|
|
601
|
+
type: 'UISETTING_UPDATE_DEVICE_TYPE',
|
|
602
|
+
deviceType: activeDeviceTab
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
}, [activeDeviceTab, actor]);
|
|
366
606
|
const currentPathname = isBrowser() ? window.location.pathname : pathname || '';
|
|
367
607
|
return jsx(Fragment, {
|
|
368
|
-
children:
|
|
608
|
+
children: settingState?.showSettingPanel && jsxs(Fragment, {
|
|
369
609
|
children: [jsx("button", {
|
|
370
610
|
ref: btnRef,
|
|
371
611
|
onClick: () => setShow(!show),
|
|
372
612
|
style: {
|
|
373
|
-
backgroundColor:
|
|
613
|
+
backgroundColor: settingState?.primaryColor,
|
|
374
614
|
display: 'flex',
|
|
375
615
|
alignItems: 'center',
|
|
376
616
|
justifyContent: 'center'
|
|
@@ -399,6 +639,107 @@ const SettingDrawer = props => {
|
|
|
399
639
|
fontSize: '36px'
|
|
400
640
|
})
|
|
401
641
|
})]
|
|
642
|
+
}), jsxs("div", {
|
|
643
|
+
className: "mt-8 pb-8 border-b border-black dark:border-[#2a2b2a]",
|
|
644
|
+
children: [jsx(MenuVisibilitySettings, {
|
|
645
|
+
fullMenuData: fullMenuData,
|
|
646
|
+
settings: settingState,
|
|
647
|
+
changeSetting: handleSettingChange
|
|
648
|
+
}), jsxs("div", {
|
|
649
|
+
className: "flex items-center justify-between",
|
|
650
|
+
children: [jsxs("div", {
|
|
651
|
+
children: [jsx("p", {
|
|
652
|
+
className: "text-sm text-black dark:text-white font-medium",
|
|
653
|
+
children: "Apply to All Routes"
|
|
654
|
+
}), jsx("p", {
|
|
655
|
+
className: "text-xs text-gray-600 dark:text-gray-400",
|
|
656
|
+
children: "When enabled, route-specific settings will apply to all routes instead of just the current route"
|
|
657
|
+
})]
|
|
658
|
+
}), jsxs("label", {
|
|
659
|
+
className: "relative inline-flex items-center cursor-pointer",
|
|
660
|
+
children: [jsx("input", {
|
|
661
|
+
type: "checkbox",
|
|
662
|
+
className: "sr-only peer",
|
|
663
|
+
checked: applyToAllRoutes,
|
|
664
|
+
onChange: e => setApplyToAllRoutes(e.target.checked)
|
|
665
|
+
}), jsx("div", {
|
|
666
|
+
className: "w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600"
|
|
667
|
+
})]
|
|
668
|
+
})]
|
|
669
|
+
}), jsx("div", {
|
|
670
|
+
className: "mt-4",
|
|
671
|
+
children: jsxs("div", {
|
|
672
|
+
className: "flex mb-4",
|
|
673
|
+
children: [jsx("button", {
|
|
674
|
+
className: `flex-1 py-2 px-4 text-sm font-medium transition-colors duration-200 rounded-l-lg border border-r-0 border-gray-300 ${activeDeviceTab === 'desktop' ? 'bg-blue-500 text-white border-blue-500' : 'bg-white text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700'}`,
|
|
675
|
+
onClick: () => setActiveDeviceTab('desktop'),
|
|
676
|
+
children: jsxs("span", {
|
|
677
|
+
className: "flex items-center justify-center",
|
|
678
|
+
children: [jsxs("svg", {
|
|
679
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
680
|
+
width: "16",
|
|
681
|
+
height: "16",
|
|
682
|
+
viewBox: "0 0 24 24",
|
|
683
|
+
fill: "none",
|
|
684
|
+
stroke: "currentColor",
|
|
685
|
+
strokeWidth: "2",
|
|
686
|
+
strokeLinecap: "round",
|
|
687
|
+
strokeLinejoin: "round",
|
|
688
|
+
className: "mr-1",
|
|
689
|
+
children: [jsx("rect", {
|
|
690
|
+
x: "2",
|
|
691
|
+
y: "3",
|
|
692
|
+
width: "20",
|
|
693
|
+
height: "14",
|
|
694
|
+
rx: "2",
|
|
695
|
+
ry: "2"
|
|
696
|
+
}), jsx("line", {
|
|
697
|
+
x1: "8",
|
|
698
|
+
y1: "21",
|
|
699
|
+
x2: "16",
|
|
700
|
+
y2: "21"
|
|
701
|
+
}), jsx("line", {
|
|
702
|
+
x1: "12",
|
|
703
|
+
y1: "17",
|
|
704
|
+
x2: "12",
|
|
705
|
+
y2: "21"
|
|
706
|
+
})]
|
|
707
|
+
}), t('desktop_tab')]
|
|
708
|
+
})
|
|
709
|
+
}), jsx("button", {
|
|
710
|
+
className: `flex-1 py-2 px-4 text-sm font-medium transition-colors duration-200 rounded-r-lg border border-gray-300 ${activeDeviceTab === 'mobile' ? 'bg-blue-500 text-white border-blue-500' : 'bg-white text-gray-700 hover:bg-gray-50 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700'}`,
|
|
711
|
+
onClick: () => setActiveDeviceTab('mobile'),
|
|
712
|
+
children: jsxs("span", {
|
|
713
|
+
className: "flex items-center justify-center",
|
|
714
|
+
children: [jsxs("svg", {
|
|
715
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
716
|
+
width: "16",
|
|
717
|
+
height: "16",
|
|
718
|
+
viewBox: "0 0 24 24",
|
|
719
|
+
fill: "none",
|
|
720
|
+
stroke: "currentColor",
|
|
721
|
+
strokeWidth: "2",
|
|
722
|
+
strokeLinecap: "round",
|
|
723
|
+
strokeLinejoin: "round",
|
|
724
|
+
className: "mr-1",
|
|
725
|
+
children: [jsx("rect", {
|
|
726
|
+
x: "5",
|
|
727
|
+
y: "2",
|
|
728
|
+
width: "14",
|
|
729
|
+
height: "20",
|
|
730
|
+
rx: "2",
|
|
731
|
+
ry: "2"
|
|
732
|
+
}), jsx("line", {
|
|
733
|
+
x1: "12",
|
|
734
|
+
y1: "18",
|
|
735
|
+
x2: "12",
|
|
736
|
+
y2: "18"
|
|
737
|
+
})]
|
|
738
|
+
}), t('mobile_tab')]
|
|
739
|
+
})
|
|
740
|
+
})]
|
|
741
|
+
})
|
|
742
|
+
})]
|
|
402
743
|
}), jsxs("div", {
|
|
403
744
|
className: "mt-8 pb-8 border-b border-black dark:border-[#2a2b2a]",
|
|
404
745
|
children: [jsx("p", {
|
|
@@ -408,7 +749,9 @@ const SettingDrawer = props => {
|
|
|
408
749
|
children: jsx(CheckBoxTheme, {
|
|
409
750
|
list: themeList.themeList,
|
|
410
751
|
changeSetting: handleSettingChange,
|
|
411
|
-
settings:
|
|
752
|
+
settings: settingsForComponents,
|
|
753
|
+
location: location,
|
|
754
|
+
applyToAllRoutes: applyToAllRoutes,
|
|
412
755
|
...props
|
|
413
756
|
})
|
|
414
757
|
}), jsxs("div", {
|
|
@@ -417,7 +760,7 @@ const SettingDrawer = props => {
|
|
|
417
760
|
className: "text-black dark:text-white",
|
|
418
761
|
children: t('Select Theme')
|
|
419
762
|
}), jsx(ThemeSelector, {
|
|
420
|
-
value:
|
|
763
|
+
value: getThemeValue(),
|
|
421
764
|
onChange: value => handleSettingChange('theme', value),
|
|
422
765
|
options: themeOptions
|
|
423
766
|
})]
|
|
@@ -429,7 +772,10 @@ const SettingDrawer = props => {
|
|
|
429
772
|
}), jsx(ThemeColor, {
|
|
430
773
|
color: colorList || themeList.colorList[navTheme === 'realDark' ? 'dark' : 'light'],
|
|
431
774
|
changeSetting: handleSettingChange,
|
|
432
|
-
settings:
|
|
775
|
+
settings: settingsForComponents,
|
|
776
|
+
location: location,
|
|
777
|
+
routePattern: routePattern,
|
|
778
|
+
applyToAllRoutes: applyToAllRoutes
|
|
433
779
|
})]
|
|
434
780
|
}), jsxs("div", {
|
|
435
781
|
className: "mt-8",
|
|
@@ -437,7 +783,7 @@ const SettingDrawer = props => {
|
|
|
437
783
|
className: "text-black dark:text-white",
|
|
438
784
|
children: t('Font Family')
|
|
439
785
|
}), jsx(WebFontsSelector, {
|
|
440
|
-
value:
|
|
786
|
+
value: getFontFamilyValue(),
|
|
441
787
|
onChange: value => handleSettingChange('fontFamily', value),
|
|
442
788
|
options: fontOptions
|
|
443
789
|
})]
|
|
@@ -445,38 +791,40 @@ const SettingDrawer = props => {
|
|
|
445
791
|
}), jsxs("div", {
|
|
446
792
|
className: "mt-8 pb-8 border-b border-black dark:border-[#2a2b2a]",
|
|
447
793
|
children: [jsx(NavigationModes, {
|
|
448
|
-
settings:
|
|
794
|
+
settings: settingsForComponents,
|
|
449
795
|
changeSetting: handleSettingChange,
|
|
796
|
+
applyToAllRoutes: applyToAllRoutes,
|
|
450
797
|
...props
|
|
451
798
|
}), jsx("div", {
|
|
452
799
|
className: "mt-8",
|
|
453
800
|
children: jsx(LayoutChange, {
|
|
454
|
-
settings:
|
|
801
|
+
settings: settingsForComponents,
|
|
455
802
|
changeSetting: handleSettingChange,
|
|
803
|
+
applyToAllRoutes: applyToAllRoutes,
|
|
456
804
|
...props
|
|
457
805
|
})
|
|
458
806
|
}), jsx("div", {
|
|
459
807
|
className: "mt-8",
|
|
460
808
|
children: jsx(InvitationSettings, {
|
|
461
|
-
settings:
|
|
809
|
+
settings: settingsForComponents,
|
|
462
810
|
changeSetting: handleSettingChange,
|
|
463
|
-
location: location
|
|
811
|
+
location: location,
|
|
812
|
+
routePattern: routePattern,
|
|
813
|
+
applyToAllRoutes: applyToAllRoutes
|
|
464
814
|
})
|
|
465
815
|
})]
|
|
466
|
-
}),
|
|
816
|
+
}), jsx("div", {
|
|
467
817
|
className: "mt-8 pb-8 border-b border-black dark:border-[#2a2b2a]",
|
|
468
|
-
children:
|
|
469
|
-
|
|
470
|
-
children: t('regional_rettings')
|
|
471
|
-
}), jsx(RegionalSettings, {
|
|
472
|
-
settings: settingState,
|
|
818
|
+
children: jsx(RegionalSettings, {
|
|
819
|
+
settings: settingsForComponents,
|
|
473
820
|
changeSetting: handleSettingChange,
|
|
821
|
+
applyToAllRoutes: applyToAllRoutes,
|
|
474
822
|
...props
|
|
475
|
-
})
|
|
823
|
+
})
|
|
476
824
|
}), jsx("div", {
|
|
477
825
|
className: "mt-8 pb-8 border-b border-black dark:border-[#2a2b2a]",
|
|
478
826
|
children: jsx(AdditionalSettingsSlot, {
|
|
479
|
-
settings:
|
|
827
|
+
settings: settingsForComponents,
|
|
480
828
|
onSettingsChange: handleSettingChange,
|
|
481
829
|
pathname: currentPathname
|
|
482
830
|
})
|
|
@@ -488,6 +836,13 @@ const SettingDrawer = props => {
|
|
|
488
836
|
}), jsxs("div", {
|
|
489
837
|
className: "flex flex-wrap gap-2 mt-2",
|
|
490
838
|
children: [jsx("button", {
|
|
839
|
+
disabled: !changedSettings || Object.keys(changedSettings).length === 0,
|
|
840
|
+
className: clsx('flex-1 min-w-[140px] sm:flex-none sm:w-auto px-4 py-2 rounded-lg border text-sm font-medium shadow-sm transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2', !changedSettings || Object.keys(changedSettings).length === 0 ? 'border-gray-300 text-gray-500 bg-gray-50 cursor-not-allowed dark:border-gray-600 dark:text-gray-400 dark:bg-gray-800' : 'border-yellow-300 text-yellow-700 bg-yellow-50 hover:bg-yellow-100 active:bg-yellow-200 dark:border-yellow-600 dark:text-yellow-200 dark:bg-yellow-900/50 dark:hover:bg-yellow-900'),
|
|
841
|
+
onClick: handleSaveSettings,
|
|
842
|
+
children: jsx("span", {
|
|
843
|
+
children: !changedSettings || Object.keys(changedSettings).length === 0 ? 'No Changes' : 'Save Settings'
|
|
844
|
+
})
|
|
845
|
+
}), jsx("button", {
|
|
491
846
|
className: clsx('flex-1 min-w-[140px] sm:flex-none sm:w-auto px-4 py-2 rounded-lg border text-sm font-medium shadow-sm transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2', copied ? 'border-green-300 text-green-700 bg-green-50 dark:border-green-600 dark:text-green-200 dark:bg-green-900' : 'border-yellow-300 text-yellow-700 bg-yellow-50 hover:bg-yellow-100 active:bg-yellow-200 dark:border-yellow-600 dark:text-yellow-200 dark:bg-yellow-900/50 dark:hover:bg-yellow-900'),
|
|
492
847
|
onClick: handleCopySettings,
|
|
493
848
|
children: copied ? jsxs(Fragment, {
|
|
@@ -519,6 +874,12 @@ const SettingDrawer = props => {
|
|
|
519
874
|
children: "Copy Modified Settings"
|
|
520
875
|
})]
|
|
521
876
|
})
|
|
877
|
+
}), jsx("button", {
|
|
878
|
+
className: "flex-1 min-w-[140px] sm:flex-none sm:w-auto px-4 py-2 rounded-lg border border-red-300 text-red-700 bg-red-50 hover:bg-red-100 active:bg-red-200 dark:border-red-600 dark:text-red-200 dark:bg-red-900/50 dark:hover:bg-red-900 text-sm font-medium shadow-sm transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500",
|
|
879
|
+
onClick: handleResetSettings,
|
|
880
|
+
children: jsx("span", {
|
|
881
|
+
children: "\uD83D\uDD04 Reset All Settings"
|
|
882
|
+
})
|
|
522
883
|
})]
|
|
523
884
|
})]
|
|
524
885
|
})]
|