From 139c1f2cb3d2a2aa57b052026d1e3da430582e87 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Tue, 14 Nov 2023 18:43:26 +0300 Subject: [PATCH] Client:OAuth2:EditForm: add loader --- .../ClientForm/ClientForm.styled.ts | 16 +- .../ClientForm/ClientForm.types.ts | 5 +- .../sub-components/ClientForm/Loader.tsx | 302 ++++++++++++++++++ .../OAuth/sub-components/ClientForm/index.tsx | 6 +- 4 files changed, 325 insertions(+), 4 deletions(-) create mode 100644 packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/Loader.tsx diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts index 3e89828e0d..c7d08456bd 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.styled.ts @@ -1,6 +1,6 @@ import styled from "styled-components"; -import { mobile, tablet } from "@docspace/components/utils/device"; +import { mobile } from "@docspace/components/utils/device"; const StyledContainer = styled.div` width: 100%; @@ -10,6 +10,20 @@ const StyledContainer = styled.div` flex-direction: column; gap: 24px; + + .loader { + rect { + width: 100%; + } + } + + .scope-name-loader { + margin-bottom: 4px; + } + + .scope-desc-loader { + margin-bottom: 2px; + } `; const StyledBlock = styled.div` diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.types.ts b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.types.ts index 3d17c4ca87..735ec0118f 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.types.ts +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/ClientForm.types.ts @@ -5,6 +5,7 @@ import { IClientReqDTO, IScope, } from "@docspace/common/utils/oauth/interfaces"; +import { DeviceUnionType } from "@docspace/common/hooks/useViewEffect"; export interface InputProps { value: string; @@ -52,10 +53,10 @@ export interface ClientFormProps { regenerateSecret?: (clientId: string) => Promise; - currentDeviceType?: string; + currentDeviceType?: DeviceUnionType; } export interface ClientStore { - auth: { settingsStore: { currentDeviceType: string } }; + auth: { settingsStore: { currentDeviceType: DeviceUnionType } }; oauthStore: OAuthStoreProps; } diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/Loader.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/Loader.tsx new file mode 100644 index 0000000000..72a9a7315b --- /dev/null +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/Loader.tsx @@ -0,0 +1,302 @@ +import React from "react"; + +//@ts-ignore +import RectangleLoader from "@docspace/common/components/Loaders/RectangleLoader"; +import { DeviceUnionType } from "@docspace/common/hooks/useViewEffect"; + +import { + StyledBlock, + StyledButtonContainer, + StyledContainer, + StyledHeaderRow, + StyledInputBlock, + StyledInputGroup, + StyledInputRow, + StyledScopesCheckbox, + StyledScopesContainer, + StyledScopesName, +} from "./ClientForm.styled"; + +const HelpButtonSkeleton = () => { + return ; +}; + +const CheckboxSkeleton = ({ className }: { className?: string }) => { + return ( + + ); +}; + +const ClientFormLoader = ({ + currentDeviceType, + isEdit, +}: { + currentDeviceType?: DeviceUnionType; + isEdit: boolean; +}) => { + const buttonHeight = currentDeviceType !== "desktop" ? "40px" : "32px"; + + return ( + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + + +
+ +
+ + + + + + + + +
+
+ {isEdit && ( + + + + + + + + + + + + + + + + + + + + + + + + + + )} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ); +}; + +export default ClientFormLoader; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx index e15c82a5c5..c9ce9d11b5 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/OAuth/sub-components/ClientForm/index.tsx @@ -18,6 +18,7 @@ import ButtonsBlock from "./components/ButtonsBlock"; import { StyledContainer } from "./ClientForm.styled"; import { ClientFormProps, ClientStore } from "./ClientForm.types"; +import ClientFormLoader from "./Loader"; const ClientForm = ({ id, @@ -237,7 +238,10 @@ const ClientForm = ({ return ( {isLoading ? ( -
Loading...
+ ) : ( <>