Przeglądaj źródła

Formatted changes with prettier

jnfrati 5 lat temu
rodzic
commit
f511a3a8ed

+ 22 - 27
dashboard/src/components/CopyToClipboard.tsx

@@ -3,27 +3,24 @@ import ClipboardJS from "clipboard";
 import React, { Component, RefObject } from "react";
 import styled from "styled-components";
 
-
-
 type PropsType = {
-  text: string,
-  onSuccess?: (e: ClipboardJS.Event) => void
-  onError?: (e: ClipboardJS.Event) => void
+  text: string;
+  onSuccess?: (e: ClipboardJS.Event) => void;
+  onError?: (e: ClipboardJS.Event) => void;
 };
 
 type StateType = {
-  clipboard: ClipboardJS | undefined,
+  clipboard: ClipboardJS | undefined;
 };
 
-
 /**
  * Enables parent onClick to copy the text provided to the CopyToClipboard element.
- * 
- * 
- * Example of usage: 
+ *
+ *
+ * Example of usage:
  * <MyCustomComponent>
- *    <CopyToClipboard 
- *      text={`some usefull text ${var}`} 
+ *    <CopyToClipboard
+ *      text={`some usefull text ${var}`}
  *      onSuccess={(e) => console.log("Success event:", e)}
  *      onError={(e) => console.log("Error event:", e)}
  *    />
@@ -31,33 +28,35 @@ type StateType = {
  */
 export default class CopyToClipboard extends Component<PropsType, StateType> {
   triggerRef: RefObject<HTMLSpanElement>;
-  
+
   state: StateType = {
     clipboard: undefined,
-  }
+  };
 
   constructor(props: PropsType) {
     super(props);
     this.triggerRef = React.createRef();
   }
-  
+
   componentDidMount() {
     const trigger = this.triggerRef.current.parentElement;
     if (!trigger) {
-      console.error('Couldn\'t find a parent element. The CopyToClipboard component should be inside the trigger component, for example a button')
+      console.error(
+        "Couldn't find a parent element. The CopyToClipboard component should be inside the trigger component, for example a button"
+      );
       return;
     }
     const clipboard = new ClipboardJS(trigger, {
       text: () => {
         return this.props.text;
-      }
+      },
     });
-  
+
     this.props.onSuccess && clipboard.on("success", this.props.onSuccess);
-  
+
     this.props.onError && clipboard.on("error", this.props.onError);
-  
-    this.setState({clipboard})
+
+    this.setState({ clipboard });
   }
 
   componentWillUnmount() {
@@ -67,14 +66,10 @@ export default class CopyToClipboard extends Component<PropsType, StateType> {
   }
 
   render() {
-    return (
-      <NonVisibleSpan ref={this.triggerRef}>
-      </NonVisibleSpan>
-    )
+    return <NonVisibleSpan ref={this.triggerRef}></NonVisibleSpan>;
   }
 }
 
 const NonVisibleSpan = styled.span`
   display: none;
-`
-
+`;

+ 2 - 2
dashboard/src/main/home/cluster-dashboard/expanded-chart/SettingsSection.tsx

@@ -155,8 +155,8 @@ export default class SettingsSection extends Component<PropsType, StateType> {
               className="material-icons"
               onMouseLeave={() => this.setState({ highlightCopyButton: false })}
             >
-              <CopyToClipboard 
-                text={webhookText} 
+              <CopyToClipboard
+                text={webhookText}
                 onSuccess={() => this.setState({ highlightCopyButton: true })}
               />
               content_copy

+ 4 - 11
dashboard/src/main/home/dashboard/ClusterList.tsx

@@ -72,17 +72,12 @@ class Templates extends Component<PropsType, StateType> {
             {this.renderIcon()}
             <TemplateTitle>{cluster.name}</TemplateTitle>
           </TitleContainer>
-          <Url onClick={e => e.stopPropagation()}>
+          <Url onClick={(e) => e.stopPropagation()}>
             <CopyToClipboard text={cluster.server} />
             <Bolded>Cluster IP:</Bolded>
-            <span>
-              {cluster.server}
-            </span>
-            <i className="material-icons-outlined">
-              content_copy
-            </i>
+            <span>{cluster.server}</span>
+            <i className="material-icons-outlined">content_copy</i>
           </Url>
-          
         </TemplateBlock>
       );
     });
@@ -112,8 +107,6 @@ const TitleContainer = styled.div`
   width: 100%;
   flex-direction: column;
   align-items: center;
-
-
 `;
 const DashboardIcon = styled.div`
   position: relative;
@@ -248,4 +241,4 @@ const Bolded = styled.div`
   color: #ffffff44;
   margin-right: 6px;
   white-space: nowrap;
-`;
+`;

+ 6 - 3
dashboard/src/main/home/project-settings/InviteList.tsx

@@ -120,8 +120,8 @@ export default class InviteList extends Component<PropsType, StateType> {
       process.env.API_SERVER
     }/api/projects/${currentProject.id}/invites/${
       this.state.invites[index].token
-    }`
-  }
+    }`;
+  };
 
   renderInvitations = () => {
     let { currentProject } = this.context;
@@ -181,7 +181,10 @@ export default class InviteList extends Component<PropsType, StateType> {
                     placeholder="Unable to retrieve link"
                   />
                   <CopyButton>
-                    <CopyToClipboard text={this.getInviteUrl(i)} onError={() => console.log("Couldn't copy to clipboard")}/>
+                    <CopyToClipboard
+                      text={this.getInviteUrl(i)}
+                      onError={() => console.log("Couldn't copy to clipboard")}
+                    />
                     Copy Link
                   </CopyButton>
                 </Rower>