You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/03/28 22:14:54 UTC

(incubator-devlake) branch feat-onboard-close-confirm created (now 4616b8a30)

This is an automated email from the ASF dual-hosted git repository.

mintsweet pushed a change to branch feat-onboard-close-confirm
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at 4616b8a30 feat: add confirm modal for onboard close

This branch includes the following new commits:

     new 4616b8a30 feat: add confirm modal for onboard close

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: feat: add confirm modal for onboard close

Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

mintsweet pushed a commit to branch feat-onboard-close-confirm
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 4616b8a307e347d45a77fe2e37b3f2a9260798a4
Author: mintsweet <0x...@gmail.com>
AuthorDate: Fri Mar 29 11:14:44 2024 +1300

    feat: add confirm modal for onboard close
---
 config-ui/src/routes/onboard/index.tsx | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/config-ui/src/routes/onboard/index.tsx b/config-ui/src/routes/onboard/index.tsx
index 203d89a3f..fceb49ebf 100644
--- a/config-ui/src/routes/onboard/index.tsx
+++ b/config-ui/src/routes/onboard/index.tsx
@@ -18,8 +18,8 @@
 
 import { useState, useEffect } from 'react';
 import { useNavigate } from 'react-router-dom';
-import { CloseOutlined } from '@ant-design/icons';
-import { theme, Layout } from 'antd';
+import { CloseOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
+import { theme, Layout, Modal } from 'antd';
 
 import API from '@/api';
 import { PageLoading } from '@/components';
@@ -61,6 +61,8 @@ export const Onboard = () => {
     token: { colorPrimary },
   } = theme.useToken();
 
+  const [modal, contextHolder] = Modal.useModal();
+
   const { ready, data } = useRefreshData(() => API.store.get('onboard'));
 
   useEffect(() => {
@@ -72,6 +74,17 @@ export const Onboard = () => {
     }
   }, [ready, data]);
 
+  const handleClose = () => {
+    modal.confirm({
+      width: 820,
+      title: 'Are you sure to exit the onboard session?',
+      content: 'You can get back to this session via the card on top of the Projects page.',
+      icon: <ExclamationCircleOutlined />,
+      okText: 'Confirm',
+      onOk: () => navigate('/'),
+    });
+  };
+
   if (!ready) {
     return <PageLoading />;
   }
@@ -98,10 +111,7 @@ export const Onboard = () => {
             <>
               <S.Header>
                 <h1>Connect to your first repository</h1>
-                <CloseOutlined
-                  style={{ fontSize: 18, color: '#70727F', cursor: 'pointer' }}
-                  onClick={() => navigate('/')}
-                />
+                <CloseOutlined style={{ fontSize: 18, color: '#70727F', cursor: 'pointer' }} onClick={handleClose} />
               </S.Header>
               <S.Content>
                 {[1, 2, 3].includes(step) && (
@@ -122,6 +132,7 @@ export const Onboard = () => {
             </>
           )}
         </S.Inner>
+        {contextHolder}
       </Layout>
     </Context.Provider>
   );