@dashadmin/dash-admin 1.3.72 → 1.3.74-srcfree.1
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/dist/components/tenant/TenancyPlan.js +307 -0
- package/dist/systemResources.js +18 -2
- package/package.json +25 -22
- package/src/AppAsyncWrapper.tsx +0 -42
- package/src/AppWrapper.tsx +0 -45
- package/src/DASHAdmin.tsx +0 -502
- package/src/DASHAdmin.tsx.old +0 -456
- package/src/RoutingWrapper.tsx +0 -143
- package/src/classes/DASHStorageClass.tsx +0 -8
- package/src/components/Input/RichTextField.tsx +0 -27
- package/src/components/Redirect.tsx +0 -46
- package/src/components/avatar/Avatar.tsx +0 -71
- package/src/components/avatar/SingleImageUploader.tsx +0 -107
- package/src/components/currency/Format.tsx +0 -79
- package/src/components/custom/Redirect.tsx +0 -23
- package/src/components/error/Error.tsx +0 -168
- package/src/components/geocoding/GeocodingField.tsx +0 -167
- package/src/components/i18n/BridgedLocalesMenuButton.tsx +0 -160
- package/src/components/i18n/LangSwitcher.tsx +0 -204
- package/src/components/loader/GlobalLoader.tsx +0 -49
- package/src/components/logs/LogFile.tsx +0 -88
- package/src/components/logs/LogFileById.tsx +0 -68
- package/src/components/logs/LogViewer.tsx +0 -43
- package/src/components/menu/AppMenu.tsx +0 -22
- package/src/components/menu/CustomMenuItemLink.tsx +0 -61
- package/src/components/menu/DarkToggleMode.tsx +0 -65
- package/src/components/menu/LanguageToggleMode.tsx +0 -120
- package/src/components/misc/CustomImageInput.tsx +0 -62
- package/src/components/misc/DASHGlobalErrorHandler.tsx +0 -194
- package/src/components/misc/DarkModeSwitcher.tsx +0 -112
- package/src/components/misc/HorizontalScroller.tsx +0 -225
- package/src/components/misc/LanguageSwitcher.tsx +0 -199
- package/src/components/misc/MUIHtmlToolTip.tsx +0 -15
- package/src/components/misc/MuiSimpleJsonTable.tsx +0 -279
- package/src/components/misc/MultiLevelTable.tsx +0 -229
- package/src/components/misc/NoResults.tsx +0 -28
- package/src/components/misc/PDFViewer.tsx +0 -85
- package/src/components/navigation/Breadcrumbs.tsx +0 -220
- package/src/components/navigation/BreadcrumbsManager.tsx +0 -310
- package/src/components/navigation/index.tsx +0 -5
- package/src/components/panel/Error.tsx +0 -168
- package/src/components/permission/AvailablePermissionsContext.tsx +0 -173
- package/src/components/permission/PermissionsSelector.tsx +0 -834
- package/src/components/permission/PermissionsSelectorList.tsx +0 -473
- package/src/components/permission/tsx +0 -0
- package/src/components/racustombuttons/CustomRAButton.tsx +0 -87
- package/src/components/racustombuttons/QuickButton.tsx +0 -117
- package/src/components/racustombuttons/QuickEditButton.tsx +0 -115
- package/src/components/racustombuttons/QuickIconButton.tsx +0 -122
- package/src/components/scrollbar/Scrollbar.tsx +0 -31
- package/src/components/selects/MultiSelect.tsx +0 -53
- package/src/components/selects/RASearchableSelect.tsx +0 -282
- package/src/components/selects/RASearchableSelectChips.tsx +0 -308
- package/src/components/selects/SearchableSelect.tsx +0 -139
- package/src/components/serviceAccount/ApiKeyRevealDialog.tsx +0 -129
- package/src/components/serviceAccount/ServiceAccountStatusSwitch.tsx +0 -99
- package/src/components/subscription/BillingCycleSelectInput.tsx +0 -68
- package/src/components/subscription/PlanAddonsSettings.tsx +0 -563
- package/src/components/subscription/PlanAuditLog.tsx +0 -453
- package/src/components/subscription/PlanFeaturesSettings.tsx +0 -243
- package/src/components/subscription/PlanLimitsSettings.tsx +0 -230
- package/src/components/subscription/PlanMetadataSettings.tsx +0 -306
- package/src/components/subscription/PlanPricesSettings.tsx +0 -307
- package/src/components/subscription/index.ts +0 -7
- package/src/components/svgelements/SvgLoading.tsx +0 -229
- package/src/components/svgelements/SvgLogo.tsx +0 -53
- package/src/components/svgelements/SvgLogoMin.tsx +0 -64
- package/src/components/svgelements/SvgShipping.tsx +0 -673
- package/src/components/tenancy/GlobalTenantWrapper.tsx +0 -84
- package/src/components/tenancy/TenantSwitcher.tsx +0 -514
- package/src/components/tenant/AvailablePermissionsContext.tsx +0 -0
- package/src/components/tenant/SettingsSections.tsx +0 -151
- package/src/components/tenant/TenancySettings.tsx +0 -122
- package/src/components/tenant/TenantAttributes.tsx +0 -153
- package/src/components/tenant/TenantAttributesContext.tsx +0 -163
- package/src/components/tenant/TenantSelector.tsx +0 -142
- package/src/components/tenant/TenantSettings.tsx +0 -184
- package/src/components/tenant/TenantSettingsContext.tsx +0 -165
- package/src/components/tenant/TenantTheme.tsx +0 -172
- package/src/components/user/AvatarComponent.tsx +0 -317
- package/src/components/user/TenantAvatarComponent.tsx +0 -99
- package/src/components/user/UserPreferences.tsx +0 -677
- package/src/config/ACTIONS.tsx +0 -26
- package/src/config/ConstantsService.tsx +0 -44
- package/src/config/DASHAdminSystemConstants.tsx +0 -183
- package/src/config/PARSERS.tsx +0 -9
- package/src/contexts/DashQueryClientContext.tsx +0 -113
- package/src/contexts/DashResourceContext.tsx +0 -34
- package/src/contexts/I18nBridgeContext.tsx +0 -156
- package/src/contexts/I18nBridgeSetter.tsx +0 -39
- package/src/contexts/I18nReduxSync.tsx +0 -27
- package/src/contexts/SubscriptionPlanFormatsProvider.tsx +0 -217
- package/src/contexts/SystemRequestsCache.tsx +0 -215
- package/src/contexts/auth/AuthContext.tsx +0 -567
- package/src/contexts/auth/AuthContextLocalStorage.tsx +0 -140
- package/src/contexts/auth/DASHAuthenticationService.tsx +0 -915
- package/src/contexts/auth/WindowContext.tsx +0 -15
- package/src/contexts/auth/index.tsx +0 -3
- package/src/contexts/com/FCMContext.tsx +0 -415
- package/src/contexts/com/LaravelEchoContext.tsx +0 -41
- package/src/contexts/com/LaravelEchoMgr.tsx +0 -155
- package/src/contexts/com/components/DefaultNotificationComponent.tsx +0 -20
- package/src/contexts/com/components/EchoNotificationsCenter.tsx +0 -65
- package/src/contexts/com/components/NotificationAttributesTable.tsx +0 -54
- package/src/contexts/com/components/NotificationRenderer.tsx +0 -42
- package/src/contexts/com/components/NotificationsWidget.tsx +0 -182
- package/src/contexts/com/components/notificationFormats.tsx +0 -50
- package/src/contexts/com/useLaravelEcho.tsx +0 -432
- package/src/contexts/dictionary/DictionaryContext.tsx +0 -94
- package/src/declarations.d.ts +0 -17
- package/src/default-theme/DASHAppProviders.tsx +0 -117
- package/src/default-theme/DashThemeContext.tsx +0 -209
- package/src/default-theme/DashThemeContext.tsx.fast +0 -143
- package/src/default-theme/DashThemeContext.tsx.old +0 -306
- package/src/default-theme/DashThemeHelperProvider.tsx +0 -98
- package/src/default-theme/DomainAppLayout.tsx +0 -166
- package/src/default-theme/DomainHeader.tsx +0 -162
- package/src/default-theme/DomainTheme.tsx +0 -59
- package/src/default-theme/FullLayoutMarkup.tsx +0 -231
- package/src/default-theme/StaticLayout.tsx +0 -47
- package/src/default-theme/index.tsx +0 -11
- package/src/default-theme/menu/AppDashboardGrid.tsx +0 -279
- package/src/default-theme/menu/AppMaterialMenu.tsx +0 -546
- package/src/default-theme/menu/AppMenuComponents/SubmenuPortal.tsx +0 -61
- package/src/default-theme/menu/AppMenuComponents/collapsed/CollapsedSidebarItem.tsx +0 -264
- package/src/default-theme/menu/AppMenuComponents/collapsed/CollapsedSidebarItems.tsx +0 -31
- package/src/default-theme/menu/AppMenuComponents/expanded/CollapsableSidebarMenu.tsx +0 -293
- package/src/default-theme/menu/AppMenuComponents/expanded/SidebarItem.tsx +0 -92
- package/src/default-theme/menu/AppMenuComponents/getItem.tsx +0 -17
- package/src/default-theme/menu/AppMenuComponents/interfaces.tsx +0 -41
- package/src/default-theme/menu/AppMenuComponents/submenuConstants.ts +0 -90
- package/src/default-theme/menu/AppSidebarMaterial.tsx +0 -339
- package/src/default-theme/menu/SidebarActions.tsx +0 -84
- package/src/default-theme/updateDomCssVariables.tsx +0 -176
- package/src/helpers/checkRole.tsx +0 -66
- package/src/helpers/parseAxiosError.tsx +0 -41
- package/src/hooks/audio/useAudio.tsx +0 -39
- package/src/hooks/axios.tsx +0 -165
- package/src/hooks/data/useDashboardStats.tsx +0 -65
- package/src/hooks/data/usePackageByClientsStats.tsx +0 -44
- package/src/hooks/data/usePackageByCommunesStats.tsx +0 -44
- package/src/hooks/data/usePackageStats.tsx +0 -69
- package/src/hooks/data/usePackageWithdrawDetails.tsx +0 -61
- package/src/hooks/data/useStats.tsx +0 -86
- package/src/hooks/isCurrentPath.tsx +0 -22
- package/src/hooks/notifications/WSMessagesManager.tsx +0 -152
- package/src/hooks/notifications/WSPusherManager.tsx +0 -92
- package/src/hooks/useBreadcrumbs.tsx +0 -329
- package/src/hooks/useClickOutside.tsx +0 -57
- package/src/hooks/useFormPersistance.tsx +0 -150
- package/src/hooks/useGlobalErrorMediator.tsx +0 -43
- package/src/hooks/useGlobalLoaderMgr.tsx +0 -21
- package/src/hooks/useHash.tsx +0 -27
- package/src/hooks/useLocalStorage.tsx +0 -196
- package/src/hooks/usePolyglotTranslation.tsx +0 -62
- package/src/hooks/usePrevious.tsx +0 -9
- package/src/hooks/usePrintSelected.tsx +0 -37
- package/src/hooks/useVirtualHash.tsx +0 -33
- package/src/hooks/window/useWindowSize.tsx +0 -36
- package/src/index.tsx +0 -134
- package/src/interfaces/IAppResourceConfig.tsx +0 -20
- package/src/interfaces/Log.tsx +0 -16
- package/src/interfaces/Tenant.tsx +0 -25
- package/src/interfaces/communication/IActions.tsx +0 -5
- package/src/interfaces/communication/INotification.tsx +0 -21
- package/src/interfaces/communication/IPayload.tsx +0 -3
- package/src/interfaces/communication/IRequestAction.tsx +0 -10
- package/src/interfaces/communication/IRequestPayload.tsx +0 -7
- package/src/interfaces/communication/IResponseAction.tsx +0 -7
- package/src/interfaces/misc/IAny.tsx +0 -3
- package/src/interfaces/misc/IFlashMessage.tsx +0 -10
- package/src/interfaces/navigation/IAppMenu.ts +0 -14
- package/src/interfaces/navigation/ICollapsableSidebarMenu.ts +0 -12
- package/src/interfaces/navigation/IMenuItem.ts +0 -16
- package/src/interfaces/notifications/IModel.tsx +0 -6
- package/src/interfaces/notifications/IModelField.tsx +0 -8
- package/src/interfaces/notifications/IUserNotification.tsx +0 -12
- package/src/interfaces/notifications/IUserNotificationData.tsx +0 -13
- package/src/interfaces/notifications/IUserNotificationPayload.tsx +0 -8
- package/src/interfaces/user/IGetAuth.tsx +0 -92
- package/src/interfaces/user/ITenantSettings.tsx +0 -3
- package/src/interfaces/user/IUser.tsx +0 -60
- package/src/interfaces/user/IUserSettings.tsx +0 -43
- package/src/interfaces.tsx +0 -6
- package/src/layout/AppLayout.tsx +0 -112
- package/src/layout/ApplicationLayout.tsx +0 -197
- package/src/layout/MotionWrapper.original.tsx +0 -236
- package/src/layout/MotionWrapper.tsx +0 -236
- package/src/layout/ResourceMenu.tsx +0 -164
- package/src/layout/ResoureLayout.tsx +0 -105
- package/src/layout/TransitionWrapper.tsx +0 -125
- package/src/pages/ChangePassword.tsx +0 -179
- package/src/pages/DASHLanding.tsx +0 -22
- package/src/pages/DASHLightWeightLogin.tsx +0 -611
- package/src/pages/DASHSimpleLogin.tsx +0 -260
- package/src/pages/Login.tsx +0 -111
- package/src/pages/Profile.tsx +0 -357
- package/src/pages/RecoverPassword.tsx +0 -175
- package/src/pages/SingleImageUploader.tsx +0 -55
- package/src/pages/VerifyAccount.tsx +0 -128
- package/src/providers/authProvider.tsx +0 -217
- package/src/providers/dataProvider.tsx +0 -672
- package/src/providers/i18n/en.ts +0 -646
- package/src/providers/i18n/es.ts +0 -652
- package/src/providers/i18n/languages.tsx +0 -8
- package/src/providers/i18n/mergeTranslations.ts +0 -53
- package/src/providers/i18nProvider.tsx +0 -23
- package/src/react-admin-dash/RADashComponent.tsx +0 -240
- package/src/react-admin-dash/Resource.tsx +0 -77
- package/src/resources/Brand/BrandResource.tsx +0 -130
- package/src/resources/DASHResourceLoader.ts +0 -180
- package/src/resources/Log/LogResource.tsx +0 -73
- package/src/resources/Tenant/ImpersonateTenantResource.tsx +0 -113
- package/src/resources/Trash/TrashTemplate.tsx +0 -180
- package/src/resources/User/components/AvatarUploadField.tsx +0 -57
- package/src/resources/User/components/PasswordFields.tsx +0 -73
- package/src/resources/User/getProfileMenu.ts +0 -57
- package/src/resources/User/profileResource.tsx +0 -51
- package/src/resources/User/userLayout.tsx +0 -62
- package/src/resources/User/userResource.tsx +0 -111
- package/src/resources/User/userSchema.tsx +0 -213
- package/src/resources/User/usersFilters.tsx +0 -21
- package/src/resources.tsx +0 -280
- package/src/schemas/log.tsx +0 -45
- package/src/schemas/notification.tsx +0 -42
- package/src/schemas/permissions.tsx +0 -44
- package/src/schemas/roles.tsx +0 -48
- package/src/schemas/rolesDataGrid.tsx +0 -48
- package/src/schemas/subscription/components/SubscriptionActions.tsx +0 -153
- package/src/schemas/subscription/components/SubscriptionPaymentHistory.tsx +0 -127
- package/src/schemas/subscription/components/SubscriptionPlanFeatures.tsx +0 -162
- package/src/schemas/subscription/components/SubscriptionPlanPreview.tsx +0 -141
- package/src/schemas/subscription/components/SubscriptionPlanStats.tsx +0 -318
- package/src/schemas/subscription/components/SubscriptionStatusIndicator.tsx +0 -72
- package/src/schemas/subscription/subscriptionPlanSchema.tsx +0 -185
- package/src/schemas/subscription/subscriptionSchema.tsx +0 -152
- package/src/schemas/subscriptionPlan.ts +0 -422
- package/src/schemas/tenant.tsx +0 -129
- package/src/schemas/tenantUser.tsx +0 -96
- package/src/schemas/tenant_superadmin.tsx +0 -119
- package/src/schemas/user.tsx +0 -26
- package/src/systemResources.old.tsx +0 -928
- package/src/systemResources.tsx +0 -1369
- package/src/templates/ResourceTemplate.tsx +0 -240
- package/src/templates/ResourceTemplate.tsx.memoized_experiment +0 -350
- package/src/templates/ResourceTemplate.tsx.original +0 -396
- package/src/templates/ResourceTemplateCreate.tsx +0 -182
- package/src/templates/ResourceTemplateEdit.tsx +0 -176
- package/src/templates/ResourceTemplateFull.tsx +0 -581
- package/src/templates/ResourceTemplateList.tsx +0 -340
- package/src/templates/ResourceTemplateOld.tsx.bkup +0 -567
- package/src/templates/ResourceTemplateShow.tsx +0 -88
- package/src/templates/TrashTemplate.tsx +0 -179
- package/src/tenantResources.tsx +0 -223
- package/src/test_portal_bubbles.tsx +0 -40
- package/src/theme/AppHeader.tsx +0 -52
- package/src/theme/AppLayoutSetting.tsx +0 -33
- package/src/theme/AppLogo.tsx +0 -13
- package/src/theme/AppSidebar.tsx +0 -12
- package/src/theme/AppSidebarContent.tsx +0 -105
- package/src/theme/AppSidebarLogo.tsx +0 -48
- package/src/theme/components/PageTitle.tsx +0 -37
- package/src/utils/cache/CacheInvalidatorContext.tsx +0 -125
- package/src/utils/cache/CacheInvalidatorListenerComponent.tsx +0 -10
- package/src/utils/cache/useCacheInvalidatorListener.tsx +0 -27
- package/src/utils/convertFileToBase64.tsx +0 -9
- package/src/utils/convertToFile.tsx +0 -14
- package/src/utils/cookies.tsx +0 -33
- package/src/utils/dashDefaultQueryClient.tsx +0 -34
- package/src/utils/dataUrlToBlob.tsx +0 -30
- package/src/utils/deepReplace.tsx +0 -19
- package/src/utils/getProfileMenu.tsx +0 -41
- package/src/utils/getTenantSettings.tsx +0 -9
- package/src/utils/getType.tsx +0 -8
- package/src/utils/getUserSettings.tsx +0 -8
- package/src/utils/hasCode.tsx +0 -14
- package/src/utils/index.ts +0 -19
- package/src/utils/injectTenantStyles.ts +0 -28
- package/src/utils/isComponent.tsx +0 -45
- package/src/utils/navEvents.tsx +0 -91
- package/src/utils/prototypes.tsx +0 -5
- package/src/utils/regexp.tsx +0 -4
- package/src/utils/resolveObjectPath.tsx +0 -4
- package/src/utils/setNativeValue.tsx +0 -24
- package/src/utils/slugify.tsx +0 -11
- package/src/utils/validators/emailValidator.tsx +0 -6
- package/src/utils/validators/requiredValidator.tsx +0 -5
- package/src/utils/validators/rutValidator.tsx +0 -31
- package/src/utils/validators.tsx +0 -96
|
@@ -1,231 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useTheme, useMediaQuery } from '@mui/material';
|
|
3
|
-
/* @ts-ignore */
|
|
4
|
-
import Logo from '@app/assets/logo-horizontal.png';
|
|
5
|
-
/* @ts-ignore */
|
|
6
|
-
import BackImage from '@app/assets/login-back.png';
|
|
7
|
-
|
|
8
|
-
export interface IFullLayoutMarkup<U = any, A = any> extends React.PropsWithChildren {
|
|
9
|
-
logo?: string | React.ReactNode;
|
|
10
|
-
loginBackground?: string | React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const FullLayoutMarkup = <U, A>({
|
|
14
|
-
children,
|
|
15
|
-
className,
|
|
16
|
-
logo = <img alt='logo' className='dash-app-login-logo' src={Logo} />,
|
|
17
|
-
loginBackground = <img alt='' src={BackImage} />,
|
|
18
|
-
...props
|
|
19
|
-
}: IFullLayoutMarkup<U, A> & { className?: string }): React.JSX.Element => {
|
|
20
|
-
const theme = useTheme();
|
|
21
|
-
const isXs = useMediaQuery(theme.breakpoints.only('xs'));
|
|
22
|
-
const isSm = useMediaQuery(theme.breakpoints.only('sm'));
|
|
23
|
-
const isMd = useMediaQuery(theme.breakpoints.only('md'));
|
|
24
|
-
const isLg = useMediaQuery(theme.breakpoints.only('lg'));
|
|
25
|
-
const isXl = useMediaQuery(theme.breakpoints.only('xl'));
|
|
26
|
-
/*
|
|
27
|
-
// Mobile and keyboard state
|
|
28
|
-
const [isMobile, setIsMobile] = useState(false);
|
|
29
|
-
const [isKeyboardOpen, setIsKeyboardOpen] = useState(false);
|
|
30
|
-
const [keyboardHeight, setKeyboardHeight] = useState(0);
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// Check if Capacitor Keyboard is available through window
|
|
34
|
-
const isCapacitorKeyboardAvailable = (): boolean => {
|
|
35
|
-
const hasCapacitor = !!(window as any)?.Capacitor?.Plugins?.Keyboard;
|
|
36
|
-
const hasCapacitorKeyboard = !!(window as any)?.CapacitorKeyboard;
|
|
37
|
-
console.log('Checking Capacitor keyboard availability:', { hasCapacitor, hasCapacitorKeyboard });
|
|
38
|
-
return hasCapacitor || hasCapacitorKeyboard;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
// Get Capacitor Keyboard instance from window
|
|
42
|
-
const getCapacitorKeyboard = () => {
|
|
43
|
-
return (window as any)?.Capacitor?.Plugins?.Keyboard || (window as any)?.CapacitorKeyboard;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const checkMobileDevice = () => {
|
|
47
|
-
// Check body classes for mobile devices
|
|
48
|
-
const bodyClasses = document.body.className;
|
|
49
|
-
const hasMobileClass = bodyClasses.includes('webview') ||
|
|
50
|
-
bodyClasses.includes('android') ||
|
|
51
|
-
bodyClasses.includes('ios') ||
|
|
52
|
-
bodyClasses.includes('mobile');
|
|
53
|
-
|
|
54
|
-
// Check screen width
|
|
55
|
-
const screenWidth = window.innerWidth;
|
|
56
|
-
const isSmallScreen = screenWidth < 700;
|
|
57
|
-
|
|
58
|
-
// Consider mobile if either condition is true
|
|
59
|
-
return hasMobileClass || isSmallScreen;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Keyboard logging functions
|
|
63
|
-
const logKeyboardShow = (height?: number, source: 'capacitor' | 'fallback' = 'capacitor') => {
|
|
64
|
-
console.log(`🔼 KEYBOARD OPENED (${source}):`, {
|
|
65
|
-
height: height || 'unknown',
|
|
66
|
-
timestamp: new Date().toISOString(),
|
|
67
|
-
isMobile,
|
|
68
|
-
screenHeight: window.screen.height,
|
|
69
|
-
viewportHeight: window.visualViewport?.height || window.innerHeight,
|
|
70
|
-
source
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const logKeyboardHide = (source: 'capacitor' | 'fallback' = 'capacitor') => {
|
|
75
|
-
console.log(`🔽 KEYBOARD CLOSED (${source}):`, {
|
|
76
|
-
timestamp: new Date().toISOString(),
|
|
77
|
-
isMobile,
|
|
78
|
-
screenHeight: window.screen.height,
|
|
79
|
-
viewportHeight: window.visualViewport?.height || window.innerHeight,
|
|
80
|
-
source
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// Fallback keyboard detection for web/non-Capacitor environments
|
|
85
|
-
const setupFallbackKeyboardDetection = () => {
|
|
86
|
-
const handleResize = () => {
|
|
87
|
-
const mobile = checkMobileDevice();
|
|
88
|
-
setIsMobile(mobile);
|
|
89
|
-
|
|
90
|
-
if (mobile) {
|
|
91
|
-
// On mobile, detect keyboard by viewport height change
|
|
92
|
-
const viewportHeight = window.visualViewport?.height || window.innerHeight;
|
|
93
|
-
const screenHeight = window.screen.height;
|
|
94
|
-
|
|
95
|
-
// If viewport is significantly smaller than screen, keyboard is likely open
|
|
96
|
-
const keyboardThreshold = screenHeight * 0.75;
|
|
97
|
-
const keyboardOpen = viewportHeight < keyboardThreshold;
|
|
98
|
-
|
|
99
|
-
// Only log if keyboard state actually changed
|
|
100
|
-
if (keyboardOpen !== isKeyboardOpen) {
|
|
101
|
-
if (keyboardOpen) {
|
|
102
|
-
const estimatedKeyboardHeight = screenHeight - viewportHeight;
|
|
103
|
-
logKeyboardShow(estimatedKeyboardHeight, 'fallback');
|
|
104
|
-
setKeyboardHeight(estimatedKeyboardHeight);
|
|
105
|
-
} else {
|
|
106
|
-
logKeyboardHide('fallback');
|
|
107
|
-
setKeyboardHeight(0);
|
|
108
|
-
}
|
|
109
|
-
setIsKeyboardOpen(keyboardOpen);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
// Add resize listeners
|
|
115
|
-
window.addEventListener('resize', handleResize);
|
|
116
|
-
if (window.visualViewport) {
|
|
117
|
-
window.visualViewport.addEventListener('resize', handleResize);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
return () => {
|
|
121
|
-
window.removeEventListener('resize', handleResize);
|
|
122
|
-
if (window.visualViewport) {
|
|
123
|
-
window.visualViewport.removeEventListener('resize', handleResize);
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
// Setup keyboard detection (Capacitor or fallback)
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
// Initial mobile check
|
|
131
|
-
setIsMobile(checkMobileDevice());
|
|
132
|
-
|
|
133
|
-
if (isCapacitorKeyboardAvailable()) {
|
|
134
|
-
const Keyboard = getCapacitorKeyboard();
|
|
135
|
-
|
|
136
|
-
if (Keyboard) {
|
|
137
|
-
console.log('🎹 Using Capacitor Keyboard API for keyboard detection');
|
|
138
|
-
|
|
139
|
-
// Setup Capacitor keyboard listeners
|
|
140
|
-
const keyboardWillShowListener = Keyboard.addListener('keyboardWillShow', (info: any) => {
|
|
141
|
-
console.log('📱 Capacitor: keyboard will show with height:', info.keyboardHeight);
|
|
142
|
-
logKeyboardShow(info.keyboardHeight, 'capacitor');
|
|
143
|
-
setIsKeyboardOpen(true);
|
|
144
|
-
setKeyboardHeight(info.keyboardHeight);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', (info: any) => {
|
|
148
|
-
console.log('📱 Capacitor: keyboard did show with height:', info.keyboardHeight);
|
|
149
|
-
// Don't log again here to avoid duplicate logs, just ensure state is correct
|
|
150
|
-
setIsKeyboardOpen(true);
|
|
151
|
-
setKeyboardHeight(info.keyboardHeight);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
const keyboardWillHideListener = Keyboard.addListener('keyboardWillHide', () => {
|
|
155
|
-
console.log('📱 Capacitor: keyboard will hide');
|
|
156
|
-
logKeyboardHide('capacitor');
|
|
157
|
-
setIsKeyboardOpen(false);
|
|
158
|
-
setKeyboardHeight(0);
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', () => {
|
|
162
|
-
console.log('📱 Capacitor: keyboard did hide');
|
|
163
|
-
// Don't log again here to avoid duplicate logs, just ensure state is correct
|
|
164
|
-
setIsKeyboardOpen(false);
|
|
165
|
-
setKeyboardHeight(0);
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
// Cleanup function for Capacitor listeners
|
|
169
|
-
return () => {
|
|
170
|
-
keyboardWillShowListener.then((listener: any) => listener.remove());
|
|
171
|
-
keyboardDidShowListener.then((listener: any) => listener.remove());
|
|
172
|
-
keyboardWillHideListener.then((listener: any) => listener.remove());
|
|
173
|
-
keyboardDidHideListener.then((listener: any) => listener.remove());
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
// If Capacitor is not available or Keyboard is not found, use fallback
|
|
179
|
-
console.log('🌐 Using fallback keyboard detection (viewport-based)');
|
|
180
|
-
return setupFallbackKeyboardDetection();
|
|
181
|
-
}, []);
|
|
182
|
-
|
|
183
|
-
// Configure Capacitor Keyboard on mount (if available)
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
const configureKeyboard = async () => {
|
|
186
|
-
if (isCapacitorKeyboardAvailable()) {
|
|
187
|
-
const Keyboard = getCapacitorKeyboard();
|
|
188
|
-
|
|
189
|
-
if (Keyboard) {
|
|
190
|
-
try {
|
|
191
|
-
console.log('⚙️ Configuring Capacitor Keyboard settings...');
|
|
192
|
-
|
|
193
|
-
// Disable accessory bar for cleaner login UI
|
|
194
|
-
await Keyboard.setAccessoryBarVisible({ isVisible: false });
|
|
195
|
-
|
|
196
|
-
// Set resize mode to body for better control
|
|
197
|
-
await Keyboard.setResizeMode({ mode: 'body' });
|
|
198
|
-
|
|
199
|
-
console.log('✅ Capacitor Keyboard configured successfully');
|
|
200
|
-
} catch (error) {
|
|
201
|
-
console.log('❌ Error configuring Capacitor Keyboard:', error);
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
configureKeyboard();
|
|
208
|
-
}, []);
|
|
209
|
-
*/
|
|
210
|
-
|
|
211
|
-
const currentSize = isXs ? 'xs' : isSm ? 'sm' : isMd ? 'md' : isLg ? 'lg' : isXl ? 'xl' : '';
|
|
212
|
-
const largerToSm = currentSize === 'md' || currentSize === 'lg' || currentSize === 'xl';
|
|
213
|
-
|
|
214
|
-
// `logo`/`loginBackground` are still accepted for backwards compatibility
|
|
215
|
-
// with existing callers, but are no longer rendered as a decorative
|
|
216
|
-
// `.dash-app-login-back` side/stacked panel here — pages that want a
|
|
217
|
-
// logo/banner (e.g. DASHLightWeightLogin's "already logged in" screen)
|
|
218
|
-
// now render their own, inline with their content.
|
|
219
|
-
void largerToSm;
|
|
220
|
-
void logo;
|
|
221
|
-
void loginBackground;
|
|
222
|
-
|
|
223
|
-
return (
|
|
224
|
-
<div className={`dash-app-layout ${className || ''}`}>
|
|
225
|
-
<div className='dash-app-login-wrapper'>
|
|
226
|
-
{children}
|
|
227
|
-
</div>
|
|
228
|
-
</div>
|
|
229
|
-
);
|
|
230
|
-
};
|
|
231
|
-
export default FullLayoutMarkup;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { IDASHAppState } from 'dash-admin-state';
|
|
2
|
-
import { IDashAutoAdminResourceConfig } from 'dash-auto-admin';
|
|
3
|
-
import React, { PropsWithChildren } from 'react';
|
|
4
|
-
import { useSelector } from 'react-redux';
|
|
5
|
-
|
|
6
|
-
export interface IStaticLayout<U = any, A = any> extends React.PropsWithChildren { }
|
|
7
|
-
|
|
8
|
-
const StaticLayout = <U, A>({
|
|
9
|
-
children,
|
|
10
|
-
...props
|
|
11
|
-
}: IStaticLayout<U, A>): React.JSX.Element => {
|
|
12
|
-
|
|
13
|
-
const panelSettings = useSelector(
|
|
14
|
-
(state: IDASHAppState<U, A, IDashAutoAdminResourceConfig>) =>
|
|
15
|
-
state.common.panelSettings,
|
|
16
|
-
);
|
|
17
|
-
|
|
18
|
-
//const logo = panelSettings?.logo || <>🖥 DASH</>;
|
|
19
|
-
const squaredLogo = panelSettings?.squaredLogo || <>🖥.</>;
|
|
20
|
-
//const loginBackground = panelSettings?.loginBackground || <> Welcome to Dash Panel </>;
|
|
21
|
-
|
|
22
|
-
return (
|
|
23
|
-
<div className='dash-app-static'>
|
|
24
|
-
<div className='dash-app-static-wrapper'>
|
|
25
|
-
<div className='dash-app-static-content'>
|
|
26
|
-
<a href='/'>
|
|
27
|
-
{typeof squaredLogo === 'string' ? (
|
|
28
|
-
<img alt='logo' className='dash-app-static-logo' src={squaredLogo} />
|
|
29
|
-
) : (
|
|
30
|
-
<div className='dash-app-static-logo'>{squaredLogo}</div>
|
|
31
|
-
)}
|
|
32
|
-
</a>
|
|
33
|
-
|
|
34
|
-
{children}
|
|
35
|
-
</div>
|
|
36
|
-
{/*<div className='dash-app-back'>
|
|
37
|
-
<img alt='logo' src={ImgLogo} className='dash-app-logo' />
|
|
38
|
-
<div className='dash-app-login-img'>
|
|
39
|
-
<img src={ImgLoginBack} alt='' />
|
|
40
|
-
</div>
|
|
41
|
-
</div>*/}
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export default StaticLayout;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as DASHAppLayout } from './DomainAppLayout';
|
|
2
|
-
export { default as DASHAppProviders } from './DASHAppProviders';
|
|
3
|
-
|
|
4
|
-
export { default as DomainTheme } from './DomainTheme';
|
|
5
|
-
export { default as DomainHeader } from './DomainHeader';
|
|
6
|
-
export { default as FullLayoutMarkup } from './FullLayoutMarkup';
|
|
7
|
-
export { default as StaticLayout } from './StaticLayout';
|
|
8
|
-
export { default as DashThemeContext } from './DashThemeContext';
|
|
9
|
-
export { default as DashThemeHelperProvider, useDashThemeHelperContext } from './DashThemeHelperProvider';
|
|
10
|
-
//export { default as updateDomCssVariables } from './updateDomCssVariables';
|
|
11
|
-
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { useSelector } from 'react-redux';
|
|
4
|
-
import { useNavigate } from 'react-router';
|
|
5
|
-
import { Box, Paper, ButtonBase, Typography, useTheme, SxProps, Theme } from '@mui/material';
|
|
6
|
-
import HorizontalScroller from '../../components/misc/HorizontalScroller';
|
|
7
|
-
|
|
8
|
-
import { IDashAutoAdminResourceConfig } from 'dash-auto-admin';
|
|
9
|
-
import { IDASHAppState } from 'dash-admin-state';
|
|
10
|
-
|
|
11
|
-
import checkRole from '../../helpers/checkRole';
|
|
12
|
-
import { useAuthContext } from '../../contexts/auth/AuthContext';
|
|
13
|
-
import { useI18nBridge } from '../../contexts/I18nBridgeContext';
|
|
14
|
-
|
|
15
|
-
export type DashboardGridCardSize = 'small' | 'medium' | 'large' | number;
|
|
16
|
-
|
|
17
|
-
export interface IDashboardMenuGridColumns {
|
|
18
|
-
xs?: number;
|
|
19
|
-
sm?: number;
|
|
20
|
-
md?: number;
|
|
21
|
-
lg?: number;
|
|
22
|
-
xl?: number;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export interface IDashboardMenuGridProps {
|
|
26
|
-
/** Number of grid columns — a single number, or MUI-style responsive breakpoints. Default: { xs: 2, sm: 3, md: 4, lg: 6 }. */
|
|
27
|
-
columns?: number | IDashboardMenuGridColumns;
|
|
28
|
-
/** Caps the visible grid to this many rows, scrolling internally beyond that. Omit to let the grid grow with its content. */
|
|
29
|
-
rows?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Which way the grid overflows once `rows` is set.
|
|
32
|
-
*
|
|
33
|
-
* 'vertical' (default) keeps the existing behaviour — fixed columns, scroll
|
|
34
|
-
* down. 'horizontal' lays the cards out in `rows` fixed rows flowing left to
|
|
35
|
-
* right and scrolls/swipes sideways, which suits a shortcut strip sharing a
|
|
36
|
-
* dashboard with other content: it takes a predictable amount of vertical
|
|
37
|
-
* space no matter how many resources a tenant has.
|
|
38
|
-
*
|
|
39
|
-
* Ignored without `rows` — there is nothing to overflow.
|
|
40
|
-
*/
|
|
41
|
-
orientation?: 'vertical' | 'horizontal';
|
|
42
|
-
/** Card/icon preset, or an explicit card size in pixels. Default: 'large'. */
|
|
43
|
-
size?: DashboardGridCardSize;
|
|
44
|
-
/** Gap between cards, in MUI spacing units. Default: 2. */
|
|
45
|
-
gap?: number;
|
|
46
|
-
/** Overrides the resources pulled from the Redux store — mirrors AppMaterialMenu's `menu` prop, mainly for debugging/storybook. */
|
|
47
|
-
menu?: IDashAutoAdminResourceConfig[];
|
|
48
|
-
debug?: boolean;
|
|
49
|
-
sx?: SxProps<Theme>;
|
|
50
|
-
className?: string;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface IDashboardGridItem {
|
|
54
|
-
key: React.Key;
|
|
55
|
-
label: string;
|
|
56
|
-
to: string;
|
|
57
|
-
icon?: IDashAutoAdminResourceConfig['icon'];
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const SIZE_PRESETS: Record<'small' | 'medium' | 'large', { card: number; icon: number }> = {
|
|
61
|
-
small: { card: 96, icon: 32 },
|
|
62
|
-
medium: { card: 128, icon: 48 },
|
|
63
|
-
large: { card: 160, icon: 64 },
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const resolveSize = (size: DashboardGridCardSize | undefined) => {
|
|
67
|
-
if (typeof size === 'number') {
|
|
68
|
-
return { card: size, icon: Math.round(size * 0.4) };
|
|
69
|
-
}
|
|
70
|
-
return SIZE_PRESETS[size ?? 'large'];
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// Same convention AppMaterialMenu uses to turn a resource config into a
|
|
74
|
-
// navigable path — kept in sync deliberately, so a resource lands on the
|
|
75
|
-
// same URL whether it's clicked from the sidebar or from this grid.
|
|
76
|
-
const buildMenuPath = (resource: IDashAutoAdminResourceConfig): string => {
|
|
77
|
-
if (resource.menuOnly) {
|
|
78
|
-
return resource.redirect || resource.path || `/${resource.model}`;
|
|
79
|
-
}
|
|
80
|
-
if (resource?.redirect?.startsWith('/')) {
|
|
81
|
-
return resource.redirect;
|
|
82
|
-
}
|
|
83
|
-
if (resource?.redirect) {
|
|
84
|
-
return `/${resource.model}/${resource.redirect}`.replace(/\/+/g, '/');
|
|
85
|
-
}
|
|
86
|
-
return `/${resource.model}`.replace(/\/+/g, '/');
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const renderIcon = (icon: IDashAutoAdminResourceConfig['icon'], size: number) => {
|
|
90
|
-
if (!icon) return null;
|
|
91
|
-
|
|
92
|
-
if (React.isValidElement(icon)) {
|
|
93
|
-
const existingSx = (icon.props as any)?.sx;
|
|
94
|
-
return React.cloneElement(icon as React.ReactElement<any>, {
|
|
95
|
-
sx: { fontSize: size, color: 'primary.main', ...existingSx },
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const IconComponent = icon as React.ComponentType<any>;
|
|
100
|
-
return <IconComponent sx={{ fontSize: size, color: 'primary.main' }} />;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Flat, icon-first grid of every resource/menu option the current user can
|
|
105
|
-
* access — a launcher-style alternative to the sidebar, meant to be dropped
|
|
106
|
-
* into an app's Dashboard. Layout (columns/rows/card size) is fully
|
|
107
|
-
* prop-driven; the item list itself always comes from the same role-filtered
|
|
108
|
-
* resource set AppMaterialMenu uses, so the grid never drifts out of sync
|
|
109
|
-
* with what's actually reachable from the sidebar.
|
|
110
|
-
*/
|
|
111
|
-
const AppDashboardGrid: React.FC<IDashboardMenuGridProps> = ({
|
|
112
|
-
columns = { xs: 2, sm: 3, md: 4, lg: 6 },
|
|
113
|
-
rows,
|
|
114
|
-
size = 'large',
|
|
115
|
-
orientation = 'vertical',
|
|
116
|
-
gap = 2,
|
|
117
|
-
menu,
|
|
118
|
-
debug,
|
|
119
|
-
sx,
|
|
120
|
-
className,
|
|
121
|
-
}) => {
|
|
122
|
-
const navigate = useNavigate();
|
|
123
|
-
const theme = useTheme();
|
|
124
|
-
const authContext = useAuthContext();
|
|
125
|
-
const { i18nProvider } = useI18nBridge();
|
|
126
|
-
|
|
127
|
-
const translate = React.useCallback((key: string, options?: any) => {
|
|
128
|
-
if (typeof key !== 'string') return key;
|
|
129
|
-
if (i18nProvider?.translate) {
|
|
130
|
-
try {
|
|
131
|
-
return i18nProvider.translate(key, options);
|
|
132
|
-
} catch {
|
|
133
|
-
return key;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return key;
|
|
137
|
-
}, [i18nProvider]);
|
|
138
|
-
|
|
139
|
-
const resources = useSelector(
|
|
140
|
-
(state: IDASHAppState<any, any, IDashAutoAdminResourceConfig>) => {
|
|
141
|
-
if (debug || menu) return menu;
|
|
142
|
-
return state.resources.items;
|
|
143
|
-
},
|
|
144
|
-
);
|
|
145
|
-
|
|
146
|
-
const items = React.useMemo<IDashboardGridItem[]>(() => {
|
|
147
|
-
const userRoles = authContext?.user?.roles
|
|
148
|
-
? authContext.user.roles.flatMap((role) => role.name)
|
|
149
|
-
: ['Public'];
|
|
150
|
-
|
|
151
|
-
return (resources || [])
|
|
152
|
-
.filter((resource) => resource.hidden !== true && checkRole(userRoles, resource.roles || []))
|
|
153
|
-
.map((resource) => {
|
|
154
|
-
const label = resource.label || resource.model;
|
|
155
|
-
return {
|
|
156
|
-
key: label,
|
|
157
|
-
label: translate(label, { _: label }),
|
|
158
|
-
to: buildMenuPath(resource),
|
|
159
|
-
icon: resource.icon,
|
|
160
|
-
};
|
|
161
|
-
});
|
|
162
|
-
}, [resources, authContext?.user, translate]);
|
|
163
|
-
|
|
164
|
-
const { card: cardSize, icon: iconSize } = resolveSize(size);
|
|
165
|
-
|
|
166
|
-
const columnTemplate = React.useMemo(() => {
|
|
167
|
-
if (typeof columns === 'number') {
|
|
168
|
-
return `repeat(${columns}, minmax(0, 1fr))`;
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
xs: `repeat(${columns.xs ?? 2}, minmax(0, 1fr))`,
|
|
172
|
-
sm: `repeat(${columns.sm ?? columns.xs ?? 3}, minmax(0, 1fr))`,
|
|
173
|
-
md: `repeat(${columns.md ?? columns.sm ?? 4}, minmax(0, 1fr))`,
|
|
174
|
-
lg: `repeat(${columns.lg ?? columns.md ?? 6}, minmax(0, 1fr))`,
|
|
175
|
-
xl: `repeat(${columns.xl ?? columns.lg ?? 6}, minmax(0, 1fr))`,
|
|
176
|
-
};
|
|
177
|
-
}, [columns]);
|
|
178
|
-
|
|
179
|
-
if (!items.length) return null;
|
|
180
|
-
|
|
181
|
-
const gapPx = theme.spacing(gap);
|
|
182
|
-
|
|
183
|
-
// Defined once and used by both layouts — the two branches differ only in
|
|
184
|
-
// how the cards are arranged, never in what a card is.
|
|
185
|
-
const cards = items.map((item) => (
|
|
186
|
-
<ButtonBase
|
|
187
|
-
key={item.key}
|
|
188
|
-
onClick={() => navigate(item.to)}
|
|
189
|
-
sx={{ display: 'block', borderRadius: 2, textAlign: 'left' }}
|
|
190
|
-
>
|
|
191
|
-
<Paper
|
|
192
|
-
variant="outlined"
|
|
193
|
-
sx={{
|
|
194
|
-
display: 'flex',
|
|
195
|
-
flexDirection: 'column',
|
|
196
|
-
alignItems: 'center',
|
|
197
|
-
justifyContent: 'center',
|
|
198
|
-
gap: 1,
|
|
199
|
-
height: cardSize,
|
|
200
|
-
width: '100%',
|
|
201
|
-
p: 2,
|
|
202
|
-
borderRadius: 2,
|
|
203
|
-
transition: 'background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease',
|
|
204
|
-
'&:hover': {
|
|
205
|
-
bgcolor: 'action.hover',
|
|
206
|
-
borderColor: 'primary.main',
|
|
207
|
-
transform: 'translateY(-2px)',
|
|
208
|
-
},
|
|
209
|
-
}}
|
|
210
|
-
>
|
|
211
|
-
{renderIcon(item.icon, iconSize)}
|
|
212
|
-
<Typography
|
|
213
|
-
variant="body2"
|
|
214
|
-
align="center"
|
|
215
|
-
sx={{
|
|
216
|
-
fontWeight: 500,
|
|
217
|
-
lineHeight: 1.2,
|
|
218
|
-
display: '-webkit-box',
|
|
219
|
-
WebkitLineClamp: 2,
|
|
220
|
-
WebkitBoxOrient: 'vertical',
|
|
221
|
-
overflow: 'hidden',
|
|
222
|
-
}}
|
|
223
|
-
>
|
|
224
|
-
{item.label}
|
|
225
|
-
</Typography>
|
|
226
|
-
</Paper>
|
|
227
|
-
</ButtonBase>
|
|
228
|
-
));
|
|
229
|
-
|
|
230
|
-
// The horizontal strip is wrapped in HorizontalScroller so it gets the same
|
|
231
|
-
// arrows-plus-swipe behaviour as the category carousel on the create-tab
|
|
232
|
-
// screen, rather than a second, subtly different way of scrolling.
|
|
233
|
-
if (rows && orientation === 'horizontal') {
|
|
234
|
-
return (
|
|
235
|
-
<HorizontalScroller
|
|
236
|
-
className={className}
|
|
237
|
-
ariaLabel="dashboard shortcuts"
|
|
238
|
-
step={Math.round(cardSize * 1.1) * 2}
|
|
239
|
-
trackSx={{
|
|
240
|
-
display: 'grid',
|
|
241
|
-
gap,
|
|
242
|
-
gridAutoFlow: 'column',
|
|
243
|
-
gridTemplateRows: `repeat(${rows}, ${cardSize}px)`,
|
|
244
|
-
// A definite column width so the content can exceed the
|
|
245
|
-
// container; `1fr` would shrink to fit and never scroll.
|
|
246
|
-
gridAutoColumns: `${Math.round(cardSize * 1.1)}px`,
|
|
247
|
-
pb: 1,
|
|
248
|
-
}}
|
|
249
|
-
sx={sx}
|
|
250
|
-
>
|
|
251
|
-
{cards}
|
|
252
|
-
</HorizontalScroller>
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
return (
|
|
257
|
-
<Box
|
|
258
|
-
className={className}
|
|
259
|
-
sx={{
|
|
260
|
-
display: 'grid',
|
|
261
|
-
gap,
|
|
262
|
-
...(rows
|
|
263
|
-
? {
|
|
264
|
-
gridAutoRows: cardSize,
|
|
265
|
-
maxHeight: `calc(${rows} * ${cardSize}px + ${rows - 1} * ${gapPx})`,
|
|
266
|
-
overflowY: 'auto',
|
|
267
|
-
pr: 1,
|
|
268
|
-
}
|
|
269
|
-
: {}),
|
|
270
|
-
gridTemplateColumns: columnTemplate,
|
|
271
|
-
...sx,
|
|
272
|
-
}}
|
|
273
|
-
>
|
|
274
|
-
{cards}
|
|
275
|
-
</Box>
|
|
276
|
-
);
|
|
277
|
-
};
|
|
278
|
-
|
|
279
|
-
export default AppDashboardGrid;
|