From 74bf11e596f2270f5c01df4287338a5b6e041e6a Mon Sep 17 00:00:00 2001 From: Marc-Antoine Hinse Date: Thu, 28 Nov 2024 11:33:08 -0500 Subject: [PATCH] Added a loading animation when initializing the data of a configuration step - Return null instead of hidden the HTML elements of a step to avoid useless rendering - Reset the data of the ConfigurationStep.Completed when re-editing - Shiny spinning Flare logo when loading the data --- .../src/ConfigurationScreen.tsx | 3 - .../components/ConfigurationCompletedStep.tsx | 20 ++++- .../components/ConfigurationInitialStep.tsx | 59 ++++++++----- .../ConfigurationUserPreferencesStep.tsx | 17 +++- .../src/components/FlareLogoLoading.css | 18 ++++ .../src/components/FlareLogoLoading.tsx | 16 ++++ .../src/components/icons/FlareLogo.tsx | 86 +++++++++++++++++++ 7 files changed, 188 insertions(+), 31 deletions(-) create mode 100644 packages/react-components/src/components/FlareLogoLoading.css create mode 100644 packages/react-components/src/components/FlareLogoLoading.tsx create mode 100644 packages/react-components/src/components/icons/FlareLogo.tsx diff --git a/packages/react-components/src/ConfigurationScreen.tsx b/packages/react-components/src/ConfigurationScreen.tsx index 1c9f75d..3456c45 100644 --- a/packages/react-components/src/ConfigurationScreen.tsx +++ b/packages/react-components/src/ConfigurationScreen.tsx @@ -57,7 +57,6 @@ const ConfigurationScreen: FC<{ theme: string }> = ({ theme }) => {

Configure your Flare Account

= ({ theme }) => { setApiKey={setApiKey} /> = ({ theme }) => { } /> void; -}> = ({ show, apiKey, configurationStep, onEditConfigurationClick }) => { +}> = ({ apiKey, configurationStep, onEditConfigurationClick }) => { + const [isInitializingData, setIsInitializingData] = useState(true); const [flareSearchUrl, setFlareSearchUrl] = useState(''); const [tenantName, setTenantName] = useState(''); @@ -28,13 +29,26 @@ const ConfigurationCompletedStep: FC<{ userTenants.find((tenant: Tenant) => tenant.id === tenantId)?.name || 'unknown' ); + setIsInitializingData(false); } ); + } else { + setIsInitializingData(true); + setFlareSearchUrl(''); + setTenantName(''); } }, [configurationStep, apiKey]); + if (configurationStep !== ConfigurationStep.Completed) { + return null; + } + + if (isInitializingData) { + return ; + } + return ( -