Procházet zdrojové kódy

disable goback if substep does not have the action

jnfrati před 4 roky
rodič
revize
7ef28a2a88

+ 3 - 3
dashboard/src/components/Breadcrumb.tsx

@@ -6,7 +6,7 @@ import styled from "styled-components";
 type Props = {
   currentStep: string;
   steps: { value: string; label: string }[];
-  onClickStep: (step: string) => void;
+  onClickStep?: (step: string) => void;
 };
 
 const Breadcrumb: React.FC<Props> = ({ currentStep, steps, onClickStep }) => {
@@ -36,7 +36,7 @@ const StyledBreadcrumb = styled.div`
 `;
 
 const Crumb = styled.span<{ bold: boolean }>`
-  font-weight: ${props => props.bold ? "600" : "normal"};
-  color: ${props => props.bold ? "#ffffff" : "#aaaabb"};
+  font-weight: ${(props) => (props.bold ? "600" : "normal")};
+  color: ${(props) => (props.bold ? "#ffffff" : "#aaaabb")};
   font-size: 13px;
 `;

+ 1 - 0
dashboard/src/main/home/onboarding/steps/ConnectRegistry/ConnectRegistry.tsx

@@ -67,6 +67,7 @@ const ConnectRegistry: React.FC<{
           project={project}
           currentStep={step}
           goBack={goBack}
+          enable_go_back={enable_go_back}
         />
       ) : (
         <>

+ 7 - 3
dashboard/src/main/home/onboarding/steps/ConnectRegistry/forms/FormFlow.tsx

@@ -65,6 +65,7 @@ type Props = {
   project: { id: number; name: string };
   currentStep: "credentials" | "settings" | "test_connection";
   goBack: () => void;
+  enable_go_back: boolean;
 };
 
 const FormFlowWrapper: React.FC<Props> = ({
@@ -75,6 +76,7 @@ const FormFlowWrapper: React.FC<Props> = ({
   project,
   currentStep,
   goBack,
+  enable_go_back,
 }) => {
   const nextFormStep = (
     data?: Partial<Exclude<ConnectedRegistryConfig, SkipRegistryConnection>>
@@ -108,9 +110,11 @@ const FormFlowWrapper: React.FC<Props> = ({
   return (
     <FormWrapper>
       <FormHeader>
-        <CloseButton onClick={() => goBack()}>
-          <i className="material-icons">keyboard_backspace</i>
-        </CloseButton>
+        {enable_go_back && (
+          <CloseButton onClick={() => goBack()}>
+            <i className="material-icons">keyboard_backspace</i>
+          </CloseButton>
+        )}
         {FormTitle[provider] && <img src={FormTitle[provider].icon} />}
         {FormTitle[provider] && FormTitle[provider].label}
       </FormHeader>